The question goes like this:
Write a main method that does the following:
i) Declare and initialize an array names with the names of 5 students: "John", "Mary", "Jack", "Amy" and "Ivy".
My answer is:
String [ ] names = {"John", "Mary", "Jack", "Amy", "Ivy"}
ii) Declare and create an array scores for storing the scores of 5 students.
My answer is:
int [ ] scores = int [5]
iii) Use a for loop to call getScore() method and store the returned score of each student into the array scores.
[This part I have no idea.]
iv) Call the countPasses() method, and display the number of students who passed the test.
v) Prompt the user to enter a student's name before displaying the score for that student.
[Assume that John's score is stored in the first element of the score array, Mary's score is in the second element of the score array, and so on]
Those that I did not show my answers are those that I have no idea on how to do. Those that I have shown the answers, please help me check on them. Thanks. But sorry too for asking you check my work >_< I'm currently preparing for my java programming examination. Thanks.
Tags: