Data Structures Assignment

  • Status Closed
  • Budget $10 - $30 USD
  • Total Bids 39

Project Description

Write a program that computes an invoice for purchasing shares of stock.

A brokerage company has implemented policy to encourage investors to buy shares in even lots of

100. Therefore, the minimum order is 100 shares of stock. The commission charge for the first 100

shares is $2.55. An additional commission of 2 cents per share is charged for all shares over 100



The program must:

• Define an integer constant that holds the minimum number of shares that can be ordered.

• Define two floating point constants that will hold:

o The minimum order commission

o The commission for each share over the minimum order

• Define a string constant for the investor’s name – use YOUR name

(e.g., "Samantha Washington")

• Define two character constants for the investor’s initials – use YOUR initials

(e.g., 'S' and 'W')

• Define an integer variable to store the total number of shares purchased (read from the


• Define an floating point variable to store the cost of one share of stock (read from the user)

• Define two floating point variables to store parts of the total cost.

o The cost of all shares ordered

o The commission charged for additional shares over the minimum order

• Display a program description, followed by several prompts and input statements to read

the total number of shares purchased from the user, and the price per share.

o You may assume that the number of shares entered by the user will always be at least

as many as the minimum order requirement

Sample Input

Stock Purchase Invoice Program

Enter number of shares purchased: 176

Enter the price per share: [url removed, login to view]

• Calculate the three parts of the total cost.

• Add all of the above costs together to determine the total bill.

• Add any other variable definitions or calculation statements you think are needed to perform

the task

• Output statements to display the results to the console, in the following format:

Investor: Samantha Washington (SW)

Shares purchased: 176

Price per share: [url removed, login to view]

Cost for all shares [url removed, login to view]

Commission for minimum order [url removed, login to view]

Commission for additional shares [url removed, login to view]


Total Billed to Investor Account: [url removed, login to view]


o Display a few blank lines to separate the input from the output.

o The dollar figures in the totals column should all line up on the decimal point.

o If only the minimum number of shares is purchased,

the commission for additional shares will be 0.00.

Thank you for your help and I hope to hear from you soon.

Get free quotes for a project like this

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online