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

So this will be my final java test. The professor\'s requiremtns are below (you

ID: 3838752 • Letter: S

Question

So this will be my final java test. The professor's requiremtns are below (you can skip last three quesions):

Create a program that manages the grades for a class. The basic requirements are as follows (for a score of 15 out of 25):

1)The program shall allow the user (the teacher) to select from the following options:

a.Add students to the class

b.Set grades for any student to the class

c.Show a class report

2)For adding students, the program shall allow the user to enter the IDs of the students in the class. The maximum number of students in the class is 50

3)For setting grades, the program shall allow the user to enter a final grade for any student in the class

4)For the report, the program shall show the following:

a.Each student's ID and grade

b.The class average grade

c.The student with the highest grade

5)The program options shall be available such that the user can select any of the options at any time (i.e. add 5 students, set grades for each of them, show a report, then add 5 more students, set grades for 3, show a report, etc.)

Technical requirements:

A.You must have at least one array

B.You must have at least one class

For 5 more points (20 out of 25 total), the following additional requirements must be met:

6)Add two more options to allow the user to remove a student from the class or update an existing grade of a student

a.Remove a student asks for the student's ID. If the student is found, the student is removed from the class. Note that by removing the student, that should be properly reflected in the report option (i.e. the average and possible the student with the highest grade should be correct). If the student is not found from the given ID, show an appropriate error message to the user

b.Update an existing grade. If the student is found, ask the user for a new grade. Again, ensure the report option shows correct information based on the update. If the student is not found from the given ID, show an appropriate error message to the user

7)The class report shall also show the number of A's, B's, C's, D's and F's. The grade range is:

a.90+: A

b.80-89: B

c.70-79: C

d.60-69: D

e.Less than 60: F

For the final 5 points (all 25 points total), the following additional requirements must be met:

8)Add a sixth option to allow the user to enter how many assignments are in the class along with each assignment's attributes. These attributes are:

a.Assignment type (Homework or Test)

b.Weight (the percentage of the total grade the assignment has)

9)When the user enters the assignments, the total weight of all assignments must equal 100 or the assignments are not allowed (for example, 2 homework assignments each weighing 30 percent and 1 test weighing 40)

10)Modify the 2nd option for setting the grades to setting the grade of a student for a specific assignment

11)Add to the report to show the same reporting features for the final grades for each assignment (for example, show the average, the high and the number of A's to F's for the final grade, all homeworks and all tests)

Due date notes:

1)Demo of final program is on the last day of class. There will be no lecture on that day.

2)You may work in groups of 2, but you must be prepared to individually demo your part of the work and code (for example, if one person worked on requirements 1-5, they must be able to show the program meeting those requirements and how that code works). Individuals must be prepared to answer questions on their own on the code

Extra credit opportunities:

There are many ways to get extra credit on this assignment. However, all 25 points from requirements 1-11 and technical requirements A and B must first be met. After that, you can look into one, and only one of the following:

1)Implement a graphical user interfaces to put a more sophisticated front end (+5 points)

2)Research how to do file output so you can allow the user to save and load their data (+5 points) or

3)Research how to connect to an SQL database so you can allow the user to save and load their data using a database connection (+5 points)

Good luck and have fun with it!!

Explanation / Answer

I have done till 7th part :

import java.io.*;
import java.math.MathContext;
import java.util.*;

