Question: JAVA LANGUAGE Please Solve both Exercises (I'll recommend you) Exercise 1: 1-Which of the following expressions yields an integer between 20 and 90, inclusive? a.

JAVA LANGUAGE Please Solve both Exercises (I'll recommend you) Exercise 1: 1-Which of the following expressions yields an integer between 20 and 90, inclusive?

a. (int)(Math.random() * 71) + 20

b. (int)(Math.random() * 90) + 20

c. (int)(Math.random() * 20) + 90

d. (int)(Math.random() * 21) + 71 -------------------------------------------------------------- 2-

The following code displays all numbers from 72 to 1000 in the same line. Modify it in order to display numbers from 72 to 1000 five per line.

for(int i = 72; i <= 1000; i++)

System.out.print(i + " "); ----------------------------------------------------------------------------- 3-

  1. What makes this loop an infinite loop?

int count = 0, even=0;

while(count < 10){

if(count % 2 == 0)

even ++;

} --------------------------------------------------------------------------------------------------------------------------------- Exercise 2:

Write a program that asks the user to enter the grade of three students. The program must display the highest grade. Note that the grades must be between 0 and 100. Do NOT use loops, otherwise you will not get the mark.

Sample run 1:

Enter the grade of student 1: 70

Enter the grade of student 2: 95

Enter the grade of student 3: 87

The highest grade is 95.0

Sample run 2:

Enter the grade of student 1: 62

Enter the grade of student 2: -75

Enter the grade of student 3: 98

Wrong entry all grades should be between 0 and 100

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!