1. The following steps calculate the percentage profit from the sale of a stock. Convert the statements below to java code.
(a) Declare all variables as type Double.
(b) Ask user to input purchasePrice.
(c) Ask user to input sellingPrice.
(d) Assign, to the variable percentProfit, 100 times the value of the difference between sellingPrice and purchasePrice divided by purchasePrice.
Display the value of the variable percentProfit.
1
Expert's answer
2017-02-23T10:05:06-0500
import java.util.Scanner;
public class SaleOfStock { static double purchasePrice; static double sellingPrice; static double percentProfit;
Comments
Leave a comment