Question: Please answer the following in JAVA. Create two dictionaries: student1 and student2. Give each dictionary the keys ID, assignments, quizzes, and exams. The ID key

Please answer the following in JAVA.

Create two dictionaries: student1 and student2.

Give each dictionary the keys "ID", "assignments", "quizzes", and "exams". The "ID" key need to be the id of the student (that is, 4 digits) and the other keys should be an empty list ("assignments": [], "quizzes": [], "exams": [])

Create a list of dictionaries named students that contains the dictionaries student1 and student2

For each student in students list, enter scores from keyboard for his/her assignments, quizzes, and exams. Please note that each student will have 3 assignments, 2 quizzes and 2 exams. All scores are out of 100. For example, student1s scores could be:

Assignment: [70, 80, 88]

Quizzes: [0, 75]

Exams: [90,95]

And student2s scores could be:

Assignment: [95, 90,92]

Quizzes: [85,90]

Exams: [89,97]

Please note that to enter the scores you may want to use a nested loop. For example, to enter the scores for the assignments, Outer loop is needed to iterate students (for student in students) and inner loop is needed to iterate scores (for j in range(0, 3)). Also, remember, you can use append method to add a new value to a list. Sample run (getting the scores)

Sample run (getting the scores):

Enter the score of the 1 assignment for the student ID:1122 70

Enter the score of the 2 assignment for the student ID:1122 80

Enter the score of the 3 assignment for the student ID:1122 88

Enter the score of the 1 assignment for the student ID:2346 95

Enter the score of the 2 assignment for the student ID:2346 90

Enter the score of the 3 assignment for the student ID:2346 92

Enter the score of the 1 quiz for the student ID:1122 0

Enter the score of the 2 quiz for the student ID:1122 75

Enter the score of the 1 quiz for the student ID:2346 85

Enter the score of the 2 quiz for the student ID:2346 90

Enter the score of the 1 exam for the student ID:1122 90

Enter the score of the 2 exam for the student ID:1122 95

Enter the score of the 1 exam for the student ID:2346 89

Enter the score of the 2 exam for the student ID:2346 97

After getting the scores, you need to write a loop to display the entered scores for each student as follows:

The entered scores for students are:

1122

assignments [70, 80, 88]

quizzes[0, 75]

exams[90, 95]

2346 assignments [95, 90, 92]

quizzes[85, 90]

exams[89, 97]

Write a function total that takes a list of scores (for example, assignments scores) and returns the total of the scores (def total(scores)):

Define a function called total that has one argument, scores to receive a list of scores

Inside that function, iterate the scores in the list to find the total

Return that total.

Write a function average(def average(total1, total2, total3):) that takes three totals (i.e., total score of assignments, total score of quizzes, total score of exams) and return the average of the scores.

Define a new function called letter_grade that has one parameter called scoreAverage (def letter_grade(scoreAverage):)

Inside the function, test scoreAverage using if/elif/else (see below)

if ..

elif .

else:

So,

If scoreAverage is 90 or above: return "A"

Else if scoreAverage is 80 or above: return "B"

Else if scoreAverage is 70 or above: return "C" 3

Else if scoreAverage is 60 or above: return "D"

Otherwise: return "F"

Finally, test your code.

For each student s in students list, call the letter_grade function with the result of average as follows: letter_grade(average(total(s["assignments"]),total(s["quizzes"]),total(s[" exams"]))) and print the resulting letter grade as follows:

The grade of student whose ID 1122 and average 71.14 is C

The grade of student whose ID 2346 and average 91.14 is A

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!