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 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 annualInterestRate type float, vip: nonvip: and isVip type boolean, defaultfalsecustomerName: 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 nonvip accounts, their annual interest rate should be For vip accounts, their annual interest rate should be Add the default instance variables listed above to the SavingAccount class. Add two constructors. Add a public get method for instance variables: customerName, customerId, accountId, balance, annualInterestRate, and isVip. Add a public set method for instance variables: customerName, customerId, and accountId. Add a public method named depositdouble amount to deposit the given amount of money. This amount should be added to balance. Add a public method named gainInterestsint 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. Add a public method named promoteVip to promote this account to a vip account if the current balance is greater than or equal to Problem 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 and accountNumber type int, initialcustomerName: String customerId: String savingAccounts: SavingAccountaccountNumber: int Page 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, heshe cannot open another one. Add the default instance variables listed above to the BankCustomer class. Add a constructor. Add a public get method for instance variables: customerName, customerId, savingAccounts, and accountNumber. Add a public set method for instance variables: customerName and customerId. Add a public method named openNewAccountSavingAccount 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, heshe cannot open another one. Display cannot open a new account because you already have five accounts. Problem 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 Instance variables name: the students full name, String, egJohn Doe must be specified when instantiated. id: the students id String, created based on numStudent, eg the first student objects id should be the second student objects id should be 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 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
