Create a class Student that has the following instancesvariables: String Name St
ID: 3610241 • Letter: C
Question
Create a classStudent that has the following instancesvariables:
String Name
String ID
String password
Double GPA
Three gradesGrade1, Grade2 and Grade3 (doubles) for subject 1, subject 2 andsubject 3, respectively.
And the following member methods:
- The constructorshould take the name, ID and the password as its parameters.
- Getters andsetters for all variables (Except GPA).
- FindGPA() thatcalculates and prints the GPA of the students.
Create astudent object S1 that has your data. Then,the program must ask the user to input his ID and password (UseJOptionpane). If the ID or the password is incorrect ask him againtill the correct information is entered. Finally, ask the user toenter three grades for the three subjects and print the GPA.
Use these dataas the three grades for the student
GradeSubject1
GradeSubject2
GradeSubject3
4.00
3.67
3
GPA= 3.56 ( twodigits after the decimal point)
GradeSubject1
GradeSubject2
GradeSubject3
4.00
3.67
3
Explanation / Answer
import java.lang.Math; import java.text.DecimalFormat; import javax.swing.*; public class Grade{ String Name; String ID; String password; Double GPA; public Grade(String Name, String ID, Stringpassword) { this.Name = Name; this.ID = ID; this.password = password; GPA = 0.0; } public String getID(){ return ID; } public String getPassword(){ return password; } public void FindGPA(double[] grades){ String msg = ""; for(int i = 0; iRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.