Question: Question 5 (20 +5 Points) Part (1) Define a class as follow: a. create a class called Student that has four instance variables - a
Question 5 (20 +5 Points) Part (1) Define a class as follow: a. create a class called Student that has four instance variables - a (String) name, a (long) Studenti, a (String) College, and a double) GPA. b. A constructor that takes student name, StudentID, College and GPA. The constructor sets the class variables to these values. c. Make the instance variable GPA private and provide a mutator method (set) and an accessor method (get) to access this variable. In set method if the GPA negative or grater than 4.00 print an invalid message and do not change the instance variable GPA. d. A method Student_Status () that check the GPA if it is less than 2, display the warning message, otherwise display Normal student. e. A method Print() that displays the name, StudentID, College and GPA of the student as shown below: Sample output: Enter the Student name: Ali Ahmed Enter the Student ID: 20180211 Enter the College Information Technology Enter the GPA: 3.2 Normal student Name: Ali Ahmed Student ID: 2018011 College: Information Technology GPA: 3.2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
