كيف اعمل هذا الكود حاولت فيه ولكن يعطيني 14 ايررور
General
At the University of Poppleton student feedback on modules is achieved using a questionnaire. For each question students are asked to record an integer value in the range 1 to 5 with 1=Poor, 2=Fair, 3=Average, 4=Good, 5=Excellent. For each question an average mark is computed, and a histogram produced showing the number of 1s, number of 2s, etc.
Task
Write a method that reads in an collection of integer scores from the keyboard, with each score in the range 1-5, output the average, rounded to 1 decimal place, and draw a histogram of the mark distribution using rows of asterisks.
For example, if the scores returned are {3, 4, 2, 3, 3, 3, 4, 3, 3, 3, 4, 1, 1, 4}, the average is 41/14=2.9. There are 2 scores of 1, 1 score of 2, 7 scores of 3, 4 scores of 4, and 0 scores of 5. Hence the histogram (drawn sideways) is
**
*
*******
****
To solve this problem you are recommended to provide the following methods:
· a method that takes an integer value as a parameter and outputs that number of asterisks
· a method that takes an array of integers and returns the average, as a floating-point number
· a method that takes a floating-point number as a parameter and outputs that number rounded to one decimal place
_________________________________________ارسل المحاولة هنا