A trader wants to survey the profits of goods he sells. For this he had to enter each commodity, the commodity code (an integer between 100 and 1000), the purchase price and the selling price. When there are no more goods enter -1. Make the program that reads the data and determine with them and write on the screen:
The profit of each commodity
The average profit of the company
The total of goods that provide income below $ 15.00
The total of goods that provide income between $ 15.00 and $ 20.00
The total of goods that provide income above $ 20.00
Hmm I can give you a tiny skeleton to start with to nudge you in the right direction.First of all are there any requirements for this program like do you need a switch statement and what has the last lesson you are looking at. But for starting out I would us something like this:(note im still fairly new to c++ so I may not give the most efficient answer but might as well try to help XD). I am leaving out some of the variables so you can figure out.
#include <iostream>
#include <cfloat>
usingnamespace std;
int code; //can use this for a switch statement, can also be your EoF value.
float salePrice;
float purchPrice;
int main()
{
cout<<"Whatever introduction statement"doswitch(code)
case"whatever code value ":
{Insert whatever you value and quantity. Also formulas.}
case ....:
......
case -1: // your EoF value
cout<< whatever necessary values you need to insert.
while()
I'll be glad to answer any questions as long as you show that you are making an effort to try to learn =P