Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
11th Edition
ISBN: 9780134670942
Author: Y. Daniel Liang
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 17.3, Problem 17.3.4CP
If you write the string “100” to an ASCII text file, what values are stored in the file? If you write a numeric byte-type value 100 using binary I/O, what values are stored in the file?
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Java language
Create a random access file in C drive, write numbers 1 to 100 into that, add number 1000 in 10th position, and 2000 at last. Print numbers in 9th, 10th, 11th, last position . Give your code!
Considering that an ASCII file contains just letters and numbers, how much space might be saved by reducing the size of the file? What methods would you use to accomplish this reduction?
PYTHON-Assume you have a file that has two columns separated by a comma. The first column contains gene accession numbers, and the second column contain their nucleotide sequence.
For example:
ABC123, AAGTCTTCCCTAAGCCC... KHJ456, TTCGGTCATACTATTC... NMG789, GCTACTCGATGCTA.... ....
The file can contain any number of rows.
Write a program that reads in this file (you can create one to test your code with, use TextEdit or Notepad) and creates a dictionary, where the keys are the accession numbers and the values are the sequences.
Print out to the screen the dictionary pairs that you created.
Chapter 17 Solutions
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Ch. 17.2 - What is a text file and what is a binary file? Can...Ch. 17.2 - How do you read or write text data in Java? What...Ch. 17.3 - Prob. 17.3.1CPCh. 17.3 - How is a Java character represented in the memory,...Ch. 17.3 - If you write the string ABC to an ASCII text file,...Ch. 17.3 - If you write the string 100 to an ASCII text file,...Ch. 17.3 - What is the encoding scheme for representing a...Ch. 17.4 - Prob. 17.4.1CPCh. 17.4 - Why should you always close streams? How do you...Ch. 17.4 - Prob. 17.4.3CP
Ch. 17.4 - Does FileInputStream/Fi1eOutputStream introduce...Ch. 17.4 - What will happen if you attempt to create an input...Ch. 17.4 - How do you append data to an existing text file...Ch. 17.4 - Prob. 17.4.7CPCh. 17.4 - What is written to a file using writeByte(91) on a...Ch. 17.4 - How do you check the end of a file in an input...Ch. 17.4 - What is wrong in the following code? Import...Ch. 17.4 - Suppose you run the following program on Windows...Ch. 17.4 - After the following program is finished, how many...Ch. 17.4 - For each of the following statements on a...Ch. 17.4 - What are the advantages of using buffered streams?...Ch. 17.5 - How does the program check if a file already...Ch. 17.5 - How does the program detect the end of the file...Ch. 17.5 - How does the program count the number of bytes...Ch. 17.6 - Prob. 17.6.1CPCh. 17.6 - Prob. 17.6.2CPCh. 17.6 - Is it true that any instance of...Ch. 17.6 - Prob. 17.6.4CPCh. 17.6 - Prob. 17.6.5CPCh. 17.6 - What will happen when you attempt to run the...Ch. 17.7 - Can RandomAccessFi1e streams read and write a data...Ch. 17.7 - Create a RandomAccessFi1e stream for the file...Ch. 17.7 - What happens if the file test.dat does not exist...Ch. 17 - (Create a text file) Write a program to create a...Ch. 17 - (Create a binary data file) Write a program to...Ch. 17 - (Sum all the integers in a binary data file)...Ch. 17 - (Convert a text file into UTF) Write a program...Ch. 17 - Prob. 17.5PECh. 17 - Prob. 17.6PECh. 17 - Prob. 17.7PECh. 17 - (Update count) Suppose that you wish to track how...Ch. 17 - (Address book) Write a program that stores,...Ch. 17 - (Split files) Suppose you want to back up a huge...Ch. 17 - (Split files GUI) Rewrite Exercise 17.10 with a...Ch. 17 - Prob. 17.12PECh. 17 - (Combine files GUI) Rewrite Exercise 17.12 with a...Ch. 17 - (Encrypt files) Encode the file by adding 5 to...Ch. 17 - (Decrypt files) Suppose a file is encrypted using...Ch. 17 - (Frequency of characters) Write a program that...Ch. 17 - (BitOutputStream) Implement a class named...Ch. 17 - (View bits) Write the following method that...Ch. 17 - (View hex) Write a program that prompts the user...Ch. 17 - (Hex editor) Write a GUI application that lets the...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
What is a potential error that can occur when a file is opened for reading?
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Add some suitable output statements to the following code so that all variables are traced: intn,sum=0;for(n=1;...
Absolute Java (6th Edition)
In this section, we discussed base classes and derived classes. Which is the general class and which is the spe...
Starting out with Visual C# (4th Edition)
Only the _ _init_ _method can be overridden.
Starting Out with Python (3rd Edition)
Write a program that calculates the sum of the digits of an integer. For example, the sum of the digits of the ...
Programming in C
What are the advantages in implementing a language with a pure interpreter?
Concepts Of Programming Languages
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- If you write string "ABC" to an ASCII text file, what values are stored in a file?arrow_forwardMatlab: How do I convert a jpg file into a .mat file? My file is called pic.jpg and I want to convert it to pic.mat which will be read by a programarrow_forwardWrite in Golang code Using GO as the programming language --use a input file find the number of Unique words in file.text find the number of lines in file.text find the number of Empty lines in file.text find the number of punctuation in file.text How do I find the number of words in file.text How to print the first 10 and last 10 words in the filearrow_forward
- Computer Science C++ Create a text file "input.txt" with a certain amount of integers (you decide how many). Write a program that reads these numbers from the file, adds them, and when you have reached the end of the file, calculates the average of these numbers. Print a message and the average to the console. Code this program twice, demonstrating the two methods to detect the end of the file, part A: reading a value from Instream and storing it (boolean expression) in the while loop part B: using the eof() member functionarrow_forwardHow do you read the contents of a text file that contains whitespace characters as part of its data?arrow_forwardPlease use C program language If a file contain: Wth = 33.0 Hth = 90.0 Lth = 20.0 Create a floating-point array of 100 values. Set the values of the array to the numbers [0,99]. Write a program to writes this data to a file as binary data. (size of the file should be 364 bytes?)Use od -f to check the size. Write a program that reads this data from a file and prints the values using fread().arrow_forward
- USE PYTHON Python already supports math, whereby you can write code to add, subtract, multiply, or divide values and even variables. But let’s write a program that enables users to do math, even without knowing Python. In a file called interpreter.py, implement a program that prompts the user for an arithmetic expression and then calculates and outputs the result as a floating-point value formatted to one decimal place. Assume that the user’s input will be formatted as x y z, with one space between x and y and one space between y and z, wherein: x is an integer y is +, -, *, or / z is an integer For instance, if the user inputs 1 + 1, your program should output 2.0. Assume that, if y is /, then z will not be 0. Note that, just as python itself is an interpreter for Python, so will your interpreter.py be an interpreter for math! Please see 2 attached photos for demo and Test program. **USE PYTHON** THANKSarrow_forwardwrite a code to search a name from a file and print out the name using carrow_forwardWhat is the difference between a text and a binary file? Can you use a text editor to see a text or binary file?arrow_forward
- Q. Write a program that will read a file from the user and writes its content in another file such that each line contains only 8 words. Coding language python Don't use pointers and arrays keep the program as simple as possible (beginner's level) Paste the screenshots of full program with outputarrow_forwardPython program. Write a python program to get the number of lines of a code a file had. You should take file name from userarrow_forwardWrite example of C++ program that reads and writes a binary file to a text file. It also prints the values accordingly to the consolearrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Files & File Systems: Crash Course Computer Science #20; Author: CrashCourse;https://www.youtube.com/watch?v=KN8YgJnShPM;License: Standard YouTube License, CC-BY
UNIX Programming (Part - 10) The File System (Directories and Files Names); Author: ITUTEES;https://www.youtube.com/watch?v=K35faWBhzrw;License: Standard Youtube License