import javax.swing.JOptionPane; public class Exam2MAY { public static void main(String[] args) { String productName; String modelNum; String productPrice; String productQuantity; String differentProducts; int loopCount = 0; int grossRevenueAll; differentProducts = JOptionPane.showInputDialog(null,"How many products will you enter? (Keep under 5)"); do { productName = JOptionPane.showInputDialog(null,"Enter the name of the product."); modelNum = JOptionPane.showInputDialog(null,"What is the model number?"); productPrice = JOptionPane.showInputDialog(null,"What is the price of the product? $"); productQuantity = JOptionPane.showInputDialog(null,"What is the quantity of sold product this week"); int otherProducts = Integer.parseInt(differentProducts); double price = Double.parseDouble(productPrice); double quantity = Double.parseDouble(productQuantity); double grossPrice = price * quantity; loopCount = otherProducts; System.out.println("Product name :" + productName); System.out.println("Model number :" + modelNum); System.out.println("Product price :" + productName); System.out.println("Product quantity :" + productQuantity); System.out.println("Gross revenue : $" + grossPrice); ++ loop; grossRevenueAll(loop) = price; } while(loopCount < 5); System.exit(0); int currentProduct = loopCount; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)