Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1.A Write a program that uses a Scanner object to read in user input. Ask a user to enter three numbers. Print the average

Question 1.A Write a program that uses a Scanner object to read in user input. Ask a user to enter three numbers. Print the average of the three numbers. Then determine the smallest of the three numbers, the largest of the three numbers and middle number of the three numbers without the Math Class. Then print all three numbers from smallest to largest. You can assume all three numbers are different. See the below sample for proper formatting of the output. You should control for the decimal point to two decimal places using the printf command.

Sample:

image text in transcribed

Provide:

Printout of Properly Formatted Source Code

Example output/test cases (2 test cases different than above).

Question 1.B Write a program that will help two friends split the cost of a trip. There are four main expenses: the cost of the flight, cost of the hotel, cost of a tour, and the cost of meals. The program uses a Scanner object to read in user input. The program will first ask for the names of two friends. Then it will ask the cost for each expense and the who paid for which expense. The program will then calculate the total of all the expenses, what each person should pay if the costs were divided equally, and how much each friend actually paid. If one person paid less than the other, then they will owe their friend some money. See below for some sample outputs and how you should format your code.

Use printf to control the display of the decimal point.

Sample outputs:

//one friend owes the other friend money

image text in transcribed

//both paid the same amount (neither owes the other money)

image text in transcribed

Provide:

Printout of Properly Formatted Source Code

Example Output/Test Cases (3 outputs - you should all three cases: friend1 owes friend2 money, friend2 owes friend1 money, and that each paid an equal amount (nobody owes anyone money)).

Make sure it is done in Java format.

Please answer all parts of the question.

Or else it will be sent in fo reviews.

----jGRASP exec: java A1 _Numbers2 Enter 3 numbers and then hit enter 5 0 2 The average of 5, 0 and 2 is 2.33 The smallest num is 0 The largest num is!5 The numbers in order are: 0, 2 and !5 jGRASP: operation complete

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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_2

Step: 3

blur-text-image_3

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

More Books

Students also viewed these Databases questions

Question

What are the determinants of cash cycle ? Explain

Answered: 1 week ago

Question

Why do HCMSs exist? Do they change over time?

Answered: 1 week ago