Question: (JAVA) 2. Write a class called StudentAccount. This class has two instance variables called accountBalance which is of the data type double, and studentAccountID of
(JAVA)


2. Write a class called StudentAccount. This class has two instance variables called accountBalance which is of the data type double, and studentAccountID of type String. In addition, there are three methods, whose requirements are given below. 1) Method called getAccountBalance, which is a getter for the instance variable accountBalance. 2) Method called addTuitionBalance that has a void return type and takes in a parameter called credits, of the type int. The parameter - credits is the number of new credits that a student enrolls in. The addTuitionBalance method updates the accountBalance by adding the value of credits* 322.0 to the existing accountBalance. Here 322.0 is the price of one credit. 3) Method called make Tuition Payment that has a void return and takes in a parameter called amount, of the type double. This method updates the accountBalance by subtracting the amount paid. StudentAccount -studentAccountID: String -account Balance: double +getAccountBalance ():double +addTuitionBalance(int):void +make Tuition Payment(double):void ** Please note that I have simplified the process of calculating the tuition here by assuming that tuition is calculated using at a per credit rate. In reality the logic is slightly more involved - the tuition balance would depend on several factors like additional fees, financial aid and discounts based on number credits per semester etc
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
