Question

In: Computer Science

The local taqueria wants you to write a program which tracks the number of burritos they...

The local taqueria wants you to write a program which tracks the number of burritos they sell each day and help them analyze their business.

The C++ program should ask the user for the number of different burrito types sold, then get the names of the types and the number of burritos sold of each type of that day. It asks to print out a daily report listing sales for each burrito type and total number of all burritos sold.

It must use a struct called SalesRecord which has two fields -- a string containing the name of the burrito, and an int containing the number of burritos sold of this type. You must have one dynamically allocated array of SalesRecord structs.  

Solutions

Expert Solution

PROGRAM :

#include<iostream>
using namespace std;

struct SalesRecord{ //created structure named SalesRecord as given in question
string name; //string variable name for storing the names of the burritos
int num; //int variable num for storing the number of sold burritos of this type
};

int main(){
int n,i,sum = 0; //variable n for different types of burritos, i for for loop, sum for storing the total number of burritos sold
cout<<"Enter the number of different types sold: ";
cin>>n; //asking for different types of burritos
SalesRecord sr[n]; //creating array of struct SalesRecord
for(i = 0;i<n;i++){
cout<<"Enter the name of the burrito "<<(i+1)<<": ";
cin>>sr[i].name; //Asking for name of each type of burritos
cout<<"Enter the number of burritos sold of this type: ";
cin>>sr[i].num; //asking for number of burritos sold for each type
sum+=sr[i].num; //adding number of burritos for each type
}
cout<<"Burrito_Name Burrito_Count"<<endl;
cout<<"------------------------------------------"<<endl;
for(i = 0;i<n;i++){
cout<<sr[i].name<<" "<<sr[i].num<<endl; //printing each type of burritos with numbers sold
}
cout<<"The total number of burritos sold for "<<n<<" types: "<<sum<<endl; //printing total number of burritos sold
return 0;
}

OUTPUT :


Related Solutions

The local taqueria wants you to write a program which tracks the number of burritos they...
The local taqueria wants you to write a program which tracks the number of burritos they sell each day and help them analyze their business. Your C++ program should ask the user for the number of different burrito types sold, then get the names of the types and the number of burritos sold of each type of that day. Print out a daily report listing sales for each burrito type and total number of all burritos sold. So far, this...
(Write a program in C++) A local instructor wants you to write a program to calculate...
(Write a program in C++) A local instructor wants you to write a program to calculate the average score made on exams by her students. For simplicity, she always has only 12 students in each course she teaches. She teaches multiple subjects so she would like to enter the name of the exam. She wants the program to also determine the highest and lowest scores and the number of students who passed and failed the exam. A score of 60...
A local instructor wants you to write a c++ program using arrays to calculate the average...
A local instructor wants you to write a c++ program using arrays to calculate the average score made on exams by her students. For simplicity, she always has only 12 students in each course she teaches. She teaches multiple subjects so she would like to enter the name of the exam. She wants the program to also determine the highest and lowest scores and the number of students who passed and failed the exam. A score of 60 or above...
Suppose that a principal of a local high school tracks the number of minutes his students...
Suppose that a principal of a local high school tracks the number of minutes his students spend texting on a given school day. He finds that the distribution of minutes spent texting is roughly normal with a mean of 60 and a standard deviation of 20. Use this information to answer the following questions. 1. Based on the statistics, what is the probability of selecting at random a student who spends an extreme amount of time texting – either less...
Suppose that a principal of a local high school tracks the number of minutes his students...
Suppose that a principal of a local high school tracks the number of minutes his students spend texting on a given school day. He finds that the distribution of minutes spent texting is roughly normal with a mean of 60 and a standard deviation of 20. Use this information to answer the following questions. 1. Based on the statistics, find the two numbers of minutes that define the middle 95% of students in the distribution. What is the value for...
A file concordance tracks the unique words in a file and their frequencies. Write a program...
A file concordance tracks the unique words in a file and their frequencies. Write a program that displays a concordance for a file. The program should output the unique words and their frequencies in alphabetical order. Variations are to track sequences of two words and their frequencies, or n words and their frequencies.
In C++ For this assignment, you will write a program to count the number of times...
In C++ For this assignment, you will write a program to count the number of times the words in an input text file occur. The WordCount Structure Define a C++ struct called WordCount that contains the following data members: An array of 31 characters named word An integer named count Functions Write the following functions: int main(int argc, char* argv[]) This function should declare an array of 200 WordCount objects and an integer numWords to track the number of array...
Write a Java program that implements a song database. The SongsDatabase class keeps tracks of song...
Write a Java program that implements a song database. The SongsDatabase class keeps tracks of song titles by classifying them according to genre (e.g., Pop, Rock, etc.). The class uses a HashMap to map a genre with a set of songs that belong to such a genre. The set of songs will be represented using a HashSet. Your driver output should sufficiently prove that your code properly implements the code below. public class SongsDatabase { private Map<String, Set<String>> genreMap =...
Program must be in C++! Write a program which: Write a program which uses the following...
Program must be in C++! Write a program which: Write a program which uses the following arrays: empID: An array of 7 integers to hold employee identification numbers. The array should be initialized with the following values: 1, 2, 3, 4, 5, 6, 7. Hours: an array of seven integers to hold the number of hours worked by each employee. payRate: an array of seven doubles to hold each employee’s hourly pay rate. Wages: an array of seven doubles to...
Write a python program which asks the user to enter a positive number that is greater...
Write a python program which asks the user to enter a positive number that is greater than 30 called, “num2” and then does the following: o 1) Print all numbers between 1 and “num2” that are divisible by 2 and 3. o 2) Print all numbers between 1 and “num2” that are either divisible by 6 or 7. o 3) Print all numbers between 1 and “num3” that is not divisible by 5
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT