Question: 2 Practical Concepts 2.1 Create a Java program that declares an array of type int and call it myRandomNumbers, with a size of 50. Using

2 Practical Concepts

2.1 Create a Java program that declares an array of type int and call it myRandomNumbers, with a size of 50. Using a for loop, initialize the values of the array with random integers from 0 to 99, then display the value of the 40th element.

2.2 Create a Java program that de nes a method called getGrade that accepts an array of type double called myScores as a formal parameter. Using a for loop, the method iterates over the values of the array elements and checks the score;

a. if the score is at least 90.0, then the method displays the grade A, b. if the score is at least 80.0, then the method displays the grade B, c. if the score is at least 70.0, then the method displays the grade C, d. if the score is at least 60.0, then the method displays the grade D,

e. otherwise, the method displays the grade F.

In the Main() method, ask the user to enter the scores of ve tests and store them in an array of type double. Then invoke the getGrade method by passing the array of users score to display the grades.

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!