Question

In: Computer Science

What is my code missing? // chStr.cpp // Put your name here // Pseudocode #include #include...

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                  */

Solutions

Expert Solution

#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


Related Solutions

Write a pseudocode for the following code: /*every item has a name and a cost */...
Write a pseudocode for the following code: /*every item has a name and a cost */ public class Item {    private String name;    private double cost;    public Item(String name, double cost) {        this.name = name;        this.cost = cost;    }    public String getName() {        return name;    }    public void setName(String name) {        this.name = name;    }    public double getCost() {        return cost;...
C++ code Why my code is not compiling? :( #include <iostream> #include <iomanip> #include <string> using...
C++ code Why my code is not compiling? :( #include <iostream> #include <iomanip> #include <string> using namespace std; const int CWIDTH = 26; int main() {    int choice;    double convertFoC, converCtoF;    double starting, endvalue, incrementvalue;    const int CWIDTH = 13;    do {       cin >> choice;    switch (choice)    {        cin >> starting;    if (starting == 28){       cout << "Invalid range. Try again.";    }    while (!(cin >> starting)){       string  garbage;       cin.clear();       getline(cin, garbage);       cout << "Invalid data Type, must be a number....
Python I want to name my hero and my alien in my code how do I...
Python I want to name my hero and my alien in my code how do I do that: Keep in mind I don't want to change my code except to give the hero and alien a name import random class Hero:     def __init__(self,ammo,health):         self.ammo=ammo         self.health=health     def blast(self):         print("The Hero blasts an Alien!")         if self.ammo>0:             self.ammo-=1             return True         else:             print("Oh no! Hero is out of ammo.")             return False     def...
In Java please. I put down my code and what I was able to achieve so...
In Java please. I put down my code and what I was able to achieve so far: public class Animal {   private String gender; //stores the gender of the animal    private String type; //stores the type of the animal(bear of fish)    private int strength; //stores the strength of the animal    public Animal() {        gender = "none";        type = "none";        strength = 0;    }        public Animal (String g, String...
Complete the Vec class to make it similar to the vector. sample code here. #include #include...
Complete the Vec class to make it similar to the vector. sample code here. #include #include #include #include #include using namespace std; int get_mode( vector vec ) { int numbers[101] = {0}; for ( int e : vec ) numbers[e]++; int greatest = 0, n = 0; for ( int i = 0; i <= 100; i++ ) { if ( numbers[i] > greatest ) { greatest = numbers[i]; n = i; } } return n; } const double g...
In which folder of XAMPP would I put in my PHP code
In which folder of XAMPP would I put in my PHP code
Design (pseudocode) and implement (source code) a program (name it DistinctValues) to display only district values...
Design (pseudocode) and implement (source code) a program (name it DistinctValues) to display only district values in an array. The program main method defines a single-dimensional array of size 10 elements and prompts the user to enter 10 integers to initialize the array. The main method then calls method getValues() that takes an integer array and returns another single-dimensional array containing only distinct values in the original (passed) array. Document your code and properly label the input prompts and the...
Here is my fibonacci code using pthreads. When I run the code, I am asked for...
Here is my fibonacci code using pthreads. When I run the code, I am asked for a number; however, when I enter in a number, I get my error message of "invalid character." ALSO, if I enter "55" as a number, my code automatically terminates to 0. I copied my code below. PLEASE HELP WITH THE ERROR!!! #include #include #include #include #include int shared_data[10000]; void *fibonacci_thread(void* params); void parent(int* numbers); int main() {    int numbers = 0; //user input....
Using the pseudocode found below, write only the actual (C++) code for this program. Include all...
Using the pseudocode found below, write only the actual (C++) code for this program. Include all libraries. Specification: Write a program that will repeatedly ask the user for quiz grades in the range from 0 to 20. Any negative value will act as a sentinel. When the sentinel is entered compute the average of the grades entered. Design: Constants None Variables float grade float total = 0 int count = 0 float average ------- Inital Algorithm Repeatedly ask user for...
Post your article here and include the following information in your post: 1. What is the...
Post your article here and include the following information in your post: 1. What is the article about? 2. What did you learn? 3. How does it relate to the readings from the book this week? This discussion for the class BU 491Management Issues and Society
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT