Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Computer Science C++ Overview The purpose of this assignment is to make sure that you know how to write a program that uses files and

Computer Science C++

Overview

The purpose of this assignment is to make sure that you know how to write a program that uses files and file processing. The program also contains functions and does input, output, flow of control and/or calculations.

PROGRAM SPECIFICATION

For the assignment, we will read the updated file of information about the Farmers Market that is named ASSGN6-B.txt, located in your assignment 6 repository on Springboard. This file contains the names of various farms participating in a Farmers Market. The informationis in this format:

Field or data item in the file

Data type

Notes

Farm name

String of characters

This should end with a comma

Count of item

Integer

Number of items

Item

String

Name of the item

Item price

Float or double

Unit cost of each item

Total price

Float or double

The unit cost * count of items

Reminder that when reading the information into your program, the space between each field should have remained consistent and guaranteed. Also, we will not need to validate the information in this program. Your program will read the file and report on each farmstotal contribution to the Farmers Market. So if a farm has contributed 2 items (i.e., there are 2 records for that farm), you will add each contribution in running totals and report that. If theres only one thats easy, its just that one as the total. The farms are sequentially ordered by their names, and you simply need to compare the next farm read with the last farm read. Your report should look as follows:

==============================================================

= FARMERS MARKET INVENTORY =

==============================================================

Collins Farm 43900 items contributed totaling $29413.00

Rutherford Farms, Inc. 1468 items contributed totaling $1189.40*

There were 999 unique farms contributing to this weeks event.

*Notice in the example that multiple farm records are combined, the total items and respective costs, and only one entry then appears for that particular farm. Add the total number of unique farms to display at end.

Hint: Youre going to want to save the previous items farm name, and then compare that to the one you are reading. Use the string compare operator for equality (such as stringName1 != stringName2). Make sure that your timing is right when printing.

Make sure you break your code into functions. Open your files in main and pass them by reference.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

How does going global affect companies?

Answered: 1 week ago

Question

Question Can any type of stock or securities be used in an ESOP?

Answered: 1 week ago