Question: java Q4P: Design a class named Student that contains the following private instance variables: A string data field name for the student name. An integer
Q4P: Design a class named Student that contains the following private instance variables: A string data field name for the student name. An integer data field id for the student id. A double data field GPA for the student GPA. An integer data field registeredCredits. It contains the following methods: An empty default constructor. A constructor that creates a student record with a specified id and name. The get and set methods for id, name, GPA, and registeredCredits. A method called registerCredit that adds specified amount of credits to the student. A method called withdrawCredit that withdraws specified amount of credits from the student. a. Implement the class. b. Write a test program that creates a student account using your name and id. Set all the variables information to your student information (GPA, and registered credits). Use the registerCredit method to add 9 more credits. Use the method withdrawCredit to withdraw 3 credits. Then prints out all the student information: name, id, GPA, and registerdCredits. Sample Output: Enter your GPA: 3.9 Enter your registered credits: 30 Student name: Sara Student ID: 12345678 GPA: 3.9 Registered credits: 36
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
