Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a Java Program Code that is converted from the given Pseudocode and Data

ID: 3686993 • Letter: C

Question

Create a Java Program Code that is converted from the given Pseudocode and Data table in order to produce the desired outcomes inquired from the given scenario. The program should be exicuted and produce similar results like the example below.

(EXAMPLE.)

$ script nJCodelog
$ javac NewJavaCode.java
$ ls -l
total 44
-rw-r-----+ 1 (user name) 367 Apr 1 13:44 NewJavaCode.class
-rw-r-----+ 1 (user name) 3795 Apr 1 13:45 NewJavaCode.java
-rw-r-----+ 1 (user name) 3477 Apr 1 13:49 NJCode.class
-rw-r-----+ 1 (user name) 0 Apr 1 13:55 nJCodelog
$ pwd
/user3/(..)/(user name)/cis2110/hw9


$ java NewJavaCode
*********************
Please enter the semester term: Fall 2014
Enter the student ID code: 111
Enter the student's GPA: 2.00
Enter the number of hours completed by the student: 80
********** Student Details **********
Student
Code     GPA     Hours
111      2.0    80
*************************************
Enter the student ID code: 222
Enter the student's GPA: 2.85
Enter the number of hours completed by the student: 100
********** Student Details **********
Student
Code     GPA     Hours
222      2.85    100
*************************************

AND SO ON UNTIL THE END...............


Enter the faculty number: -1

********* Semester Summary *********
SEMESTER: Fall 2014

Total number of students: 7
Total number of student hours: 618
Average number of student hours: 88.28571


Highest GPA: 3.55
ID of student with high GPA: 333
************************************

( END OF EXAMPLE)

[Here is the scenario:

[Here is the Data for the inputs given for the scenario

(AND HERE IT IS IN WRITTEN FORM)

MTH Data Table

-1

]

Lastly Here is the pseudocode:

Explanation / Answer

import java.util.*;
class Student
{
Scanner read=new Scanner(System.in);
int hours,stuID;
static double hiGpa,average;
double gpa;
static String term;
static int hiGpaStuId,totStus=0,totStuHours=0;
public void InitializeReport()
{
totStus = 0;
totStuHours = 0;
hiGpa = 0.0;
stuID = 0;
}
public void getTerm()
{
System.out.print("Please enter the semester term: ");
term=read.nextLine();
}
public int GetStuId()
{
System.out.print("Enter id of student: ");
return read.nextInt();
}
public void ProcStudent()
{
stuID=GetStuId();
if(stuID!=-1)
{
GetStuDetails();
CalcTotals();
UpdateHigh();
}
}

public void GetStuDetails()
{
System.out.print("Enter GPA of student: ");
gpa=read.nextDouble();
System.out.print("Enter hours spent by student: ");
hours=read.nextInt();
}
public void CalcTotals()
{
totStus = totStus + 1;
totStuHours = totStuHours + hours;
}

public void UpdateHigh()
{
if (hiGpa < gpa)
{
hiGpa = gpa;
hiGpaStuId = stuID;
}
}

public void DisplayDetails()
{
    if(stuID!=-1)
    {
System.out.println(" ****************Student Details *******************");
System.out.println("Student");
System.out.println("Code GPA Hours");
System.out.println(stuID+" "+gpa+" "+hours);
System.out.println(" ");
}
}

public void CalcAvg()
{

average = totStuHours / totStus;
}

public void DisplaySummary()
{
CalcAvg();
System.out.println("Semester: "+term);
System.out.println(" Total number of students: "+totStus);
System.out.println("Total number of student hours : "+totStuHours);
System.out.println("Average number of student hours: "+average);
System.out.println(" Highest GPA: "+hiGpa);
System.out.println("ID of the student with high GPA : "+hiGpaStuId);
}
}
public class HelloWorld
{
public static void main(String args[])
{
int flag=1,i=0;;
Student studentsList[]=new Student[10];
while(flag==1)
{
    Student test=new Student();
    if(i==0)
    {
    test.getTerm();
  
    }
test.ProcStudent();
if(test.stuID!=-1)
studentsList[i]=test;
else
flag=0;
i++;
test.DisplayDetails();
}
System.out.println(" ********Semester Summary***********");
studentsList[i-2].DisplaySummary();
}
}