Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem Description: Implement a class named Account as described in the following UML diagram: Account - id:int // private data field named id for the

image text in transcribed

Problem Description: Implement a class named Account as described in the following UML diagram: Account - id:int // private data field named id for the account (default value is 0) - monthlyFee: double // private data field named monthlyFee (default value is 0) - balance: double // private data field named balance (default value is 0) + Account() // no-arg constructor to create a default account + Account(id:int, balance: double) // constructor that creates an account with the specified id and initial balance getld(); int // accessor method for id + setld(int id): void // mutator method for id + getMonthlyFee (): double // accessor method for monthlyFee + setMonthly Fee (monthlyFee: double): void // mutator method for monthlyFee + getBalance(): double // accessor method for balance + setBalance(balance: double): void // mutator method for balance + calMonthlyBalance(): double // calculates and returns the end of the month balance ofthe account + withdraw(amount: double): void // withdraws a specified amount from account + deposit(amount: double): void // deposits a specified amount to account Write a test program that creates an Account object with an account ID of 1002 and a balance of $10,000, and monthly fee of $12.5. Use the withdraw method to withdraw $2,000, use the deposit method to deposit $1,500. Display the account ID and its initial balance, and the end of the month balance of the account. ***Notes When display the account ID and initial balance, don't hard-code those values in your program. Use the accessors methods, getld() and getBalance(). The withdraw(amount) method should update the balance data field of account by subtracting amount from balance. The calMonthlyBalance() method should update the balance data field of account by subtracting monthlyFee from balance and then return the updated value of balance (which is the end of the month balance). Here is a sample run: hwe_2.HW8_2> main Test.java Output - HWS_2 (run) x run: DD Initial balance of the account with ID 1002 is $10000.0 End of the month balance is $9487.5 BUILD SUCCESSFUL (total time: 0 seconds)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

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

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Expert Performance Indexing In SQL Server

Authors: Jason Strate, Grant Fritchey

2nd Edition

1484211189, 9781484211182

More Books

Students also viewed these Databases questions