Question: Question 23 and 25 Programming Exercises 1 23. Suppose that infile is a Scanner object associated with the file that contains the following data: 27306
Question 23 and 25

Programming Exercises 1 23. Suppose that infile is a Scanner object associated with the file that contains the following data: 27306 savings 7503.35. Write the Java statements that read and store the first input in the int variable acctNum- ber, the second input in the String variable accountType, and the third input in the double variable balance Suppose that you have the following statements: PrintWriter outfile; double distance375; double speed = 58; double travelTime; 24. Write Java statements to do the following: Open the file travel.dat using the variable outfile. Write the values of the variables distance and speed, to two decimal places, in the file travel.dat. Calculate and write the travelTime, to two decimal places, in the file travel.dat. a. b. c. 25. A program reads data from a file called inputFile.dat and, after doing some calculations, writes the results to a file called outFile.dat. Answer the following questions: a. After the program executes, what are the contents of the file inputFile.dat? b. After the program executes, what are the contents of the file outFile.dat if this file was empty before the program executed? .After the program executes, what are the contents of the file outFile.dat if this file contained 100 numbers before the program executed? What would happen if the file outFile.dat did not exist before the program executed? d. PROGRAMMING EXERCISES 1. Consider the following incomplete Java program public class Ch3_PrExercisel public static void main (String[] args)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