class StudInfo {

public static Scanner d = new Scanner (System.in);
public static String matricNo[] = new String[100];
public static String name[] = new String[100];
public static int courseWorkMark []= new int[100];
public static int finalExamMark[] = new int [100];
public static int grade[] = new int[100];
public static double mark1;
public static double mark2;
public static int x = 1;
public static int y = 1;
public static String sgrade;
public static int scourseWorkMark;
public static int sfinalExamMark;

//MENU
public static void main(String[] args)throws IOException {
menu();

}

public static void menu()throws IOException {

System.out.println("<<<-- MAIN MENU -->>>");
System.out.println("");
System.out.println("[1] AddStudentID [2] AddGrade [3] Show Class Report [4] Delete [5] Update Grade [6]Show Grades Values [7]Exit");

System.out.println("");
System.out.print("Select a menu: ");
int m = Integer.parseInt(d.nextLine());

switch(m) {

case 1: //ADD DATA
addData();
break;
case 2: //ADD GRADE
addGrade();
break;
case 3: //VIEW DATA
viewData();
break;
case 4: //DELETE DATA
DeleteData();
break;
case 5:
editData();
case 6:
Calculate();
case 7:
break;
default:
break;
}
}

//DELETE
public static void DeleteData()throws IOException {

boolean result = false;
int index = 0;

spacing();
System.out.print("<<<-- DELETE RECORDS -->>> ");
System.out.print("Search Student ID Number: ");
String smatricNo = d.nextLine();

for(int i=1;i<matricNo.length;i++) {
if(matricNo[i] !=null) {

if(smatricNo.equalsIgnoreCase(matricNo[i])) {   
result = true;
index = i;
}
}   
}

if(result == true) {

System.out.print("Student ID : "+matricNo[index].toUpperCase()+ " ");
System.out.print("Grade: "+grade[index]);
System.out.println("");

System.out.print("Are you sure to save this record?[y]-y/[n]-no: ");
String Ques = d.nextLine();

if(Ques.equalsIgnoreCase("y")) {

matricNo[index] = null;
grade[index] = 0;


for(int j=index+1;j<matricNo.length;j++)
{   
matricNo[j-1] = matricNo[j];
grade[j-1] = grade[j];
}   

System.out.println("Record succesfully deleted!");
viewData();
spacing();
menu();

} else{
spacing();
menu();
}

} else{

System.out.print("Matric Number not found!");
System.out.println(" <Press Enter>");
String Ques = d.nextLine();
spacing();
menu();
}
}


public static boolean SearchStudent(String smatricNo)throws IOException {
boolean result = false;
int index=0;


for(int i=1;i<matricNo.length;i++) {
if(matricNo[i] !=null) {

if(smatricNo.equalsIgnoreCase(matricNo[i])) {   
result = true;
index = i;
}
}   
}

return result;

}

//ADD STUDENT ID
public static void addData()throws IOException {

spacing();
System.out.print("<<<-- ADD STUDENT ID -->>> ");
System.out.print("Student Id Number: ");
String smatricNo = d.nextLine();
matricNo[x] = smatricNo;
x++;

menu();
}
  
//ADD STUDENT GRADE
public static void addGrade()throws IOException {

spacing();
System.out.print("<<<-- ENTER THE STUDENT ID FOR WHICH YOU WANT TO ENTER THE GRADE -->>> ");
String smatricNo = d.nextLine();
boolean flag = SearchStudent(smatricNo);

if(flag == false){
System.out.print("ID Number not found!");
System.out.println(" <Press Enter>");
spacing();
menu();
}
else
System.out.print("<<<-- ADD STUDENT GRADE -->>> ");
System.out.print("Student Grade : ");
int sgrade = Integer.parseInt(d.nextLine());
grade[y] = sgrade;
y++;

menu();
}

public static void spacing() {
System.out.print(" ");
}

//VIEW
public static void viewData()throws IOException {
boolean center = false;

spacing();
double averageGrade = CalculateAverageGrade();
String sId = HighestGrade();
System.out.print("<<<-- CLASS REPORT -->>> ");

for(int i=1;i<matricNo.length;i++) {

if(matricNo[i] != null) {

System.out.print("Student ID Number: " + matricNo[i].toUpperCase()+ " ");
System.out.print("Grade: " + grade[i]);   
System.out.println("");
center=true;
}
}
spacing();

if(center == true) {
System.out.print("Average grade of the class is : " + averageGrade);
spacing();
System.out.print("The student ID with the highest grade : " + sId + " ");
spacing();
}
  
if(center == false) {

System.out.print(" EMPTY DATABASE. NO RECORDS FOUND!");

}

spacing();
menu();

}

public static double CalculateAverageGrade()throws IOException {
double average;
double sum = 0.0;
int counter = 0;

for(int i=1;i<grade.length;i++) {

if(matricNo[i] != null) {
sum += grade[i];
counter++;
}
}
  
average = sum/counter;
return average;
}

public static String HighestGrade()throws IOException {
int MIN = 0;
String id = "";

for(int i=1;i<matricNo.length;i++) {
if(grade[i] > MIN){
MIN = grade[i];
id = matricNo[i];
}
}
  
return id;
}

//EDIT
public static void editData()throws IOException {
boolean result = false;
int index=0;

spacing();
System.out.print("<<<-- EDIT DATA -->>> ");
System.out.print("Search Student ID Number: ");
String smatricNo = d.nextLine();

for(int i=1;i<matricNo.length;i++) {
if(matricNo[i] !=null) {

if(smatricNo.equalsIgnoreCase(matricNo[i])) {   
result = true;
index = i;
}
}   
}

if(result == true) {

System.out.print(matricNo[index] + " " +grade[index]+ " ");   

System.out.print("Enter new grade : ");
int sgrade = Integer.parseInt(d.nextLine());


System.out.print("Are you sure to update this record?[y]-y/[n]-no: ");
String Ques = d.nextLine();

if(Ques.equalsIgnoreCase("y")) {

matricNo[index] = smatricNo;
grade[index] = sgrade;
spacing();
menu();
}

else if(Ques.equalsIgnoreCase("n"))
{
spacing();
menu();

}

}else {

System.out.print("Student ID Number not found!");
spacing();
menu();
}

}

//CALCULATION PART
public static void Calculate() throws IOException
{
int numA = 0;
int numB = 0;
int numC = 0;
int numD = 0;
int numF = 0;

for(int i=1;i<matricNo.length;i++) {
if(matricNo[i] !=null) {
if(grade[i] >= 90)
numA++;

else if(grade[i] >= 80 && grade[i] <=89)
numB++;

else if(grade[i] >= 70 && grade[i] <= 79)
numC++;

else if(grade[i] >= 60 && grade[i] <= 69)
numD++;

else if(grade[i] < 60)
numF++;
}
}

System.out.println("Number of students with A grade :" + numA);
System.out.println("Number of students with B grade :" + numB);
System.out.println("Number of students with C grade :" + numC);
System.out.println("Number of students with D grade :" + numD);
System.out.println("Number of students with F grade :" + numF);

spacing();
menu();
  
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote