Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program that lets a maker of chips and salsa keep track of sales for five different types of salsa: mild, medium, 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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started