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

Develop a Console Application related to a Grading application. 1. Add a Student

ID: 3669125 • Letter: D

Question

Develop a Console Application related to a Grading application.

1. Add a Student class to your project as shown in class.
2. Add the following private attributes to the Student class.

studentId which is an integer

studentName which is a string

examScore which is a double

projectScore which is a double

Provide the following 2 constructors for the Student class:
The first constructor takes no parameters and initializes the attributes studentId, studentName, examScore, and projectScore to -100 and “n/a”, 0.0, and 0.0, respectively.
The second constructor take the name and the id of the student as parameter and initialize the studentName and studentId attributes to them respectively.

Provide the following public methods for the Student class:
-computeTotalScore()
that computes and returns the totalScore the student has earned in the course according to the following formula:
Total score = (examScore*60/100) + (projectScore*40/150)

-computeGrade() that computes and returns the grade the student has earned in the course according to the following rules:

Total Score Grade >= 90 A

[80, 90) B

<80 C


-toString() that takes no parameters and returns a string containing the student’s id, name, exam score, project score, the grade (as determined above), and total score (as computed above) in the format that is same as the format of each student information line in the table shown in the sample output. Use String.Format() to format the string.

Provide get/set methods to read/write the examScore and projectScore attributes of the Student class.

The set method for examScore should not allow to set the examScore to a value less than 0 or a value strictly greater than 100.

The set method for projectScore should not allow to set the projectScore to a value less than 0 or a value strictly greater than 150.

Do the following in the main() method :

Instantiates 3 students, named “Fred”, “Bob”, and “Jill” with ids 1001, 1002 and 1003 respectively.

Set the examScore and projectScore for Fred to 95.5 and 140.5 respectively.

Set the examScore and projectScore for Bob to 85.0 and 135.5 respectively.

Set the examScore and projectScore for Jill to 75.5 and 120.0 respectively.

Display the table with student information as shown in the sample output. Compute and display the  average and maximum of the total scores of students as shown in the sample output.

SAMPLE OUT PUT

Id Name Exam Project Total Grade

1001 Fred 95.5 140.5 94.8 A

1002 Bob 85.0 135.5 87.1 B

1003 Jill 75.5 120.0 77.3 C

Average Total Score = 86.4

Maximum Total Score = 94.8




Explanation / Answer

This below java code is implemented based on the given all requirements in probelm statement..

Implemented all methods given in problem statement

Created two constructors one is default and another one is parameterised

Created three student objects and calculated total score and average..

See the below code:

class student
{
   private int id;
   private String name;
   private double examScore;
   private double projectScore;
  
   student()
   {
       id = -400;
       name = "n/a";
       examScore = 0.0;
       projectScore = 0.0;
   }
  
   student(int id, String name)
   {
       this.id = id;
       this.name = name;
   }
  
   public double ComputeTotalScore()
   {
       double totalScore = examScore * 0.6 + projectScore * (40/150);
       return totalScore;
   }
  
   public char computeGrade(double score)
   {
       if(score >= 90)
           return A;
       else if (score >=80 && score <90)
           return B;
       else
           return C;
   }
  
   public String toString()
   {
       return id+ " " + name +" " + examScore + " " + projectScore + " " + computeGrade();
   }
  
   public void setexamScore(double exam)
   {
       if(exam > 0 && exam <100)
           examScore = exam;
   }
  
   public double getexamScore()
   {
       return examScore;
   }
  
   public void setProojectScore(double poject)
   {
       if(project >0 && poject <150)
           projectScore = poject;
   }
  
   public double getProjectScore()
   {
       return projectScore;
   }
}

public class TestScore
{
   public static void main(String[] args)
   {
       student obj1("Fred",1001), obj2("Bob",1002), obj3("Jill",1003);
       obj1.setexamScore(95.5);
       obj1.setProojectScore(140.5);
      
       obj2.setexamScore(85.0);
       obj2.setProojectScore(135.5);
      
       obj3.setexamScore(75.5);
       obj3.setProojectScore(120.0);
      
       System.out.println("Id Name Exam Project Total Grade");
       System.out.println(obj1);
       System.out.println(obj2);
       System.out.println(obj3);
      
       double avg = (obj1.ComputeTotalScore()+ obj2.ComputeTotalScore()+ obj3.ComputeTotalScore())/3
       double total = obj1.ComputeTotalScore() + obj2.ComputeTotalScore() + obj3.ComputeTotalScore();
      
       System.out.println("Average Total Score is :"+avg);
       System.out.println("Maximum Total Score is :"+total);
   }
}