Write a CGPA class that has a constructor for initializing four variables: name, matric number, level, and course of study, The program should have two other overloaded methods, one for collecting the credit unit of each course and the other for collecting points based on the grades of each student in each of the courses. Write a third method for calculating the CGPA of a number of students and return the names, matric numbers, levels, course of study, and their current CGPA, well-arranged (using format specifier if necessary). Execute the program using 5 records. Turn in the codes and a snapshot of the result on google classroom.
import java.util.Scanner;
public class CGPA {
private String name;
private int M_num;
private int level;
private String course;
static Scanner input = new Scanner(System.in);
CGPA(int M,String C,String N,int L){
name = N;
M_num = M;
level = L;
course = C;
}
void getRedit(){
System.out.println("Enter credit\n");
int cred = input.nextInt();
}
void getpoints(){
System.out.println("Enter points\n");
int points = input.nextInt();
}
String displayCGPA(){
return name +" "+M_num+" "+level+" "+course;
}
public static void main(String[] args) {
}
}
Comments
Leave a comment