In: Computer Science
What is my code missing?
// chStr.cpp
// Put your name here
// Pseudocode
#include
#include <___>
#include
using namespace std;
const string ANAME = "Katia Kool";
const char AGRADE = 'A';
const double COMMISSION_RATE_A = 0.02625;
const ___; . . . // likewise, constants for Betty
int main()
{
int numberOfShares = 622; // number of shares
double pricePerShareA = 21.77; // price per share
double pricePerShareB = 12.44; // price per share
double stockA, stockB; // cost of stock, calculated
double commissionA, commissionB; // commission paid, calculated
double totalA, totalB; // total cost, calculated
// compute cost of the stock purchases
stockA = pricePerShareA * numberOfShares;
___;
// compute amount of the commissions
commissionA = stockA * COMMISSION_RATE_A;
___;
// compute total amounts
totalA = stockA + commissionA;
___;
// output results
cout << fixed << showpoint << setprecision(2); // format output
// your output should appear as below
return 0;
}
/* Output:
Name: Katia Kool Grade: A
Stock: $nnnnn.nn
Commission: $nnn.nn
Total: $nnnnn.nn
Name: Betty Boop Grade: B
Stock: $nnnnn.nn
Commission: $nnn.nn
Total: $nnnnn.nn */
#include<iostream>
#include <iomanip>
using namespace std;
const string ANAME = "Katia Kool";
const char AGRADE = 'A';
const double COMMISSION_RATE_A = 0.02625;
const string BNAME = "Betty Boop";
const char BGRADE = 'B';
const double COMMISSION_RATE_B = 0.02625;
int main()
{
int numberOfShares = 622; // number of shares
double pricePerShareA = 21.77; // price per share
double pricePerShareB = 12.44; // price per share
double stockA, stockB; // cost of stock, calculated
double commissionA, commissionB; // commission paid, calculated
double totalA, totalB; // total cost, calculated
// compute cost of the stock purchases
stockA = pricePerShareA * numberOfShares;
stockB = pricePerShareB * numberOfShares;
// compute amount of the commissions
commissionA = stockA * COMMISSION_RATE_A;
commissionB = stockB * COMMISSION_RATE_B;
// compute total amounts
totalA = stockA + commissionA;
totalB = stockB + commissionB;
// output results
cout << fixed << showpoint << setprecision(2);
// format output
cout<< "Name: " << ANAME
<<"\t"<<"Grade: "<< AGRADE <<endl;
cout<< "Stock: $"<< stockA <<
endl;
cout<< "Commission: $"<< commissionA
<< endl;
cout<< "Total: $"<< totalA <<
endl;
cout<< "Name: " << BNAME
<<"\t"<<"Grade: "<< BGRADE <<endl;
cout<< "Stock: $"<< stockB <<
endl;
cout<< "Commission: $"<< commissionB
<< endl;
cout<< "Total: $"<< totalB <<
endl;
// your output should appear as below
return 0;
}
Output:
Name: Katia Kool Grade: A
Stock: $13540.94
Commission: $355.45
Total: $13896.39
Name: Betty Boop Grade: B
Stock: $7737.68
Commission: $203.11
Total: $7940.79