Purchase Solution

A C++ program to read from text file records of chocolate types and amounts. Each type is maintained in an array by index. A summary report is produced at the end.

Not what you're looking for?

Ask Custom Question

The O-So-Good Chocolate Company produces different types of chocolates daily. They need a little summary report that shows how much of each chocolate type they produce for a given month. This way they can plan next month's production schedule.

They record each day's production for each chocolate type in a file named Chocolates.
I will put the file out on Blackboard under Assignments.. The data indicates the batches of chocolates made each day and is describes as the type of chocolates produced and the number of pieces in each batch. The company makes several different chocolates each day so there will be several different entries for a given day. The input will be two numbers per line where the first number is the chocolate type and the second is the number of pieces made for that batch. There are 25 chocolate types numbered 1 to 25.
For example:
3 30 chocolate number 3 there are 30 pieces
21 45 chocolate number 21 there are 45 pieces
6 28 chocolate number 6 there are 28 pieces
etc..

The company can produce up to 25 different kinds of chocolates. The input file is one month of data.
You are to count the number of chocolates pieces for each kind of chocolate produced and the number of batches for the given month.
The report should have a title and headings. Output for each type of chocolate, the total pieces produced, the total batches produced, the average number of pieces produced in each batch. Label all output and make it a nice readable report, table format.

You must use arrays, pass arrays, and use functions.

Purchase this Solution

Solution Summary

A complete C++ project of a program to read from text file records of chocolate types and amounts. Each type is maintained in an array by index. A summary report is produced at the end. Tested by a Brainmass user and problem reported by him is resolved in this solution.

Solution Preview

I have written the C++ program and attached the whole C++ project.

Now it will produce the results as shown below.

Remember to place Chocolates.txt in the same directory as executable. There is also an important notice about one line of code at the very bottom of this text (see below).

Good luck and thank you for using ...

Purchase this Solution


Free BrainMass Quizzes
Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

C++ Operators

This quiz tests a student's knowledge about C++ operators.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

C# variables and classes

This quiz contains questions about C# classes and variables.