-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClassActivityproject.java
More file actions
48 lines (31 loc) · 1.18 KB
/
Copy pathClassActivityproject.java
File metadata and controls
48 lines (31 loc) · 1.18 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import java.util.Scanner;
public class ClassActivityproject {
public static void main(String[] args) {
// TODO Auto-generated method stub
int total=0;
int quantity=0;
int price=0;
String name = "";
// we can make fixe price for each item in store and then use if and if else for each item, use quntity and price for
//each item seprately then at the encd do total
Scanner keyboard= new Scanner(System.in);
String answer = "Yes";
while(answer.equalsIgnoreCase("yes"))
{
System.out.println("What Item you want");
name = keyboard.next();
System.out.println("price is");
price = keyboard.nextInt();
System.out.println("how much quantity?");
quantity = keyboard.nextInt();
System.out.println("My item is " + name + " and my quantity is " + quantity+ "my price is" + price);
System.out.println("Do you want to continue?");
answer = keyboard.next();
//if(!(answer.equalsIgnoreCase("yes")))
total=total+(quantity*price);
// break; break not needed for while
}
System.out.println(total);
keyboard.close();
}
}