Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

Heres the Java class that fulfills the requirements of the exercise import javautilScanner import ja... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions