Question

In: Computer Science

Scenario The instructors at the community college are happy with your grade averaging program and want...

Scenario

The instructors at the community college are happy with your grade averaging program and want to

expand it. You have been asked by the community college to modify the existing program to include

additional functionality that will calculate a student’s final grade for the faculty for multiple students.

The new program will accept data from the instructors, calculate the final grade and display information

on the screen. The program will output student information, the student category averages, the final

numeric grade and a statement that indicates if the student is passing.

Part I

1. Code the program using Java. The program should incorporate greetings to the instructor as well as

an ending message.

2. The program should include two classes: Grades.java and GradeCalculator.java.

3. The GradeCalculator.java class should include the main method and instantiate two objects

representative of two different sets of student grades. It should get input from the user and call

mutator and accessor methods to set and get object values.

4. The Grades.java class should include a constructor which will

a. initialize the Lab, Test and Project averages to a value of zero (0) and the final exm grade

to a value of zero (0) for each student grade object

b. keeps a running count of the number of students entered.

c. Records the system date the grades were entered for each student (Hint: use LocalDate class).

5. The program should greet the user by calling a method named displayGreeting();

6. The program should request the following information from the user:

Input Data (for each student):

  • Student First Name (on a separate line from last name)
  • Student Last Name(on a separate line from first name)
  • Student ID
  • Lab Average
  • Project Average
  • Test Average
  • Final exm grade

7. The program should output the following information to the instructor by calling a method named

displayGrades() for each student:

Instructor receives the following output for each set of grades (one set for each student):

  • Student’s first and last name concatenated on one line (i.e. John Smith)
  • Student ID on a separate line
  • List the average for each type of grade category (make sure the output is professional and is aligned appropriately and displays decimal points).

Example: (these are example values and should be output for both students)

Test Avg: 93.5

Lab Avg: 100

Project Avg: 93

Final Exm: 95

Course Grade: xx (weighted average calculated by the program)

  • The numeric course grade is calculated based on a weighted average:

Labs = 30%

Tests = 30%

Projects = 30%

Final Exm = 10%

Final Grade = 30% x lab average + 30% x test average + 30% x project

average + 10% x final exm

  • A message indicating whether the student is passing (true or false) – DO NOT use an IF

statement. Use the Boolean variable in a logical expression and print the result. Assume a 10

point scale when determining the passing rate.

  • Thank the instructor for accessing the program at the end of the program

8. Name the java class files Grades.java and GradeCalculator.java.

a. The GradeCalculator should include the main( ) method which instantiates objects, calls

methods to enter grades, get and set grades entered and displays information to the

instructor for each student.

b. The Grades class should include a constructor and methods to set and get values.

c. The calculations can be included in either the Grades or the GradeCalculator class. This can

be your decision.

Solutions

Expert Solution

We will create 2 classes namely

1. GradeCalculator (for calculating grades)

2. Grades (manage data of each student, set and get the grades)

We have created the class LocalData for storing the data of each student.

Now let us create a class Grade for which will set and get the grades of each student.

class Grade
{
        String firstName;
        String lastName;
        int id;
        double labAvg=0;
        double projectAvg=0;
        double testAvg=0;
        double finalExam=0;
        double finalGrade=0;
        public Grade()
        {       
        }
        public Grade(String firstName,String lastName,int id,double labAvg,double projectAvg,double testAvg,double finalExam)
        {
                this.firstName=firstName;
                this.lastName=lastName;
                this.id=id;
                this.labAvg=labAvg;
                this.projectAvg=projectAvg;
                this.testAvg=testAvg;
                this.finalExam=finalExam;
                finalGrade=((30*labAvg)/100) + ((30*testAvg)/100) + ((30*projectAvg)/100) + ((10*finalExam)/100);
        }
        public void displayGrades()
        {
                System.out.println("Name: "+firstName+" "+lastName);
                System.out.println("Student ID: "+id);
                System.out.println("Test Average: "+testAvg);
                System.out.println("Lab Average: "+labAvg);
                System.out.println("Project Average: "+projectAvg);
                System.out.println("Final Exam: "+finalExam);
                System.out.println("Final Grade: "+finalGrade);
                System.out.println("-----------------------------");
        }
                
}

Now we will create another class that is GradeCalculator which will be having the main function and will process the grade of students

import java.util.Scanner;
class GradeCalculator
{
        public static void main(String args[])
        {
                Scanner sc=new Scanner(System.in);
                System.out.println("Enter Total number of students: ");
                int total=sc.nextInt();
                int i=0;
                Grade[] arr=new Grade[total]; 
                while(total>0)
                {
                        String firstName=sc.next();
                        String lastName=sc.next();
                        int id=sc.nextInt();
                        double labAvg=sc.nextDouble();
                        double projectAvg=sc.nextDouble();
                        double testAvg=sc.nextDouble();
                        double finalExam=sc.nextDouble();
                        arr[i] =new Grade(firstName,lastName,id,labAvg,projectAvg,testAvg,finalExam);
                        i++;    
                        total--;
                }
                for(int i=0;i<total;i++)
                {
                        arr[i].displayGrades();
                }
        }
}
​

Related Solutions

You are taking a college course where your overall average grade is calculated by averaging three...
You are taking a college course where your overall average grade is calculated by averaging three exxam (weighted 20% each), the average of four quizzes (weighted a total of 15%), and a comprehensive final (weighted 25%). Your scores were: 100% on Quiz 1, 80% on Quiz 2, 90% on Quiz 3, 100% on Quiz 4, 90% on Exxam 1, 90% on Exxam 2, 85% on Exxam 3. You have not yet taken the Finall Exxam and don’t have any time...
1/ Can Foothill College (a publicly funded community college) discriminate in the hiring of its instructors...
1/ Can Foothill College (a publicly funded community college) discriminate in the hiring of its instructors based upon religion? Can Santa Clara University (a private, Catholic-affiliated university in Santa Clara, CA) do so? More generally, if an employer is sued for discrimination, what defenses against an allegation of discrimination does the employer have? ( the discussion about bona fide occupational qualifications) 2/ How might employers be proactive in avoiding employment discrimination claims? For instance, when Silicon Valley law firms lay...
Scenario- program to increase marketing majors at university by increasing the number of community college dual...
Scenario- program to increase marketing majors at university by increasing the number of community college dual enrollment students implementation and evaluation- briefly explain what steps, resources would you as a college would imply for success of dual enrollment. How would you determine your success or failure in a timetable manner?
Python 3.7.4 (Introductory Level) You want to know your grade in Computer Science: Write a program...
Python 3.7.4 (Introductory Level) You want to know your grade in Computer Science: Write a program that continuously takes grades between 0 and 100 to standard input until you input "stop", at which point it should print your average to standard output.
Program this scenario in C. Scenario: I am in highschool and i want to go see...
Program this scenario in C. Scenario: I am in highschool and i want to go see a movie. I have a certain amount of money to spend. Matinees are $8.50 and Evening Showings are $11.75. There is a G, PG, PG-13, and R movie at the theater. Ask the highschooler their age and how much money they have. With this info determine what showtime they can go see and what movies they are not allowed to see. Make it fun...
Select one of your best solutions to the Community Care scenario in the Allied Health Community...
Select one of your best solutions to the Community Care scenario in the Allied Health Community and include why you feel this is the best approach. http://lc.gcumedia.com/hlt307v/allied-health-community/allied-health-community-v1.1.html
You want to find out the percentage of community college students that own a pet. You...
You want to find out the percentage of community college students that own a pet. You decide to email five students in one of your classes and ask them if they own any pets. (a) What is the population in this example? (b) What is the sample? (c) What is the parameter of interest? (d) Suppose three of the five students tell you they own a pet, while the other two say they do not. i. Is this numerical or...
If the president of your college called you in and asked how a community college  could create...
If the president of your college called you in and asked how a community college  could create a competitive advantage for itself, what would you recommend? (Be sure to consider the costs as well as the benefits of your proposal and the economic aspect.
If the president of your college called you in and asked how community college could create...
If the president of your college called you in and asked how community college could create a competitive advantage for itself, what would you recommend? (Be sure to consider the costs as well as the benefits of your proposal). i. Write a clear, economics based response to the discussion question. ii. Cite references used to form your response, ie., newspapers, magazines, websites, textbooks, etc.
as part of your senior class grade, you are required to do 40 hours of community...
as part of your senior class grade, you are required to do 40 hours of community service at a homeless shelter, explain what you see in the shelter based on the issues of poverty in the united states?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT