Java Programming
Kathryn bought 10,000 shares of apple stock at a price of $83.80 per share. She must pay her stock broker a 2 percent commission for the transaction. Write a program that calculates and displays the following:
The amount paid for the stock alone ( without the commission)
The amount paid to her broker for commission.
The total amount the stock cost ( value of the stock plus the commission paid)
public class AppleStockShares { public static void main(String[] args) { int numShares = 10000; double price = 83.80; double totalPrice = numShares*price; double commision = totalPrice*0.02; System.out.println("The amount paid for the stock alone: "+totalPrice); System.out.println("The amount paid to her broker for commission: "+commision); System.out.println("The total amount the stock cost: "+(totalPrice+commision)); } }
Get Answers For Free
Most questions answered within 1 hours.