Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. (55 pts) Create a class named AccountSavings. This class has a static double variable which stores the annual interest rate for all account holders.

1. (55 pts) Create a class named AccountSavings. This class has a static double variable which stores the annual interest rate for all account holders. The name of variable is annualInterestRate. The class also has another double variable named savingsBalance which stores balance for current account. a. Write a constructor to create an account with specified balance. Add a validation whether the balance is greater than 0.0. If it is less than 0.0 then throw an exception. b. Write a non-static calculateMonthlyInterest method to calculate the monthly interest by multiplying the savingsBalance by annualInterestRate divided by 12 the interest should be added to savingsBalance. c. Write a static method named modifyInterestRate to set the annual interest rate. Add a validation whether the rate is greater than equal to 0.0 and less than or equal 1.0. Otherwise, throw an exception. d. Write a toString method which returns savingsBalance in a string format. After that, create AccountSavingsTest class. Create two objects from the class AccountSavings with balances $2000.00 and $3000.00. Then, set the interest rate to 4%, then calculate the monthly interest rate for each 12 months for each object and print the new balances with toString method for each object. UPLOAD AccountSavings.java AND AccountSavingsTest.java.

2. (45 pts) Create a class Person which is a super class. The class includes four private String instance variables: first name, last name, social security number, and state. Write a constructor and get methods for each instance variable. Also, add a toString method to print the details of the person. After that create a class Teacher which extends the class, Person. Add a private instance variable to store number of courses. Write a constructor and a get method for the number of courses and override toString method for Teacher. Then, create PersonTest class and create an object from the class Teacher and an object from the class Person. Display the details of Teacher and Person. UPLOAD Person.java AND Teacher.java AND PersonTest.java.

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

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2017 Skopje Macedonia September 18 22 2017 Proceedings Part 3 Lnai 10536

Authors: Yasemin Altun ,Kamalika Das ,Taneli Mielikainen ,Donato Malerba ,Jerzy Stefanowski ,Jesse Read ,Marinka Zitnik ,Michelangelo Ceci ,Saso Dzeroski

1st Edition

3319712721, 978-3319712727

More Books

Students also viewed these Databases questions

Question

6. Explain how to train managers to coach employees.

Answered: 1 week ago

Question

5. Tell how job experiences can be used for skill development.

Answered: 1 week ago

Question

4. Explain the characteristics of successful mentoring programs.

Answered: 1 week ago