Complete the following tasks, assuming that each applies to the same program: a) Write a statement that

Question:

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 in- OldMaster.

b) Write a statement that opens file "trans.txt" for input—use Scanner variable in- Transaction.

c) Write a statement that opens file "newmast.txt" for output (and creation)—use for- matter 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 Account—use Scanner variable inOldMaster. Assume that class Account is the same as the Account class in Fig. 15.9.

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.

f) Write a statement that outputs a record to the file "newmast.txt". The record is an ob- ject of type Account—use Formatter variable outNewMaster.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Java How To Program Early Objects

ISBN: 9780134743356

11th Edition

Authors: Paul Deitel, Harvey Deitel

Question Posted: