Question: 4a. For this exercise, you will use the Scanner Class and the Math Class. Write a program that uses a Scanner object to read in

4a. For this exercise, you will use the Scanner Class and the Math Class. Write a program that uses a Scanner object to read in two different numbers. Determine which is the largest and smallest of the two numbers. Print the number that is the largest of the two. Then subtract the smallest number from the largest of the two numbers and print this result. Calculate and print the square this result. Calculate and print the square of the small number. Then print out the largest of the two numbers. See below for sample output.

Type the first number: 10 Type the second number: 60

The largest number is 60.0 60.0 minus 10.0 is 50.0 The square of 50.0 is 2500.0 The square of 10.0 is 100.0 2500.0 is larger than 100.0

Test the program with three sets of data and include the results in this report. Do not concern yourself with controlling the display of the decimal point.

Program:

Output (3 different outputs):

4b. Write a program that uses a Scanner object that asks for your name and your examen, assignment and lab marks. The examen counts for 40%, assignments 40% and labs 20%. The program computes your grade percentage. Test the program with three sets of data and include the results in this report. Do not concern yourself with controlling the display of the decimal point.

Sample output:

Please enter your name: ..

Please enter your examen mark: ..

Please enter your assignment mark: ..

Please enter your lab mark: ..

Final grade: ..%

Program:

Output (3 different outputs):

SOLUTIONS AND OUTPUTS NEED TO BE IN JAVA FORMAT. (PLEASE SHARE YOUR SCREEN SHOT AS WELL).

NOTE: 3 OUTPUTS FOR EVERY QUESTION (3 OUTPUTS FOR 4A AND 3 OUTPUTS FOR 4B)

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!