Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(FOLLOW EXAMPLE THAT IS GIVEN) please do not use geeksforgeeks) Subject is advance java. Please be sure to include everything in the instructions Name: Date:

(FOLLOW EXAMPLE THAT IS GIVEN) please do not use geeksforgeeks) Subject is advance java. Please be sure to include everything in the instructions
image text in transcribed
image text in transcribed
image text in transcribed
Name: Date: Assignment 1 Instructions: Submit an electronic copy of the assignment (.java) to the Dropbox (ex. ClassName.java, etc.) IMPORTANT: FOLLOW GOOD PROGRAMMING STYLE/CONVENTION FOR NAMING ALL YOUR OBJECTS/VARIABLES. ADD COMMENTS ON TOP OF EACH METHOD AND AT TOP OF THE FILE (SEE EXAMPLE AT THE LAST PAGE) Programming Exercise: (Savings Account Class) Create class SavingsAccount. Use a static variable annualInterestRate to store the annual interest rate for all account holders. Each object of the class contains a private instance variable savingsBalance indicating the amount the saver currently has on deposit. Provide method calculate MonthlyInterest to calculate the monthly interest by multiplying the savingsBalance by annualInterestRate divided by 12this interest should be added to savings- Balance. Provide a static method modifyInterestRate that sets the annualInterestRate to a new value. Write a program to test class Savings Account. Instantiate two savings Account objects, saverl and saver2, with balances of $2000.00 and $3000.00, respectively. Set annualInterestRate to 4%, then calculate the monthly interest for each of 12 months and print the new balances for both savers. Next, set the annualInterestRate to 5%, calculate the next month's interest and print the new balances for both savers. //Filename: BankAccount.java public class BankAccount private int acct Number; private double balance; private String firstName; private String lastName; //constructor with given value public BankAccount(int acctNumber, String firstName, String lastName, double balance) { this.acct Number - acetNumber; this.balance = balance; this.firstName = firstName; this.lastName - lastName; //get the first name public String getFirstName() { return firstName; //get the last nane public String getLastName() { return lastName; //get the account number public int getAcct Number() { //return account Number: return acct Number; 1/deposit amount into account public void deposit(double anount) { //double newBalance = balance - amount; //balance = newbalance balance += amount; ) i/withdraw honey public void withdraw(double amount) { double newBalance = balance - amount; | balance = new Balance; //get balance public double getBalance() { return balance; 1/display info public void displayAccount() { System.out.printf("Account# : xdxn", getAcctNumber()); System.out.printf("First Name: %s ", getFirstName()); System.out.printf("Last Name : *s*n", getLastName()); System.out.printf("Balance %.2f%n", getBalance()); ) > 1/filename: Accountlest.java public class Account Test { public static void main(String[] args) { BankAccount savings = new BankAccount (1001, "Robert", Smith", 1800, 0.8); BankAccount checking new BankAccount(1882, "Antonio", "Stewart, see) System.out.println("----Savings Account -----"); savings.displayAccount(); System.out.println(); System.out.println("Checking's Account..."); checking.displayAccount(); savings.deposit(1000); savings.Withdraw(100); System.out.println(); System.out.println("-...-Savings Account -----); savings.displayAccount(); System.out.println(); System.out.println("-... Checking's Account -----"); checking.displayAccount(); //adding money into checking account checking.withdraw(100); checking.withdraw(100); checking withdraw(100); checking.deposit(500); //adding interest into savings account and deducting fees System.out.println("----- Saving's Account ----"); savings.displayAccount(); System.out.println(); System.out.println("Checking's Account -..."); checking.displayAccount(); )

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

Databases Illuminated

Authors: Catherine M Ricardo, Susan D Urban

3rd Edition

1284056945, 9781284056945

More Books

Students also viewed these Databases questions

Question

To solve p + 3q = 5z + tan( y - 3x)

Answered: 1 week ago

Question

Why do HCMSs exist? Do they change over time?

Answered: 1 week ago