I have been tasked with the following:
I am new to programming. I need to create a program that tracks sales. The store owner wants to keep track of monthly sales.
Ask the user for the monthly income of the store (one question per month) keep the numbers input 0-50. Store all the info in an array.
Calculate the statistics (average, standard deviation, minimum sales and maximum sales for the year.
Output to the screen a text based graph that shows monthly sales for the year.
Sample graph:
*
* *
* * *
* * *
Jan (4) Feb(2) Mar (3)
(the astricks should be above the month in the graph...for some reason it's not showing that way here)
This is what I have done so far. I am getting undeclared identifier errors and a few "{" errors. Can someone help get me in the right direction?
// stub program 2 : with declared variables, no user inputs, variables echoed
#include "StdAfx.h"
#include <iostream>
using namespace std;
int main ()
{
//declaring int variables
int jan;feb;mar;apr;may;jun;jul;aug;sep;oct;nov;dec;minsale;maxsale;
double;sum1;sum2;avg;stdq;mean;
}
//cheating by declaring the initial values
{
jan=1 //initial value = 1
feb=2 //initial value = 2
mar=3 //initial value = 3
apr=4 //initial value = 4
may=5 //initial value = 5
jun=6 //initial value = 6
jul=7 //initial value = 7
aug=8 //initial value = 8
sep=9 //initial value = 9
oct=10 //initial value = 10
nov=11 //initial value = 11
dec=12 //initial value = 12
}
{
Set sum1=(jan+feb+mar+apr+may+jun+jul+aug+sep+oct+nov+dec); //initial value undetermined had we not cheated.
Set avg=sum1/12.0
Set stdq=sqrt((1.0/12.0)*double)sum)
Set minsale=jan; // We cheated :)
Set maxsale=dec; // we cheated :)
Set mean=(double)sum1/12; //initial value undetermined had we not cheated.
Set sum2=(jan-mean)*(jan-mean)+(feb-mean)*(feb-mean)+(mar-mean)*(mar-mean)+(apr-mean)*(apr-mean)+(may-mean)*(may-mean)+(jun-mean)*(jun-mean) +(jul-mean)*(jul-mean)+(aug-mean)*(aug-mean)+(sep-mean)*(sep-mean)+(oct-mean)*(oct-mean)+(nov-mean)*(nov-mean)+(dec-mean)*(dec-mean);
}
//echoing monthly values
{
cout << "jan:"jan; // prints jan and jan's value
cout << "feb:"feb; // prints feb and feb's value
cout << "mar:"mar; // prints mar and mar's value
cout << "apr:"apr; // prints apr and apr's value
cout << "may:"may; // prints may and may's value
cout << "jun:"jun; // prints jun and jun's value
cout << "jul:"jul; // prints jul and jul's value
cout << "aug:"aug; // prints aug and aug's value
cout << "sep:"sep; // prints sep and sep's value
cout << "oct:"oct; // prints oct and oct's value
cout << "nov:"nov; // prints nov and nov's value
cout << "dec:"dec; // prints dec and dec's value
}
//echoing double variable names and values
{
cout << "sum1="sum1;
cout << "avg="avg;
cout << "stdq="stdq;
cout << "minsale="minsale;
cout << "maxsale="maxsale;
cout << "mean="mean;
cout << "sum2="sum2;
}