View the step-by-step solution to:

###4# #)#X##Y #/#Z #/#[ #/#\ #/#]

Hello,

I need help in this question in Java,


SEIS 601-Assignment6

Redo Task 3 of assignment 4 using objects. You need to create a class named Student that has the appropriate data fields and methods. Example of methods in class Student are StudentAverage to find the average of each student and StudentLetterGrade to find the corresponding letter grade of the student. To cover all the students in the class, create an array of objects where each object is a student.


This is Task 3:


SEIS 601-Assignment4

Task 3:

Write a program that calculates the total average of each student in a class along with his/her letter grade and then displays information about the student with the highest score and the student with the lowest score and displays the list of all the students along with their exam scores, their total average and their corresponding letter grade. The program should also output the average of each test and the final average of the class.

Assume ten students in the class, declare the following inputs:

  1. 1-  An array that holds the last names of the students.
  2. 2-  An array to hold the first names of the students.
  3. 3-  An Array for the grades of Test 1 for each student.
  4. 4-  An Array for the grades of Test 2 for each student.
  5. 5-  An Array for the final exam grades for each student.

To calculate the letter grades:

  1. 1-  First write a method the finds the total average of each student assuming the weight for the final exam is 45%, and a weight of 25 % for the minimum grade between tests 1 and 2 and 30% for the test with the higher grades between Tests 1 and 2.
  2. 2-  Based on the total average, write a method that finds the letter grade as follows:
    1. A if 90<= Total Average <=100.
    2. B if 80<= Total Average <90.
    3. C if 70<= Total Average <80.
    4. D if 60<= Total Average <70.
    5. F if Total Average <60.

To display the required output:

  1. 1-  Write a method that calculates and displays the averages for Test 1, Test 2 and the Final Exam as well as the class average.
  2. 2-  Write a method that finds the student with the highest average and displays the information about the student in the following order:

Last name, First name, Test 1 score, Test 2 Score, Final Exam score, Total average, Letter grade.

3- Write a method that finds the student with the lowest average and displays the information about the student in the following order:

Dr. Hassan Salamy Page 2


Last name, First name, Test 1 score, Test 2 Score, Final Exam score, Total average, Letter grade

4- Write a method that displays the information about all the students in the form:

Last name, First name, Test 1 score, Test 2 Score, Final Exam score, Total average, Letter grade.

Use the following table as your input.



I have attache the snapshot of the out put as well as the answer without using objects.

I need the same output, just I need to redo this task using objects as mentioned at the beginning

###4# #)#X##Y #/#Z #/#[ #/#\ #/#] #/#^#@F ######@Y#######@9#######@>#######@V ######@T#######@Q ######@N###### #_#`##a ###X##b ###c ###d ###e #f#g##h##i#@#########j #f#k #/#l##m##n##o #p#q #r#s #/#t #u#v #f#w##x #/#X##y ###z##{##| #4#X #4#} #~### #/# ## #/# ## #/# ## firstName###[Ljava/lang/String;###lastName###test1###[I###test2## finalExam###<init>###()V###Code###LineNumberTable## getAverage###(III)D##StackMapTable###getGrade###(D)C###displayAverage## lowestAverage###highestAverage##
Background image of page 01
displayClass###main###([Ljava/lang/String;)V##x##|## SourceFile###ClassRoom.java
Background image of page 02
Show entire document
import java.util.Random; public class ClassRoom { String firstName[]=new String[10]; String lastName[]=new String[10]; int test1[]=new int[10]; int test2[]=new int[10]; int finalExam[]=new int[10]; public static double getAverage(int test1,int test2,int finalExam) { int min=test1<test2?test1:test2; int max=test1>test2?test1:test2; return finalExam*45.0/100+min*25.0/100+max*30.0/100; } public static char getGrade(double avg) { if(avg>=90) { return 'A'; } else if(avg>=80&&avg<90) { return 'B'; } else if(avg>=70&&avg<80) { return 'C'; } else if(avg>=60&&avg<70) { return 'D'; } else { return 'F'; } } public void displayAverage() { double sum=0; for(int i=0;i<test1.length;i++) { sum+=test1[i]; } double test1Avg=sum/test1.length; System.out.print("Average of test 1 : "+test1Avg); sum=0; for(int i=0;i<test2.length;i++) { sum+=test2[i]; } double test2Avg=sum/test2.length; System.out.print("Average of test 2 : "+test2Avg); sum=0; for(int i=0;i<finalExam.length;i++)
Background image of page 1
{ sum+=finalExam[i]; } double finaltestAvg=sum/finalExam.length; System.out.print("Average of final Exam : "+finaltestAvg); double classAvg=(test1Avg+test2Avg+finaltestAvg)/3; System.out.println("Class Average : "+classAvg); } public void lowestAverage() { double minavg=getAverage(test1[0], test2[0], finalExam[0]); int index=0; for(int i=1;i<firstName.length;i++) { double avg=getAverage(test1[i], test2[i], finalExam[i]); if(avg<minavg) { minavg=avg; index=i; } } System.out.println("First Name Last Name Test1 Test2 Final Exam Average Grade"); System.out.printf("%s%11s%8d%8d%8d%8.2f %10c\n",firstName[index],lastName[index],test1[index],test2[index],finalExam[ind ex],minavg,getGrade(minavg)); } public void highestAverage() { double maxavg=getAverage(test1[0], test2[0], finalExam[0]); int index=0; for(int i=1;i<firstName.length;i++) { double avg=getAverage(test1[i], test2[i], finalExam[i]); if(avg>maxavg) { maxavg=avg; index=i; } } System.out.println("First Name Last Name Test1 Test2 Final Exam Average Grade"); System.out.printf("%s%11s%8d%8d%8d%8.2f %10c\n",firstName[index],lastName[index],test1[index],test2[index],finalExam[ind ex],maxavg,getGrade(maxavg)); } public void displayClass() { System.out.println("First Name Last Name Test1 Test2 Final Exam Average Grade"); for(int index=0;index<firstName.length;index++) { double avg=getAverage(test1[index],test2[index],finalExam[index]); System.out.printf("%s%11s%8d%8d%8d%8.2f %10c\n",firstName[index],lastName[index],test1[index],test2[index],finalExam[ind ex],avg,getGrade(avg));
Background image of page 2
Show entire document
Background image of page 1
Sign up to view the entire interaction

Top Answer

Please find the solution file attached below. If... View the full answer

Student.java

/*
*
*/
/**
*
* @author
*/
public class Student {
String firstName;
String lastName;
int test1;
int test2;
int finalExam;
public Student(String firstName, String lastName, int test1, int test2,...

Sign up to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask a homework question - tutors are online