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

Replace <missing value> and <missing code> with your answers. Your code should compute the factorial of...
Replace <missing value> and <missing code> with your answers. Your code should compute the factorial of n. For example, if n = 5, your code should compute the following 5 * 4 * 3 * 2 * 1 (which is 120). public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int factorial = <missing value>; <missing code> System.out.println("factorial = " + factorial);
Develop and pseudocode for the code below: #include <algorithm> #include <iostream> #include <time.h> #include "CSVparser.hpp" using...
Develop and pseudocode for the code below: #include <algorithm> #include <iostream> #include <time.h> #include "CSVparser.hpp" using namespace std; //============================================================================ // Global definitions visible to all methods and classes //============================================================================ // forward declarations double strToDouble(string str, char ch); // define a structure to hold bid information struct Bid { string bidId; // unique identifier string title; string fund; double amount; Bid() { amount = 0.0; } }; //============================================================================ // Static methods used for testing //============================================================================ /** * Display the bid information...
I get an error in my code, here is the prompt and code along with the...
I get an error in my code, here is the prompt and code along with the error. Write a spell checking program (java) which uses a dictionary of words (input by the user as a string) to find misspelled words in a second string, the test string. Your program should prompt the user for the input string and the dictionary string. A valid dictionary string contains an alphabetized list of words. Functional requirements: For each word in the input string,...
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....
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;...
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...
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...
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...
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
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT