Question

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
He sold the stock for $36.78 per share
He paid his stockbroker another commission that amounted to 2% of the amount he received for the stock.

Please write a program that displays the following information:

 The amount of money Tian paid for the stock.

 The amount of commission Tian paid his broker when he bought the stock.

 The amount that Tian sold the stock for.

 The amount of commission Tian paid his broker when he sold the stock

 Display the amount of profit that Tian made after selling his stock and paying the two

commissions to his broker (If the amount of profit that your program displays is a negative number , then Tian lost money on the transaction)

This what i have done. Please if you have any suggestion to make it perfect.

import java.util.Scanner;

public class Stock{
   public static void main(String[]args) {
   Scanner keyboard = new Scanner(System.in);
  
// named constants
String Name="Tian"; //The Name of the user
int Num_Share_Buy= //Number of Buying Shares
int Num_Share_Sold=1000; // Number of Selling Shares
double Sale_Price=33.92; //Selling price per share
double Purchase_Price=36.78; //Purchase price per share
double Commission_Rate=0.02; //Broker commission rate
            
//read and display the user name
System.out.println("Please enter your name: " );
Name= keyboard.nextLine();

//read and display The number of shares the user want to buy
System.out.println("The number of share you want to purchase: " );
Num_Share_Buy=keyboard.nextInt();
      
//Read and display purchase price for stock
System.out.println("Purchase price: ");
Purchase_Price=keyboard.nextDouble();
      
//Display the number of shares the user want to sell
System.out.println("The number of shares you want to sell: ");
Num_Share_Sold=keyboard.nextInt();
      
//Display sold price for stock
System.out.println("Sold price: ");
Sale_Price=keyboard.nextDouble();
      
double TotalAmountReceived=Num_Share_Sold*Sale_Price;
double TotalAmountPaid=Num_Share_Buy*Purchase_Price;
      
//Calculate the brokers commission
double PurchaseCommission=(Num_Share_Buy * Purchase_Price)*Commission_Rate;

      
//Calculate the brokers commission on a sale
double SellingCommission=(Num_Share_Sold * Sale_Price)*Commission_Rate;
      
//calculate a profit
double Profit=(TotalAmountReceived-TotalAmountPaid)-(SellingCommission+PurchaseCommission);
      
//Display
System.out.print(Name+" has purchased " +Num_Share_Buy+" at $" +Purchase_Price+" and then sold "+Num_Share_Sold+" at $"+Sale_Price+".\t");
System.out.print("He paid $"+PurchaseCommission+" for broker fee\nwhen buying the stock and $"+SellingCommission+" for broker fee when selling the stock.\t");
System.out.print("So his profit is $"+Profit+"\nGood bye");
      
keyboard.close();
      
}
}

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
Problem Statement Last month Tian purchased some stock in Acme Software, Inc. Here are the details...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • Last month Joe purchased some stock in Acme Software, Inc. Here are the details of the...

    Last month Joe purchased some stock in Acme Software, Inc. Here are the details of the purchase: The number of shares that Joe purchased was 1,000. When Joe purchased the stock, he paid $45.50 per share. Joe paid his stockbroker a commission that amounted to 2% of the amount he paid for the stock Two weeks later Joe sold the stock. Here are the details of the sale: The number of shares that Joe sold was 1,000. He sold the...

  • 10. Stock Transaction Program 18pts Last month Joe purchased some stock in Acme Software, Inc. Here...

    10. Stock Transaction Program 18pts Last month Joe purchased some stock in Acme Software, Inc. Here are the details of the purchase: • The number of shares that Joe purchased was 1,000. • When Joe purchased the stock, he paid $32.87 per share. • Joe paid his stockbroker a commission that amounted to 2 percent of the amount he paid for the stock. Two weeks later Joe sold the stock. Here are the details of the sale: • The number...

  • (PYTHON) Stock Transaction Program Last month Joe purchased some stock from StockTrade.   1. Write a function(s)...

    (PYTHON) Stock Transaction Program Last month Joe purchased some stock from StockTrade.   1. Write a function(s) to allow the user to input the followings: ·The name of the stock ·Number of shares Joe bought · Stock purchase price · Stock selling price ·Broker commission 2. Write function(s) to calculate: and: · The amount of money Joe paid for the stock (number of shares bought * purchase price) · The amount of commission Joe paid his broker when he bought the...

  • Please take a screenshot or picture of work done in the PYTHON SHELL to see steps....

    Please take a screenshot or picture of work done in the PYTHON SHELL to see steps. Thank you. • Make sure to test your program before submit. Last month, Joe purchased some stock in Acme Software, Inc. Here are the details of the purchase: • The number of shares that Joe purchased was 2000. • When Joe purchased the stock, he paid $40.00 per share. • Joe paid his stockbroker a commission that amounted to 3 percent of the amount...

  • Please use C++ only CSIT163 Project 1 - Taking Stock Recently, Joe Btfsplk purchased some stock...

    Please use C++ only CSIT163 Project 1 - Taking Stock Recently, Joe Btfsplk purchased some stock in Acme Software, Inc. The details of the purchase are as follows: • 1,000 shares at $32.87 per share. • The stockbroker received $5 dollars plus a commission of 2% of the total purchase. Should he decide to sell, the stockbroker receives $5 dollars plus a commission of 2% of the total sale. Feeling jittery, Joe is considering selling the stock. The only thing...

  • With a partner, use the problem solving approach covered on day 1. Write out an algorithm...

    With a partner, use the problem solving approach covered on day 1. Write out an algorithm on paper along with hand calculations to determine expected output. Add onto the algorithm from Problem Solving Challenge 1. Kathryn bought 750 shares of Microsoft Corporation (MSFT) stock at a price of $70.43 per share. She must pay her stock broker a 2% commission for the transaction. The algorithm should calculate and display the following: 1. The number of shares and stock symbol. 2....

  • (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...

  • Bill Campbell invested $3,400 and borrowed $3,400 to purchase shares in Kellogg. At the time of...

    Bill Campbell invested $3,400 and borrowed $3,400 to purchase shares in Kellogg. At the time of his investment, Kellogg stock was selling for $52 a share. (a) If Bill paid a $55 commission, how many shares could he buy if he used his $3,400 and borrowed $3,400 on margin to buy Kellogg stock? (Round your answer to 2 decimal places.) Number of shares= (b) Assuming Bill did use margin, paid a $91 total commission to sell his Kellogg stock, and...

  • Bob Orleans invested $3.000 and borrowed $3,000 to purchase shares in Verizon Communications. At the time...

    Bob Orleans invested $3.000 and borrowed $3,000 to purchase shares in Verizon Communications. At the time of his investment Verizon was selling for $47 a share a. Bob paid a commission of $30, how many shares could he buy if he used only his own money and did not use margin? (Round your answer to 1 decimal place.) Number of shares b. Bob paid a commission of 560, how many shares could he buy if he used his $3,000 and...

  • I need help with using the infile and outfile operations in C++... Here's my assignment requirements:...

    I need help with using the infile and outfile operations in C++... Here's my assignment requirements: Assignment: Cindy uses the services of a brokerage firm to buy and sell stocks. The firm charges 1.5% service charges on the total amount for each transaction, buy or sell. When Cindy sells stocks, she would like to know if she gained or lost on a particular investment. Write a program that allows Cindy to read input from a file called Stock.txt: 1. 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
ADVERTISEMENT