//Programmer's Name: Bolong Yu
//Program: Practice
//Grade:
//Comments:
//
//-----------------------------------------------------------------------------
//Programmer's Name: Bolong Yu
//Program: Practice
//Program Flow (IPO):
//Output a header to the screen
//Assign the value for the quantity on hand
//Calculate the quantity to order
//Output the quantity to order
//Assign values for the 4 costs
//Calculate the total cost and the average cost
//Output the 4 costs and the total cost and
// the average cost to the screen
//Assign the first initial and last initial
//Output the first initial and last initial to the screen.
//Assign the first name and last name
//Output the first name and last name to the screen
//-----------------------------------------------------------------------------
//For input and output on the screen
#include <iostream>
//For using the string data type
#include <string>
using namespace std;
const int QUANTITY_REQUIRED = 200;
const int NUMBER_OF_ITEMS = 4;
const string COLLEGE = "SUNY Broome Community College";
const string MY_NAME = "Bolong Yu";
int main(void)
{
int quantityOnHand;
int quantityToOrder;
double cost1;
double cost2;
double cost3;
double cost4;
double totalCost;
double averageCost;
char firstInitial;
char lastInitial;
string firstName;
string lastName;
//Output the programmer's name and College to the screen
cout << "-----------------------------------------------------------------"
<< endl;
cout << COLLEGE << endl;
cout << MY_NAME << endl;
cout << "Output from the practice" << endl;
cout << "-----------------------------------------------------------------"
<< endl;
//Assign the quantity on hand
quantityOnHand = 66;
//Calculate the quantity to order
quantityToOrder = QUANTITY_REQUIRED - quantityOnHand;
//Output quantity on hand and quantity to order to the screen
cout << "The current quantity on hand is " << quantityOnHand << endl;
cout << "The quantity to order is " << quantityToOrder << endl;
cout << "-----------------------------------------------------------------"
<< endl;
//Set the cost of the 4 purchases
cost1 = 12.50;
cost2 = 200.45;
cost3 = 1200.39;
cost4 = 39.99;
//Calculate the total cost
totalCost = cost1 + cost2 + cost3 + cost4;
//Calculate the average cost
averageCost = totalCost / NUMBER_OF_ITEMS;
//Output the costs of the 4 items to the screen
cout << "Cost of Item 1 is " << cost1 << endl;
cout << "Cost of Item 2 is " << cost2 << endl;
cout << "Cost of Item 3 is " << cost3 << endl;
cout << "Cost of Item 4 is " << cost4 << endl;
cout << endl;
//Output the total and average of the 4 items purchased to the screen.
cout << "-----------------------------------------------------------------"
<< endl;
cout << "Total Cost is " << totalCost << endl;
cout << "Average Cost is " << averageCost << endl;
cout << "-----------------------------------------------------------------"
<< endl;
//Assign the first and last initial
firstInitial = 'C';
lastInitial = 'S';
//Output the two initials to the screen
cout << "The two initials are: " << firstInitial << '.'
<< lastInitial << '.' << endl;
cout << "-----------------------------------------------------------------"
<< endl;
//Assign the name
firstName = "Bolong";
lastName = "Yu";
//Output the name to the screen
cout << "The name is " << firstName << ' ' << lastName << endl;
cout << "-----------------------------------------------------------------"
<< endl;
return 0;
}