Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Java Problem 1 (6 pts) he Suppose that you have a class named BankAccount that represents (surprise!) a bank account. T BankAccount class has

In Java image text in transcribed
Problem 1 (6 pts) he Suppose that you have a class named BankAccount that represents (surprise!) a bank account. T BankAccount class has two instance variables: . private double balance prtbate double annualInterestRate The BankAccount class also has the following methods. (Note that no code has been provided for the method thod headers.) bodies, but you should be able to determine what the methods do from the descriptions and me public BankAccount(double b, double ir) A constructor that sets the instance variables to the passed-in values. public double checkBalance0 Returns the current balance of this BankAccount object. public double deposit (double amt) Updates the balance by depositing amt into the account. Returns the new balance. e public double withdraw(double amt) Updates the balance by withdrawing amt from the account. Returns the new balance. public double payInterest0 Updates the balance by making a single annual interest payment based on the current balance. Returns the new balance. n paper or in document, write the code required for the following actions (1 pt each). You do NOT ave to write any code for the BankAccount class. Assume that it already exists as described above. a separate 1. Declare and instantiate a BankAccount object named acct1, with an initial balance of $0 and an annual interest rate of 0.5%. 2. Declare and instantiate a BankAccount object named acct2, with an initial balance of $500 and an annual interest rate of 1.1% 3. Display the current balances of both accti and acct2 on the screen. 4. Deposit $120 to acct1 and display the new balance on the screen. 5. Withdraw $80 from acct2 and display the new balance on the screen. 6. Make an annual interest payment to both acctl and acct2, and display the new balances of each on the screen

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

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

Example. Evaluate 5n+7 lim 7-00 3n-5

Answered: 1 week ago

Question

3. What information do participants need?

Answered: 1 week ago