Question: Exercise - using Java library classes with method calls For this exercise, you are required to write a java class with a main method that

Exercise - using Java library classes with method calls For this exercise, you are required to write a java class with a main method that does the following: Ask the user to enter an int number Display a message to tell the user what was just entered Generate a random int number between 20 to 40 Display a message to tell the user what number has been generated Determine which one of the two numbers is smaller Display a message to tell the user which one is smaller Determine the difference of the two numbers Display a message to tell the user the difference Ask the user to enter a sentence that include the word "like" Replace "like" with the word "dislike", and turn the whole sentence to all upper cases Display a message to tell the user what have happened and display the resulting sentence to the user. In your program, you must use the if statement at least once.

Below shows a sample output of the program: Please enter a whole number: 10 You just entered 10 Press enter to continue.... The computer just generated a random number between 20 to 40, and it is 36 We are about to determine the difference and the smaller number. Press enter to continue... The smaller number is 10 The difference of the two numbers is 26 Please enter a sentence that includes the word "like". I like shopping We have replaced "like" with "dislike" and turn the whole sentence to all uppercases. The resulting sentence is: I DISLIKE SHOPPING

Step by Step Solution

3.65 Rating (156 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Heres the Java class that fulfills the requirements of the exercise import javautilScanner import ja... View full answer

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 Programming Questions!