Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

(JAVA)

image text in transcribed

image text in transcribed

1. 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. /* Module 2 exercises CIS 220*/ public class Student { private int credits Earned; private int studentID; O /*write getters and setters for the two above mentioned instance variables / /*write the method findCreditsRemaining/ N /*write the method findstudentStatus/ LOGO a. 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. b. Requirements for the method find StudentStatus: This method returns the value of student's 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. Student -creditsEarned: int -studentID: String +getCreditsEarned (): int +getStudentID():String +setCreditsEarned(int):void +setStudentID(String):void +findCreditsRemaining():int +findStudent Status():String The figure above shows the UML (Universal Modeling Language) diagram of the Student class, as specified in problem 1. The UML specifies the class and this kind of specification can be used to implement the class in any programming language. The UML specifies the Class name, Attributes and Functions/Methods UML Class Diagrams ClassName vis attribute : type vis operation (arg List) : return type where vis = visibility (+ for public, - for private) attribute = data member aka field) operation = method (or constructor) Note: The arg list is a list of parameter types (e.g., int, double, String): parameter names are not included in the UML class diagram Methods that don't return a value (i.e. void methods) should give a return type of void

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

Big Data Concepts, Theories, And Applications

Authors: Shui Yu, Song Guo

1st Edition

3319277634, 9783319277639

More Books

Students also viewed these Databases questions