Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

13. Deposit and Withdrawal Files Use Notepad or another text editor to create a text file named Deposits.txt. The file should contain the following numbers,

13. Deposit and Withdrawal Files

Use Notepad or another text editor to create a text file named Deposits.txt. The file should contain the following numbers, one per line: 100.00 124.00 78.92 37.55 Next, create a text file named Withdrawals.txt. The file should contain the following numbers, one per line: 29.88 110.00 27.52 50.00 12.90 The numbers in the Deposits.txt file are the amounts of deposits that were made to a savings account during the month, and the numbers in the Withdrawals.txt file are the amounts of withdrawals that were made during the month. Write a program that creates an instance of the SavingsAccount class that you wrote in Programming Challenge 12. The starting balance for the object is 500.00. The program should read the values from the Deposits.txt file and use the objects method to add them to the account balance. The program should read the values from the Withdrawals.txt file and use the objects method to subtract them from the account balance. The program should call the class method to calculate the monthly interest, and then display the ending balance and the total interest earned

(SavingsAccount.java, DepositsAndWithdrawls.java) Complete Programming Challenge #13 (in both textbook editions). This requires you to complete Programming Challenge #12. Submit your SavingsAccount class as well as a class with the main method. Implement your SavingsAccount class according to the UML diagram:

image text in transcribed Clarifications: If there is a discrepancy between my UML and the book description, use my UML. For instance, I have only one constructor that takes the opening balance and interest rate. Thats the only constructor. The instance variable lastInterest represents the amount of interest earned in the last month.

A sample run of #13 Enter the savings account's annual interest rate: 2.5 Starting Balance: $500.00 Deposit: $100.00, balance = $600.00 Deposit: $124.00, balance = $724.00 Deposit: $78.92, balance = $802.92 Deposit: $37.55, balance = $840.47 Withdraw: $29.88, balance = $810.59 Withdraw: $110.00, balance = $700.59 Withdraw: $27.52, balance = $673.07 Withdraw: $50.00, balance = $623.07 Withdraw: $12.90, balance = $610.17 Interest earned: $1.27 Ending balance: $611.44

Savings Account balance:double -interestRate: double -lastInterest: double +SavingsAccount(double,double) +withdraw(double) : void +deposit double): void +addInterest(void): void +getBalance (void): double +getInterestRate(void): double +getLastlnterest(void): double

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

what are the befits of Management Accounting ? cite references

Answered: 1 week ago