(Solved) : Write Program Help Travelling Sales Person Keep Daily Mileage Driven Business Main Method Q42705320 . . .

Write a program to help a travelling sales person keep up withtheir daily mileage driven for business. In your main method, theprogram should first ask the user how many days of mileage theywant to enter and then collect the user input for each day’s miles,storing the values entered in an appropriately sized array.

After collecting the user input for the miles, the main methodshould use a do…while loop to present a menu to the user as shownin the example below. The main method should take the user’s pickfrom the menu and use a switch statement to call the appropriatemethod(s) to carry out the requested task and output any returneddata to the user. The menu should keep being presented to the useruntil the Exit option is chosen by the user. If the user types in awrong menu item number, they should be told they entered an invalidchoice and then given another chance to choose an option.

User Menu Example:

  1. Find the number of days with 0 miles driven.

  2. Find the day(s) with the highest number of miles driven.

  3. Find the average miles driven.

  4. Print the miles entered by day.

  5. Exit

Choose an option from the menu:

In your class, you should also create the following methods tocarry out certain tasks (menu items) for the user.

  • The findZero method will accept the arraythrough a parameter and then return the number of days no mileswere driven for business.

  • The findMaxDay method will accept the arraythrough a parameter and then return the day number(s) with thehighest number of miles driven. The method should return an intarray that contains all of the days with the highest number ofmiles driven in the case of a tie. Note, the int array shouldcontain the day number the user would recognize as opposed to theindex position. For example, the user would expect to see the firstday entered as day 1..

  • The calculateAvg method will accept the arraythrough a parameter and then return the average miles driven.

Expert Answer


Answer to Write a program to help a travelling sales person keep up with their daily mileage driven for business. In your main met…

Leave a Comment

About

We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.

Quick Links

Browse Solutions

Place Order

About Us

× How can I help you?