Problem Design a simple GPA and CGPA interactive system. Your program will read
ID: 3870602 • Letter: P
Question
Problem Design a simple GPA and CGPA interactive system. Your program will read input data from keyboard and display reports on the screen. You will read each student records in Computer and Information Sciences major and current information for each student. Each record consists of a student id number (string), last name (string), first name (string), middle initial (character), phone number (string), sex (character), class level (2- character string), total credits earned till Fall 2016 (integer), and its cumulative GPA (floating number). And Spring 2017 information are followed. Each enrollment input data is the number of registered courses in Spring 2017 (If the student didn't registered in Spring 2017, the number of registered courses is a value 0) and a list of course records. Each course consists of a course name(string), the number of course credits (integer) and its letter grade (character) interactively. Your program will include the following tasks and print the corresponding output on the screen interactively. Write a program that reads the information for each student from the keyboard, calculates its semester GPA, implements updating cumulative GPA, and produces an updated grade report Display the reports on the screen. The reports have the detail information with updated cumulative GPA and credits for all the students. (If the student registered Spring 2017, then display the detail information including all the courses with their grades. If not, display the summarized report. 2. The output format on the screen should look like the following: Example Output format for task 2: (NOTE: If the student didn't take any course in Spring 2017 semester, just generate first 6 Name: JOHNSON, JAME L Tel.: 4107632134 Gender: Male Class Level: Freshmarn Registration of Spring 2017: Yes Unofficial Report Card GRADE CREDITS COURSE CoSc237Explanation / Answer
JAVA PROGRAM
import java.util.Scanner;
public class GPAInteractionSystem {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scanner=new Scanner(System.in);
String studentID,lastName,firstName,middleInitial,sex,classLevel,reg,fullName,phoneNumber;
int totalCredits,regCourse;
String[] courseName,grade;
int[] credits;
System.out.println("Enter Student ID");
studentID=scanner.nextLine();
System.out.println("Enter Last Name");
lastName=scanner.nextLine();
System.out.println("Enter First Name");
firstName=scanner.nextLine();
System.out.println("Enter Middle Initial Character");
middleInitial=scanner.nextLine();
System.out.println("Enter Phone Number");
phoneNumber=scanner.nextLine();
System.out.println("Enter Gender (M (Male)/ F (Female)");
sex=scanner.nextLine();
if(sex.charAt(0)=='M' || sex.charAt(0) == 'm')
sex="Male";
else
sex="Female";
System.out.println("Enter Class Level");
classLevel=scanner.nextLine();
System.out.println("Enter Total Credits earned till Fall 2016");
totalCredits=scanner.nextInt();
fullName=lastName+", "+firstName+middleInitial;
System.out.println(" Registered for Spring 2017 (YES / NO)");
reg=scanner.next();
System.out.print("Student ID number : "+studentID+" ");
System.out.print("Name : "+fullName+" ");
System.out.print("Tel. : "+phoneNumber+" ");
System.out.print("Gender : "+sex+" ");
System.out.print("Class Level : "+classLevel+" ");
System.out.print("Registered for Spring 2017 : "+reg+" ");
if(reg.charAt(0)=='Y' || reg.charAt(0)=='y' )
{
System.out.println("Enter number of Registered Courses");
regCourse=scanner.nextInt();
courseName = new String[regCourse];
credits = new int[regCourse];
grade = new String[regCourse];
for(int i=0;i<regCourse;i++)
{
System.out.println("Enter Course Name : ");
courseName[i]=scanner.next();
System.out.println("Enter Number of Credits");
credits[i]=scanner.nextInt();
if(credits[i]>=4)
grade[i]="A";
else if(credits[i]==3)
grade[i]="B";
else if(credits[i]==2)
grade[i]="C";
else
grade[i]="D";
}
for(int i=0;i<regCourse;i++)
{
System.out.print("COURSE CREDITS GRADE ");
System.out.print("====== ======= ===== ");
System.out.print(courseName[i]+" "+credits[i]+ " " + grade[i]+" ");
}
}
}
}
OUTPUT
Enter Student ID
111111111
Enter Last Name
JOHNSON
Enter First Name
JAME
Enter Middle Initial Character
L
Enter Phone Number
4107632134
Enter Gender (M (Male)/ F (Female)
M
Enter Class Level
Freshman
Enter Total Credits earned till Fall 2016
20
Registered for Spring 2017 (YES / NO)
YES
Student ID number : 111111111
Name : JOHNSON, JAMEL
Tel. : 4107632134
Gender : Male
Class Level : Freshman
Registered for Spring 2017 : YES
Enter number of Registered Courses
1
Enter Course Name :
COSC237
Enter Number of Credits
3
COURSE CREDITS GRADE
====== ======= =====
COSC237 3 B
THANK YOU!
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.