Question: Problem 1 ( 3 0 pts ) Create an inner class named SavingAccount. A saving account should include five pieces of information as instance variables:

Problem 1(30 pts) Create an inner class named SavingAccount. A saving account should include five pieces of information as instance variables: customerName (type String), customerId (type String), accountId (type String), balance (type double, initial=0.0), annualInterestRate (type float, vip:3.5%, non-vip: 3.0%), and isVip (type boolean, default=false)-customerName: String -customerId: String -accountId: String -balance: double -annualInterestRate: float -isVip: boolean Where balance represents the current balance and the initial balance should be zero for all the saving accounts, annualInterestRate represents the annual interest rate, isVip represents whether this account is a vip account or not. For non-vip accounts, their annual interest rate should be 3.0%. For vip accounts, their annual interest rate should be 3.5%.1. Add the default instance variables listed above to the SavingAccount class. 2. Add two constructors. 3. Add a public get method for instance variables: customerName, customerId, accountId, balance, annualInterestRate, and isVip. 4. Add a public set method for instance variables: customerName, customerId, and accountId. 5. Add a public method named deposit(double amount) to deposit the given amount of money. This amount should be added to balance. 6. Add a public method named gainInterests(int years) to calculate the amount of interests gained after the given years and then add interests to balance. The interests should be calculated as balance = balance + balance * annualInterestRate. 7. Add a public method named promoteVip() to promote this account to a vip account if the current balance is greater than or equal to 50,000. Problem 2(20 pts) Create an inner class named BankCustomer. A bank customer should include four pieces of information as customerId (type String), customerId (type String), savingAccounts (type SavingAccount[], an array of saving accounts from problem 2), and accountNumber (type int, initial=0)-customerName: String -customerId: String -savingAccounts: SavingAccount[]-accountNumber: int Page |1 Where savingAccounts should be an array that can hold up to five saving accounts, and accountNumber represents the number of accounts that this bank customer owns. If this bank customer has owned five saving accounts, he/she cannot open another one. 1. Add the default instance variables listed above to the BankCustomer class. 2. Add a constructor. 3. Add a public get method for instance variables: customerName, customerId, savingAccounts, and accountNumber. 4. Add a public set method for instance variables: customerName and customerId. 5. Add a public method named openNewAccount(SavingAccount acc, double amount) to open a new saving account for this customer and deposit the given amount, amount, into this saving account. If this bank customer has owned five saving accounts, he/she cannot open another one. Display cannot open a new account because you already have five accounts. Problem 3(20 pts) Create an inner public class named Student (not static). The Student class should have a static variable, numStudent, and five instance variables. a. Write the following variables: Static variable, numStudent: the number of the student objects that have been created, static, int, initial value =0. Instance variables name: the students full name, String, e.g.,John Doe, must be specified when instantiated. id: the students id, String, created based on numStudent, e.g., the first student objects id should be 1, the second student objects id should be 2. major: the students major, String, must be specified when instantiated. gpa: the student's current gpa, double, must be specified when instantiated. username: String, each student is assigned an automatically generated username by joining their first name, last name, and student id together. b. Write the constructor. c. Write a public get method for each attribute and a public set method for name and major. d. Write a public method called scholarship() that can determine if a student is qualified for a STEM scholarship. If the students gpa is greater than 3.8 and their major is either Mathematics, Cybersecurity, or Computer Science, return true. Otherwise, return false.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!