Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Use C++ language. Comment in the codes would great. 2. (80) An organization that

ID: 3728505 • Letter: U

Question

Use C++ language.
Comment in the codes would great.

2. (80) An organization that your little cousin belongs to is selling low-fat cookies. If your cousin's class sells more cookies than any other class, the teacher has promised to take the whole class on a picnic. Of course, your cousin volunteered you to keep track of all the sales and determine the winner. Each class has an identification number. Each sales slip has the class identification number and the number of boxes sold. Input (Note: if you use keyboard for the input, it is ok for this assignment) Here is a sample of the data. (The classes are numbered from 1 through 10.) Id. Number Boxes Sold 23 4 13 4 10 Output 16 The following information written on the output file all properly labeled Tracking all the sales for 10 classes. The total number of boxes sold by each class The identification number of the winning class. If there is a tie, list all winners. Data Structures: using class UnsortedType defined in the textbook (chapter 3). The interface is provided at the end of this assignment. You can use either array or LinkedList as the fundamental data structure Deliverables Part I

Explanation / Answer

The below code represents C++ program:

CODE:

Class Cookie

{

Public:

int id;

int boxsold;

public:

Cookie()

{

id=0;

boxsold=0;

}

};

#include<iostream>

#include<fstream>

#include<iomanip>

Using namespace std;

Int main()

{

Cookie sale;

Int id,box,ch;

Std::ofstream outputfile;

For(int i=0;i<10;i++)

{

Sale.a[i]=0;

}

Count<<”nPress1 if you want to enter data”;

Cin>>ch;

While(ch==1){

Cout<<”nEnter the identification number for each box that is sold”;

Cin>>id;

Cout<<”nEnter the number of boxes sold”;

Cin>>box;

For(int i=0;<10;i++){

If(i==id){

Sale.a[i]+=box;

}

]

Cout<<”nPress1 for enter data”;

Cin>>ch;

}

Int max=sale.a[0];

Int maxid=0;

For(int i=1;i<10;i++){

If(sale.a[i];

Maxid=I;

}if(sale.a[i]==0){

Sale.a[i]=1;

}

}

Cout<<”nThe array is”;

for(int i=0;i<10;i++){

cout<<”n”;

cout<<sale.a[i];

}

Outputfile.open(“boxes.txt”,std::ofstream::out std::ofstream::app);

Outputfile<<”nThe class that sold maximum no. of boxes is”;

Outputfile<<maxid;

Outputfile<<”n Maximum no. of boxes sold are”;

Outputfile<<max;

Outputfile.close();

Return 0;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote