Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

Complete the code for the class Student by writing the required methods. The instance variables are as given in the incomplete code shown below. The

Complete the code for the class Student by writing the required methods. The instance variables are as given in the incomplete code shown below. The requirements are stated under the code below.

Requirements for the method findCreditsRemaining : This method returns the number of credits remaining for the student .Use maximum number of credits required as 120. This method uses the instance variable, creditsEarned to find creditsRemaining = 120-creditsEarned. The method returns the value of creditsRemaining. Please make sure the method definition has proper return type. This method has no parameter.

Requirements for the method findStudentStatus: This method returns the value of students status as one of the following values: freshman, sophomore, junior , or senior. The logic to determine the student status is as follows: If the students earns more than 90 credits, the status is senior, else if the student earns more than 60 , but less than 90 the status is junior, else if the student earns 30 or more but less than 60, the status is sophomore, else for credits less than 30 the status is freshman. You may declare a return variable called status, update this variable using the logic written above and return the value of this variable.

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 makeTuitionPayment 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.

  1. Create a class called Student that represent some basic enrollment information about the student. The instance variables are studentID , creditsEarned and gpa, which are String, integer and double, respectively .( you may either create a new class, or add extra features to the class that you have in problem 1).

Define constructors in the Student class that can do the following in any client class:

  • Create a new Student object using the default constructor. Pick any default values of your choice, for the default constructors instance variables.
  • Create a new Student object using overloaded constructor that takes in three arguments that provide values for the three instance variables.
  • Create a new Student object using a 2 argument constructor .The two arguments will provide values for studentID and creditsEarned instance variables.

  1. Continuing along problem 3), create a client class called TestStudent in which you will write statements that will create 3 objects using each of the constructors specified in the Student class. You may call the objects student1, student2 and student3. You may choose any appropriate argument values for the overloaded constructors.

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

Oracle Solaris 11.2 System Administration (oracle Press)

Authors: Harry Foxwell

1st Edition

007184421X, 9780071844215

More Books

Students explore these related Databases questions

Question

6. What data will she need?

Answered: 3 weeks ago