Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a java program that determines the best possible meeting time for four people. The possibilities for meeting times are 8:00-12:00, 12:00-18:00 or 18:00-23:00. You

Write a java program that determines the best possible meeting time for four people. The possibilities for meeting times are 8:00-12:00, 12:00-18:00 or 18:00-23:00.

You should begin by asking the first user to choose a meeting time. The user should enter the number 1 for the 8:00-12:00 meeting time, the number 2 for the 12:00-18:00 meeting time, or the number 3 for the 18:00-23:00 meeting time.

Make sure that you display the three options on the screen for the user.

The program will then proceed to do the same thing three more times (for the other three people).

At the conclusion, the program should display on the screen the best possible meeting time. For our purposes, this will be the time block chosen by a majority of the people. In the event that there is a tie for time blocks, choose the earliest one.

The following is an example of what your MIGHT see on the screen when your program runs. The exact output depends on what values that the user types in while the program runs. The user's values are shown below in italics:

Meeting Times: 1) 8:00-12:00 2) 12:00-18:00 3) 18:00-23:00 Choose option 1, 2, or 3. Enter the best time available for person 1: 2 Enter the best time available for person 2: 1 Enter the best time available for person 3: 3 Enter the best time available for person 4: 2 The best meeting time available is: 12:00 - 18:00

Here is another example run of the program:

Meeting Times: 1) 8:00-12:00 2) 12:00-18:00 3) 18:00-23:00 Choose option 1, 2, or 3. Enter the best time available for person 1: 3 Enter the best time available for person 2: 1 Enter the best time available for person 3: 1 Enter the best time available for person 4: 3 The best meeting time available is: 8:00 - 12:00

Hint:

Use three separate counter variables to keep track of the total number of people who entered option 1, total number for option 2, and total for option 3. As the user enters each option, use IF statements to decide which option was chosen, and then add 1 to the appropriate counter.

After all input has been entered, compare the counters to see which one is holding the greatest value.

Use a String variable to store the final message to be printed to the screen. Update this variable when you figure out which counter is holding the largest value. By doing this, you can avoid printing this final message all throughout your program, and instead, print it only one time at the end of your program.

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

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

Database Design Application And Administration

Authors: Michael Mannino, Michael V. Mannino

2nd Edition

0072880678, 9780072880670

More Books

Students also viewed these Databases questions

Question

Evaluate employees readiness for training. page 275

Answered: 1 week ago