In a super market Mr. Amir has purchased 3 quantities of the same item. The bill is computed using the below formula Bill = quantity * price per item Requirements: a) The quantity and price per item has to be captured b) The bill has to be computed using the above formula c) Bill has to displayed
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Quantity:");
int quantity = in.nextInt();
System.out.println("Price per item:");
double price = in.nextDouble();
System.out.println("Bill: " + quantity * price);
}
}
Comments
Leave a comment