1) Create two child classes, UnderGraduateStudent and GraduateStudent that will extend from the Student class. Override the char getLetterGrade() method in each of the child classes.

Use Student.java class defined below: (complete and compile)

class Student {
private int id;
private int midtermExam;
private int finalExam;

public double calcAvg() {
double avg;
avg = (midtermExam + finalExam) / 2.0;
return avg;
}

public char getLetterGrade() {
char letterGrade = ‘ ‘;

return letterGrade;
}
}

For the GraduateStudent class, the lowest passing grade in the getLetterGrade() is a 'C'.

90-100 =A
80-89 = B
70-79 =C
<70 = F

For the UnderGraduateStudent, the lowest passing grade in the getLetterGrade() is a 'D'.

90-100 =A
80-89 = B
70-79 =C
60-69 = D
<60 =F
class UnderGraduateStudent extends Student {
}

class GraduateStudent extends Student {
}

Create a main() method in a separate class to test child classes created.

2) Design and implement an application that reads an arbitrary number of integers that are in the range of 0 to 50 inclusive and counts how many occurrences of each are entered. After all inputs have been processed, print only the values that have an occurrence of greater than zero. Also, print the number of occurrences next to the value. [HINT: use arrays and indexing. Do not use ArrayList]

e.g.

Enter a value between 0 and 50 [ -1 to end ]: 10
Enter a value between 0 and 50 [ -1 to end ]: 2
Enter a value between 0 and 50 [ -1 to end ]: 30
Enter a value between 0 and 50 [ -1 to end ]: 10
Enter a value between 0 and 50 [ -1 to end ]: 3
Enter a value between 0 and 50 [ -1 to end ]: 10
Enter a value between 0 and 50 [ -1 to end ]: 30
Enter a value between 0 and 50 [ -1 to end ]: 2
Enter a value between 0 and 50 [ -1 to end ]: -1

Output:

The value of 2 has 2 occurrences.
The value of 3 has 1 occurrences.
The value of 10 has 3 occurrences.
The value of 30 has 2 occurrences.
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.