Write a program that lets a maker of chips and salsa keep track of sales for...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a program that lets a maker of chips and salsa keep track of sales for five different types of salsa: mild, medium, sweet, hot, and zesty. The program should use two parallel 5- element arrays: an array of strings that holds the five salsa names and an array of integers that holds the number of jars sold during the past month for each salsa type. The salsa names should be stored using an initialization list (using {}) at the time the name array is created. The program should prompt the user to enter the number of jars sold for each type. Once this sales data has been entered, the program should produce a report that displays sales for each salsa type, total sales, and the names of the highest selling and lowest selling products. You need to create the following functions in addition to the main. fill JarsSoldArray prompts the user to enter the number of jars sold for each type and fills the jars sold array. printSales - displays sales for each salsa type. getTotal returns the total sales. Display the total in the main. getHighestLowestSelling - returns the indices of the highest and lowest selling salsas. Do not pass the name array to this function. Display the highest and lowest selling types in the main. Input Validation: Do not accept negative values for number of jars sold. Enter the number of jars sold for mild: -1 Enter the number of jars sold for mild: -100 Enter the number of jars sold for mild: 100 Enter the number of jars sold for medium: 500 Enter the number of jars sold for sweet: 0 Enter the number of jars sold for hot: 250 Enter the number of jars sold for zesty: 1000 mild 100 medium 500 sweet 0 hot 250 1000 zesty The total number of jars sold is 1850 The highest selling type is zesty The lowest selling type is sweet Write a program that lets a maker of chips and salsa keep track of sales for five different types of salsa: mild, medium, sweet, hot, and zesty. The program should use two parallel 5- element arrays: an array of strings that holds the five salsa names and an array of integers that holds the number of jars sold during the past month for each salsa type. The salsa names should be stored using an initialization list (using {}) at the time the name array is created. The program should prompt the user to enter the number of jars sold for each type. Once this sales data has been entered, the program should produce a report that displays sales for each salsa type, total sales, and the names of the highest selling and lowest selling products. You need to create the following functions in addition to the main. fill JarsSoldArray prompts the user to enter the number of jars sold for each type and fills the jars sold array. printSales - displays sales for each salsa type. getTotal returns the total sales. Display the total in the main. getHighestLowestSelling - returns the indices of the highest and lowest selling salsas. Do not pass the name array to this function. Display the highest and lowest selling types in the main. Input Validation: Do not accept negative values for number of jars sold. Enter the number of jars sold for mild: -1 Enter the number of jars sold for mild: -100 Enter the number of jars sold for mild: 100 Enter the number of jars sold for medium: 500 Enter the number of jars sold for sweet: 0 Enter the number of jars sold for hot: 250 Enter the number of jars sold for zesty: 1000 mild 100 medium 500 sweet 0 hot 250 1000 zesty The total number of jars sold is 1850 The highest selling type is zesty The lowest selling type is sweet
Expert Answer:
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Posted Date:
Students also viewed these programming questions
-
An algorithm has been written in pseudocode to input some numbers. It only outputs any numbers that are greater than or equal to 100. The number 999 is not output and stops the algorithm. INPUT...
-
In Exercises 1138, use the given conditions to write an equation for each line in point-slope form and slope-intercept form. Slope = 2, passing through (3, 5)
-
Consider the graph of (ABC. a. Represent (ABC with a matrix [M]. b. Find each product and graph the image of the triangle represented by the result. i. ii. 1
-
Do you believe Michael Woodford did the right thing by blowing the whistle on accounting irregularities? Were there other options open to him? Once he was fired, could he have made a whistleblower's...
-
It The wavelengths of light emitted by a firefly span the visible spectrum but have maximum intensity near \(550 \mathrm{~nm}\). A typical flash lasts for \(100 \mathrm{~ms}\) and has a power of...
-
In exercise 12, the following data on x = average daily hotel room rate and y = amount spent on entertainment (The Waal Street Journal, August 18, 2011) led to the estimated regression equation y =...
-
We consider ads for a keyword. The search engine offers 2 links. The first link has a frequency of 100 clicks/day, and the second link a click frequency of 40 clicks/day. There are 3 bidders, Alice,...
-
[ 1 3 ] The CAR larr SBR is executed to: a ) Call a subroutine b ) Return from a subroutine c ) Map from bits of instruction to address for control memory d ) Unconditional or conditional branch [13]...
-
In a large group of corporate executives, 20 % have no college education, 10 % have exactly 2 years of college, 20 % have exactly 4 years, and 50 % have 6 years. A sample size of 2 (with replacement)...
-
A medical insurance survey found that more than 90 percent of the plans members are satisfied. Identify two kinds of survivor bias that may affect these results. Is the reported satisfaction rate...
-
Assume that Beck Consulting chooses to take advantage of current business opportunities and will need to grow to 100 members in the next 9 months in order to respond to the challenges. What changes...
-
The order of payments for unsecured priority claims in a Chapter 7 bankruptcy case is such that a. Tax claims of governmental units are paid before claims for administrative expenses incurred by the...
-
Microsoft made its name by building two monopolies, its Windows operating system and its Office suite of personal productivity software, that are used the world over. Windows, for example, runs on...
-
Write a report using your knowledge of supply and demand and historical costs.
-
Why is it important to understand the macro-environment when making decisions about an international retail venture?
-
What is an injunction?
-
What is the main effect of increased use of liability insurance?
-
What are the arguments in favour of imposing a wide liability on professionals?
Study smarter with the SolutionInn App