-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShopping.java
More file actions
25 lines (24 loc) · 800 Bytes
/
Copy pathShopping.java
File metadata and controls
25 lines (24 loc) · 800 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import java.util.Scanner;
public class Shopping{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String item;
int quantity;
double price;
double total;
char currency='$';
System.out.print("Enter product name : ");
item=sc.nextLine();
System.out.print("Enter quantity : ");
quantity=sc.nextInt();
System.out.print("Enter price : ");
price=sc.nextDouble();
total=quantity*price;
System.out.println("\n----- Bill summary -----\n");
System.out.println("Item name : "+item);
System.out.println("Quantity : "+quantity);
System.out.println("Price : "+price);
System.out.println("Total : "+currency+total);
sc.close();
}
}