Computers and Technology
Computers and Technology, 27.05.2020 19:02, jahyra11

In this exercise, complete the method getMostImprovedStudent in the Classroom class, as well as the method getExamRange in the Student class.

The most improved student is the one with the largest exam score range.

To compute the exam score range, you must subtract the minimum exam score from the maximum exam score.

For example, if the exam scores were 90, 75, and 84, the range would be 90 - 75 = 15.

The toString method in the Student class will print the student names with their respective grade levels. Then print who the most improved student was after this.

Sample output:

Ada Lovelace is in grade: 12
Alan Turing is in grade: 11
The most improved student is Ada Lovelace

Code that was given to edit and complete below:

public class ClassroomTester
{
public static void main (String[] args)
{
Classroom c = new Classroom(2);

Student ada = new Student("Ada", "Lovelace", 12);
ada. addExamScore(44);
ada. addExamScore(65);
ada. addExamScore(77);

Student alan = new Student("Alan", "Turing", 11);
alan. addExamScore(38);
alan. addExamScore(24);
alan. addExamScore(31);

// add students to classroom
c. addStudent(ada);
c. addStudent(alan);
c. printStudents();

Student mostImproved = c. getMostImprovedStudent();
System. out. println("The most improved student is " + mostImproved. getName());
}
}

public class Classroom
{
Student[] students;
int numStudentsAdded;

public Classroom(int numStudents)
{
students = new Student[numStudents];
numStudentsAdded = 0;
}

public Student getMostImprovedStudent()
{
// your code goes here!
}

public void addStudent(Student s)
{
students[numStudentsAdded] = s;
numStudentsAdded++;
}

public void printStudents()
{
for(int i = 0; i < numStudentsAdded; i++)
{
System. out. println(students[i]);
}
}
}

public class Student
{
private static final int NUM_EXAMS = 4;

private String firstName;
private String lastName;
private int gradeLevel;
private double gpa;

private int[] exams;
private int numExamsTaken;

/**
* This is a constructor. A constructor is a method
* that creates an object -- it creates an instance
* of the class. What that means is it takes the input
* parameters and sets the instance variables (or fields)
* to the proper values.
*
* Check out StudentTester. java for an example of how to use
* this constructor.
*/
public Student(String fName, String lName, int grade)
{
firstName = fName;
lastName = lName;
gradeLevel = grade;
exams = new int[NUM_EXAMS];
numExamsTaken = 0;
}

public int getExamRange()
{
// your code goes here!
}

public String getName()
{
return firstName + " " + lastName;
}

public void addExamScore(int score)
{
exams[numExamsTaken] = score;
numExamsTaken++;
}

// This is a setter method to set the GPA for the Student.
public void setGPA(double theGPA)
{
gpa = theGPA;
}

/**
* This is a toString for the Student class. It returns a String
* representation of the object, which includes the fields
* in that object.
*/
public String toString()
{
return firstName + " " + lastName + " is in grade: " + gradeLevel;
}
}

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 02:00, vivian2020
Read this excerpt from helen keller’s autobiography, the story of my life. have you ever been at sea in a dense fog, when it seemed as if a tangible white darkness shut you in, and the great ship, tense and anxious, groped her way toward the shore with plummet and sounding-line, and you waited with beating heart for something to happen? i was like that ship before my education began, only i was without compass or sounding-line, and had no way of knowing how near the harbour was. "light! give me light! " was the wordless cry of my soul, and the light of love shone on me in that very hour. . the morning after my teacher came she led me into her room and gave me a doll. the little blind children at the perkins institution had sent it and laura bridgman had dressed it; but i did not know this until afterward. when i had played with it a little while, miss sullivan slowly spelled into my hand the word "d-o-l-l." i was at once interested in this finger play and tried to imitate it. when i finally succeeded in making the letters correctly i was flushed with childish pleasure and pride. running downstairs to my mother i held up my hand and made the letters for doll. i did not know that i was spelling a word or even that words existed; i was simply making my fingers go in monkey-like imitation. in the days that followed i learned to spell in this uncomprehending way a great many words, among them pin, hat, cup and a few verbs like sit, stand and walk. based on this excerpt, which words best describe helen keller?
Answers: 2
image
Computers and Technology, 24.06.2019 07:20, stephanieyingepbtcf8
3pointsyou've found an image you want to insert into your slide presentation. youwant to make the image look more gray so that it looks like an older imagewhat would you need to adjust? 0.00o a. sizeo b. hueo c. contrasto d. tones
Answers: 2
image
Computers and Technology, 24.06.2019 21:40, imamador6396
Which of these is not a type of socket? aga (alternating grid array) pga (pin grid array) spga (staggered pin grid array) lga (land grid array)
Answers: 1
image
Computers and Technology, 25.06.2019 00:30, aleiahmartin
Which email writing etiquette should ariel follow to let people know that she received their message? a. reply to their messages immediately b. use formal language c. specify the email's intent in the subject field d. be direct when writing the reply
Answers: 1
Do you know the correct answer?
In this exercise, complete the method getMostImprovedStudent in the Classroom class, as well as the...

Questions in other subjects:

Konu
Mathematics, 03.12.2020 18:40