Question

(25) Katia Kool bought 622 shares of a Grade A stock at $21.77 per share and...

(25) Katia Kool bought 622 shares of a Grade A stock at $21.77 per share and she must pay her broker 2.625% commission on the transaction. Betty Boop bought 622 shares of a Grade B stock at $12.44 per share and she must pay her broker 2.125% commission on the transaction. Design (write your pseudocode), code, and test a program that calculates and displays for each transaction 1) the client name and Grade of stock, 2) the amount paid for the stock, 3) the amount of the commission, and 4) the total amount paid (stock cost plus commission). Use constant string type for the names, constant char type for the Grade of stock, and constant double type for the commission rates.

Given this information and the following pieces of code How would I complete the code?

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

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Description:

This is a simple practice problem. Constant can be declared using const modifier. Constant for Client "Betty" can be declared as:
// constants for Betty
const string BNAME = "Betty Boop";
const char BGRADE = 'B';
const double COMMISSION_RATE_B = 0.02125;

Computation for client Katia is already made in the program. So following the same code you have to write code Clint Betty.

Solution:

Copy able code:

// chStr.cpp
// Put your name here
// Pseudocode

#include <iostream>
#include <string>
#include <iomanip>

using namespace std;

//constants for Katia
const string ANAME = "Katia Kool";
const char AGRADE = 'A';
const double COMMISSION_RATE_A = 0.02625;

// constants for Betty
const string BNAME = "Betty Boop";
const char BGRADE = 'B';
const double COMMISSION_RATE_B = 0.02125;

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

   // Output for Katia
   cout << "Name: " << ANAME << "\tGrade: " << AGRADE << endl;
   cout << "Stock: $" << stockA << endl;
   cout << "Commission: $" << commissionA << endl;
   cout << "Total: $" << totalA << endl;

   cout << endl;

   // Output for Betty
   cout << "Name: " << BNAME << "\tGrade: " << BGRADE << endl;
   cout << "Stock: $" << stockB << endl;
   cout << "Commission: $" << commissionB << endl;
   cout << "Total: $" << totalB << endl;

   return 0;
}

Screenshots of code:

Output:

Add a comment
Know the answer?
Add Answer to:
(25) Katia Kool bought 622 shares of a Grade A stock at $21.77 per share and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • A company purchases 500 shares of $25 par value common stock for $43 per share. In...

    A company purchases 500 shares of $25 par value common stock for $43 per share. In addition, the broker charges a commission of $750. 100 of these shares are sold for $49.00 per share. The broker charges a commission of $50 for this sale. What is the amount of gain or loss on the sale? $600 gain $600 loss $9,250 loss $12,750 gain

  • Diana bought 1,500 shares of Dalton Protection, Inc., common stock for $10 per share. She paid...

    Diana bought 1,500 shares of Dalton Protection, Inc., common stock for $10 per share. She paid her broker a $300 commission to close the purchase. The following year, Diana sold 1,000 of the shares for $17 per share and paid a commission of $175 on the sale. What is Diana's capital gain on the sale of the stock?

  • Problem Statement Last month Tian purchased some stock in Acme Software, Inc. Here are the details...

    Problem Statement Last month Tian purchased some stock in Acme Software, Inc. Here are the details of the purchase:  The number of shares that Tian purchased was 1,000  When Tian purchased the stock, he paid $33.92 per share  Tian paid his stockbroker a commission that amounted to 2% of the amount he paid for the stock. One week later, Tian sold the stock. Here are the details of the sale: The number of shares sold was 1,000...

  • 23 You bought 100 shares of a stock at S52 per share. After 240 days, you...

    23 You bought 100 shares of a stock at S52 per share. After 240 days, you decide to sell the stock. By this time, the stock had gone up and was now worth $58.50 per share. You are dealing with a brokerage firm that charges a commission of $49 plus 0.8% of transaction amounts between $2,500 and $9.999. Determine the annual rate of interest you've earned on this investment

  • Last year you sold short 350 shares of stock selling at $70 per share. Six months...

    Last year you sold short 350 shares of stock selling at $70 per share. Six months later the stock had fallen to $55 per share. Over the 6-month period the company paid out two dividends of $1.25 per share. Your total commission cost for buying and selling the shares came to $150. Determine your profit or loss from this transaction.

  • Abby purchased 100 shares of her father’s favorite stock for $27 per share exactly 1 year...

    Abby purchased 100 shares of her father’s favorite stock for $27 per share exactly 1 year ago, commission free. She sold it today for a total amount of $3200. She plans to invest the entire amount in a different corporation’s stock today, but she must now pay a $30 commission fee. If she plans to sell this new stock exactly 1 year from now and realize the same return as she has just made, what must be the total amount...

  • Abby purchased 100 shares of her father's favorite stock for $26 per share exactly 1 year...

    Abby purchased 100 shares of her father's favorite stock for $26 per share exactly 1 year ago, commission free. She sold it today for a total amount of $3200. She plans to invest the entire amount in a different corporation's stock today, but she must now pay a $45 commission fee. If she plans to sell this new stock exactly 1 year from now and realize the same return as she has just made, what must be the total amount...

  • You short sold 700 shares of a stock at $25 a share. The initial margin requirement...

    You short sold 700 shares of a stock at $25 a share. The initial margin requirement is 75 percent and the maintenance margin is 35 percent. What is the amount of your total liability for this transaction as initially shown on your account balance sheet?

  • need code for this in java Design a set of classes that work together to simulate the Stock Transaction System. You should design the following classes: 1. the StockMarket class. This class si...

    need code for this in java Design a set of classes that work together to simulate the Stock Transaction System. You should design the following classes: 1. the StockMarket class. This class simulates the stock market such as Nasdaq, NYSD, or other stock market. The class's responsibility are as follows: -To know the stock market abbreviation, full name, location, an arraylist of stocks for this market 2. the Company class: this class simulates a company that has stock released on...

  • 201: Lab A 1. Download Eclipse onto your computer 2. Please follow this link if you are having trouble in installing Ecl...

    201: Lab A 1. Download Eclipse onto your computer 2. Please follow this link if you are having trouble in installing Eclipse. https://www.youtube.com/watch?v=TXbuATMlVNY&index=19&list=PL_v5Vo_UXw aHWOr2I9dq7DxI6Iw3eQzOd 3. Sample code #include <iostream> using namespace std; int main () { cout << "Hello world\n"; return 0; } Problem 2-1: Write a program that ask the user for the flowing: How many shares to be bought: The price per share: Percent commission for the broker for each transaction: Average annual return as of percentage: The...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT