Calculate the price per item for that purchase

Assignment Help C/C++ Programming
Reference no: EM131230380

Computer Science Program-

Write a C++ program that will simulate a store where the purchase information will be read in from an input file. The program will calculate the price per item and the total cost of the entire purchase. The output will use formatted output tools to provide spacing and the exact number of decimal places to be displayed.

Declare a struct type that will represent a single purchase. The required fields are:
Item name - string
Quantity of items (how many are being purchased) - int
Cost (what does it cost to buy that many items) - double
Price per item (a calculated value based on quantity and cost) - double

The program should

Ask the user for the name of the input file and open that file for reading
While there is more purchase information in the file

read the information for one purchase into a variable of your struct type.
calculate the price per item for that purchase
output the data in formatted columns (as in program #1)
add the item cost into a total cost variable

After all file data has been processed, write out the total cost line

For an input file containing
Pencils
3
12.4
BlueBooks 13
3.99
the output would look something like this

Qty

Item

Price/Item

Cost

3

Pencils

4.13

12.40

13

BlueBooks

0.31

3.99

 

 

Total Cost

16.39

Use functions to do all of the major tasks (input, calculation, output)

Required Comments: Name block

Descriptive comment at the beginning of the whole program Descriptive comment at the beginning of each function

Reference no: EM131230380

Questions Cloud

Create a new product that would appeal to your market : Develop at least one question for each characteristic of the target market (demographic, geographic, psychographic, and behavioral) that will be important for you as you determine the marketing strategy for this new product.
List several of the technical requirements placed : List several of the technical requirements placed on software applications (§ 1194.21) and web-based applications (§ 1194.22), then explain the purpose each serves.
What is the net present value at discount rate : FIN-351 Fall 2016 Assignment. The Hudson Corporation makes an investment of $24,000 that provides the following cash flow: What is the net present value at an 8 percent discount rate
Shows how the it and biblical concepts are related : Create a document which shows how the IT and Biblical concepts are related. (What are the similarities between these ideas?)
Calculate the price per item for that purchase : Read the information for one purchase into a variable of your struct type. Calculate the price per item for that purchase. Output the data in formatted columns (as in program #1). Add the item cost into a total cost variable.
It has been said there is no bad data, just bad management : To what extent should end users be involved in the selection of a database management system and database design?
Check the given essay and rewrite it : Check the given essay. and rewrite it if needed. - The essay topic is : "Bullying". -  One of the biggest problems that seen these days is bullying.
What are the consequences of an organization : What are the consequences of an organization not having an information policy?
Describe an effective e-mail and web use policy : Should managers inform employees that their Web behavior is being monitored? Or should managers monitor secretly? Why or why not?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd