Question

In this module, you learned about Arrays in C++ and how to implement arrays within your...

In this module, you learned about Arrays in C++ and how to implement arrays within your C++ programs.

For this assignment, you will implement your knowledge of arrays for Michigan Popcorn Company’s sales management system.

Write a program that lets the Michigan Popcorn Company keep track of their sales for seven different types of popcorn they produce: 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.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
 #include<bits/stdc++.h> using namespace std; int main(){ string Names[]={"plain","butter","caramel","cheese","chocolate","turtle","zebra"}; int bags[7]; int highst=-1,lowst=100000000; int index=0,ind2=0; //Taking input of number of sales of each popcorn type for(int i=0;i<7;i++){ cout<<"Input the number of bags of "<<Names[i]<<" popcorn sold"<<"\n"; cin>>bags[i]; //Saving the index of highest selling product if(bags[i]>highst) { highst=bags[i]; index=i; } //Saving the index of lowest selling product if(bags[i]<lowst) { lowst=bags[i]; ind2=i; } } //Report cout<<"REPORT:"<<"\n"; for(int i=0;i<7;i++){ cout<<Names[i]<<" popcorn :"<<"Total sales = "<<bags[i]<<"\n"; } cout<<"HIGHEST SELLING PRODUCT : "<<Names[index]<<" popcorn"<<"\n"; cout<<"LOWEST SELLING PRODUCT : "<<Names[ind2]<<" popcorn"<<"\n"; }
Add a comment
Know the answer?
Add Answer to:
In this module, you learned about Arrays in C++ and how to implement arrays within your...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a C++ program that lets a maker of chips and salsa keep track of their...

    Write a C++ program that lets a maker of chips and salsa keep track of their sales for five different types of salsa they produce: mild, medium, sweet, hot, and zesty. It should use two parallel five-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 at the...

  • In this module you learned about arrays. You also began learning about implementing arrays and how...

    In this module you learned about arrays. You also began learning about implementing arrays and how they can help organize the data in a program. The magic ball eight was created in the 50's and was produced by mattel. Eight Ball is a toy and is just a game. The magic 8 ball answers your yes/no questions. You will be creating a version of the Magic 8 Ball game. You can use whats inside the attached file to build your...

  • Parallel Arrays Summary In this lab, you use what you have learned about parallel arrays to...

    Parallel Arrays Summary In this lab, you use what you have learned about parallel arrays to complete a partially completed Java program. The program should either print the name and price for a coffee add-in from the Jumpin’ Jive coffee shop or it should print the message: "Sorry, we do not carry that.". Read the problem description carefully before you begin. The data file provided for this lab includes the necessary variable declarations and input statements. You need to write...

  • Program 2 <100 points>: Chips and Salsa (chipsSalsa.cpp) Write a program that lets a maker of...

    Program 2 <100 points>: Chips and Salsa (chipsSalsa.cpp) 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...

  • Implement the histogram function to complete the desired program. You must use dynamically allocated arrays for...

    Implement the histogram function to complete the desired program. You must use dynamically allocated arrays for this purpose. For your initial implementation, use ordered insertion to keep the words in order and ordered sequential search when looking for words. Note that the array utility functions from the lecture notes are available to you as art of the provided code. Although we are counting words in this program, the general pattern of counting occurrences of things is a common analysis step...

  • :) Problem: ??? Your task: implement in CH the algorithm solution shown below. Then analyze it...

    :) Problem: ??? Your task: implement in CH the algorithm solution shown below. Then analyze it and explain, using just one or two sentences, what it does. Write this explanation as a comment at the top of your program. This explanation will be worth 5 points of your total grade. Do not be too detailed (for example, do not write it opens a file and then declares variables, and then reads from a file...), it should look like the problem...

  • C++ implement and use the methods for a class called Seller that represents information about a...

    C++ implement and use the methods for a class called Seller that represents information about a salesperson. The Seller class Use the following class definition: class Seller { public: Seller(); Seller( const char [], const char[], const char [], double ); void print(); void setFirstName( const char [] ); void setLastName( const char [] ); void setID( const char [] ); void setSalesTotal( double ); double getSalesTotal(); private: char firstName[20]; char lastName[30]; char ID[7]; double salesTotal; }; Data Members The...

  • For this assignment, you will use your knowledge of arrays and ArrayLists to write a Java...

    For this assignment, you will use your knowledge of arrays and ArrayLists to write a Java program that will input a file of sentences and output a report showing the tokens and shingles (defined below) for each sentence. Templates are provided below for implementing the program as two separate files: a test driver class containing the main() method, and a sentence utilities class that computes the tokens and shingles, and reports their values. The test driver template already implements accepting...

  • Please write an 1. executive overview of the above case study. 2. in detail, what is...

    Please write an 1. executive overview of the above case study. 2. in detail, what is the critical issue or problem in the above case study. 3. please provide a detailed analysis of the cause of the issue or problem in the above case study. 國connect VIDEO CASE 1 Chobani: Making Greek Yogurt a Household Name Everybody should be able to enjoy a pure, simple cup of yogurt. And that's what Chobani is," says The very first cup for sale...

  • SYNOPSIS The product manager for coffee development at Kraft Canada must decide whether to introduce the...

    SYNOPSIS The product manager for coffee development at Kraft Canada must decide whether to introduce the company's new line of single-serve coffee pods or to await results from the product's launch in the United States. Key strategic decisions include choosing the target market to focus on and determining the value proposition to emphasize. Important questions are also raised in regard to how the new product should be branded, the flavors to offer, whether Kraft should use traditional distribution channels or...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT