Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab Exercise 6.2 Instructions : Code a program that prompts the user for the size of the array. Using the size, the program creates several

Lab Exercise 6.2 Instructions: Code a program that prompts the user for the size of the array.

Using the size, the program creates several arrays that will store information about your restaurants.

There will be one array for the restaurants,

another for the average number of daily customers,

and the last one for the average bill per customer.

The values in each array at the same location are for a given restaurant. Once the arrays are populated, print the information from each array.

The size and input will be the only global variables.

Use printf().

Use the looping structure generally associated with array processing.

Name the program YourLastNameFirstInitialLE62.java.

The methods will be called from the main().

Code your program according to the specifications below.

1st Input Prompt: Code this in a method named arraySize(). How many restaurants do you own? 2nd Input Prompt: In a method named setRestaurants declare the restaurants array and populate it. This method will return the restaurants array to the calling statement. The 9 in the prompt below will print 1 for the first restaurant, then 2 for the 2nd one and so forth. Use the loop-control variable as the value for 9. Enter restaurant 9: 3rd Input Prompt: In a method named setCustomers declare the noCustomers array and populate it. The Xs in the prompt is the restaurant. The setCustomers method will return the noCustomers array to the calling statement as well as receive the restaurants array from the calling statement. This method will be called as an argument in the call to printRestaurants(). Enter the average number of daily customers for Xxxxxxxxxx: 4th Input Prompt: In a method named calcAvgDailyRev declare the avgBill array and populate it. The Xs in the prompt is the restaurant. The calcAvgDailyRev method will return the avgBill array to the calling statement as well as receive the restaurants array from the calling statement. calcAvgDailyRev() will be called as an argument in the call to printRestaurants(). Enter the average bill per customer for Xxxxxxxxxx: Output Specifications: Where the Xs represent the restaurant and the Zs the average number of daily customers, the average bill and the average daily revenue. Code the output print statement in a method named printRestaurants() that accepts the restaurants, noCustomer, and avgBill arrays. The average daily revenue for each restaurant is to be calculated. In the printRestaurants method use a for loop to print the information for each restaurant from each array. The print for the header has to be outside of the for loop because it's printed only once. MY RESTAURANTS Restaurant: Xxxxxxxxxxxxxxx Average No of Daily Customers: Z,ZZ9 Average Bill Per Customer: $ZZ,ZZ9.99 Average Daily Revenue: $ZZZ,ZZZ,ZZ9.99 Restaurant: Xxxxxxxxxxxxxxx Average No of Daily Customers: Z,ZZ9 Average Bill Per Customer: $ZZ,ZZ9.99 Average Daily Revenue: $ZZZ,ZZZ,ZZ9.99 ***END OUTPUT SPECS***

Using drjava

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 And SQL For DB2

Authors: James Cooper

1st Edition

1583473572, 978-1583473573

More Books

Students also viewed these Databases questions

Question

2 To what extent does their relevance vary internationally?

Answered: 1 week ago

Question

5. Who should facilitate the focus group?

Answered: 1 week ago