Chapter 17: Problem 2
Complete the following tasks, assuming that each applies to the same program: a) Write a statement that opens file "oldmast.txt" for input-use Scanner variable in01 dMaster. b) Write a statement that opens file "trans.txt" for input-use Scanner variable inTransaction. c) Write a statement that opens file "newmast. txt" for output (and creation)-use formatter variable outNewMaster. d) Write the statements needed to read a record from the file "oldmast. txt". Use the data to create an object of class AccountRecord-use Scanner variable in01dMaster. Assume that class AccountRecord is the same as the AccountRecord class in Fig. 17.4. e) Write the statements needed to read a record from the file "trans. txt". The record is an object of class TransactionRecord-use Scanner variable inTransaction. Assume that class TransactionRecord contains method setAccount (which takes an int) to set the account number and method setAmount (which takes a double) to set the amount of the transaction. Hrite a statement that outputs a record to the file "newmast. txt". The record is an object of type AccountRecord-use Formatter variable outNewMaster.
Short Answer
Step by step solution
Key Concepts
These are the key concepts you need to understand to accurately answer the question.