Swati bought 600 shares of stock at a price of Rs 20 per share. She must pay her stock broker a 2% commission for the transaction.
Write a program that the display the following:
-The amount paid for the stock alone (without the commission)
-The amount of the commission
-The total amount paid
public class Main {
public static void main(String[] args) {
int sharesOfStock = 600;
System.out.println("The amount paid for the stock alone (without the commission): " + sharesOfStock * 20);
System.out.println("The amount of the commission: " + (sharesOfStock * 20) * 0.02);
System.out.println("The total amount paid: " + (sharesOfStock * 20) * 1.02);
}
}
Comments
Leave a comment