Question: Write a static method called reportScore that takes as a parameter a Scanner containing information about a student's performance and that prints a report for

Write a static method called reportScore that takes as a parameter a Scanner containing information about a student's performance and that prints a report for that student. Students are given gold stars for tasks they solved particularly well and minuses for tasks where they performed poorly. The information for each student is presented as a series of count/type pairs where each count is a positive integer and each type is either "*" or "-". These count/type pairs are followed by the student's name which is guaranteed to be a single word composed entirely of alphabetic characters. Consider this report:

3 * 2 - 1 * Erica 

It indicates that Erica got 3 stars followed by 2 minuses followed by 1 star. The overall score is computed by giving 1 plus point for each star and one minus point for each minus. The method produces exactly one line of output reporting this score and the total number of tasks. The table below includes several examples.

You may not construct any extra data structures to solve this problem.

 Scanner contents Output produced ---------------------------------- ------------------ 3 * 2 - 1 * Erica Erica got 2 of 6 2 - 1 * 2 - 1 - 1 * 2 - Fred Fred got -5 of 9 1 * 1 - 3 * 1 - 2 - Sylvia Sylvia got 0 of 8 Julia 

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!