Ok so i did my program down to the letter but now i need to incorporate Functions to find the cost for each cargo category but can only use ONE function.
I know its probably simple but can someone help me.
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
int main ()
{
// variables for company name, order input, costs and captian name
const string companyName="Student's name Here";
int fuelPod, protonAmmo, jetpack, oxygen, idNumber=1;
double fuelCost=125.50, fuelPodTotal, ammoCost=17.20, ammoTotal, jetpackCost=99.00,jetpackTotal, oxygenCost=50.40, oxygenTotal, totalCost;
string captian;
//display company welcome prompt
cout << "Welcome to " << companyName << " Space Travel Company." << endl;
//begin while loop for data input and display
//prompt for spaceship number
cout << "Please enter Spaceship Identification or -999 to Terminate: " ;
//read in number, terminate if -999
cin >> idNumber;
while (idNumber!=-999)
{
//read in captian name, fuel pod, proton cannon ammon, jetpack and oxygen order
cin.ignore();
cout << "Please Enter the Captain's Name: ";
getline(cin,captian);
cout << "Please Enter Fuel Pod Sales: ";
cin >> fuelPod;
cout << "Please enter Proton Cannon Ammo Sales: ";
cin >> protonAmmo;
cout << "Please enter Jetpack Sales: ";
cin >> jetpack;
cout << "Please enter Oxygen Sales: ";
cin >> oxygen;
cout <<endl;
//display sales statement header, spaceship ID number and captians name
cout << companyName << " Space Travel Company Sales Statement." <<endl;
cout << "Spaceship Identification Number "<<idNumber<<endl;
cout << "Captain's Name: "<<captian<<endl;
cout << "*************************************************"<<endl;
// assignment statements for cost of fuelpod,proton cannon ammon, jetpack and oxygen and total cost
fuelPodTotal=fuelPod*fuelCost;
ammoTotal=(static_cast<double>(protonAmmo/100.00))*ammoCost;
jetpackTotal=jetpack*jetpackCost;
oxygenTotal=oxygen*oxygenCost;
totalCost=fuelPodTotal+ammoTotal+jetpackTotal+oxygenTotal;
// display subtotal for 4 items ordered and total cost of all items
cout << fixed <<setprecision(2)<<showpoint;