1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Leokris [45]
3 years ago
6

Write a program that lets the Michigan Popcorn Company keep track of their sales for seven different types of popcorn they produ

ce: plain, butter, caramel, cheese, chocolate, turtle and zebra. It should use two parallel seven-element arrays: an array of strings that holds the seven popcorn names and an array of integers that holds the number of bags of popcorn sold during the past month for each popcorn flavor. The names should be stored using an initialization list at the time the flavors array is created. The program should prompt the user to enter the number of bags sold for each flavor. Once the popcorn data has been entered, the program should produce a report for each popcorn type, total sales, and the names of the highest selling and lowest selling products. Be sure to include comments throughout your code where appropriate. Complete the C++ code using Visual Studio or Xcode, compress (zip) and upload the entire project folder to the Blackboard assignment area by clicking on the Browse My Computer button or by dragging the file inside the Attach Files box g
Computers and Technology
1 answer:
valentina_108 [34]3 years ago
5 0

Answer:

  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.    // declare and initialize popcorn name array
  6.    string popcorn_name[7] = {"plain", "butter", "caramel", "cheese", "chocolate", "turtle", "zebra"};
  7.    // declare and initialize sales array with 7 elements
  8.    int sales[7];
  9.    
  10.    // A loop to prompt user to enter sales for each popcorn
  11.    for(int i=0; i < 7; i++){
  12.        cout<<"Enter number of sales for " + popcorn_name[i] + " :";
  13.        cin>>sales[i];
  14.    }
  15.    
  16.    // Find maximum sales
  17.    int max = sales[0];
  18.    int maxIndex = 0;
  19.    for(int j=1; j < 7; j++){
  20.        if(max < sales[j]){
  21.            max = sales[j];
  22.            maxIndex = j;
  23.        }
  24.    }
  25.    
  26.    // Find minimum sales
  27.    int min = sales[0];
  28.    int minIndex = 0;
  29.    for(int k=1; k < 7; k++){
  30.        if(min > sales[k]){
  31.            min = sales[k];
  32.            minIndex = k;
  33.        }
  34.    }
  35.    
  36.    // Print popcorn name and sales
  37.    for(int l=0; l < 7 ; l++){
  38.        cout<<popcorn_name[l]<<"\n";
  39.        cout<<"Sales: "<< sales[l]<<"\n\n";
  40.    }
  41.    
  42.    // Print popcorn name with maximum and minimum sales
  43.    cout<<"Highest selling: "<< popcorn_name[maxIndex]<<"\n";
  44.    cout<<"Lowest selling: "<<popcorn_name[minIndex]<<"\n";
  45.    return 0;
  46. }

Explanation:

Create two arrays to hold the list of popcorn name and their sales (Line 5-8). Next prompt user to input the sales for each popcorn (Line 10-14). Get the maximum sales of the popcorn (Line 17-24) and minimum sales (Line 27-34). Print the popcorn name and sales (Line 37-40) and the popcorn name with highest and lowest selling (Line 43-44).

You might be interested in
What determines the number of times that a condition-controlled loop will repeat?
Tcecarenko [31]

Answer:

the binary

Explanation:

5 0
3 years ago
Read 2 more answers
The vast majority of the population associates Blockchain with cryptocurrency Bitcoin; however, there are many other uses of blo
nydimaria [60]

Blockchain with cryptocurrency Bitcoin; however, there are many other uses of blockchain; such as Litecoin, Ether, and other currencies. In this discussion, Explanation:

4 0
3 years ago
What are the arguments for writing efficient programs even though hardware is relatively inexpensive?
Ainat [17]

Answer: Even though the hardware is inexpensive the writing of program is not efficient through this method as proper development of program is necessary for the clear execution due to factors like:-

  • The facility of writing program even the cost of hardware is less but it is not a free facility.
  • It also has a slower processing for the execution of the program
  • The construction of the efficient program is necessary for the compilation and execution of it rather than poorly constructed program is worthless and inefficient in working.

7 0
3 years ago
Differentiate between inherited trait and acquired trait​
miskamm [114]

Answer: Inherited trait is something you already have and acquired is something that you learn or achieve.

Explanation:

8 0
3 years ago
I recently fixed my computer's hard drive, and when I rebooted my comp., the mouse and keyboard won't work. The keys work when i
dezoksy [38]
Just simply do a hard reset, all your data will be lost but i think it will work, with my computes passed the same.
5 0
4 years ago
Other questions:
  • Where is the brightness and contrast changed at?
    10·2 answers
  • In an ipv4 address, what are the maximum number of bits that can be used to identify the network address
    14·1 answer
  • (True/False) Utilizing a higher bandwidth can support a larger volume of data (in bits per second) to be transmitted than a lowe
    13·2 answers
  • Which of the following plug-ins was developed by microsoft and is a software development tool used to write and run internet app
    10·1 answer
  • The frequency of a sine wave is defined as:
    8·1 answer
  • Consider the following statement from the CS Principles course framework: The global distribution of computing resources raises
    12·1 answer
  • A device that connects to a network without the use of cables is said to be?​
    13·1 answer
  • What is the difference between Input, Output, and Storage Devices?
    12·2 answers
  • HURRYY!!!<br> In the movie "Spare Parts" why can't Oscar enlist in the armed forces????
    13·1 answer
  • "kannst du mir bitte helfen" in German-English from Reverso Context: Hier, kannst du mir bitte helfen?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!