Skip to content

Commit 839f056

Browse files
Initial Commit
1 parent 4888a37 commit 839f056

1 file changed

Lines changed: 70 additions & 0 deletions

File tree

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/**
2+
*
3+
*/
4+
package in.exam.ice;
5+
6+
import in.exam.util.*;
7+
import java.util.Scanner;
8+
9+
/**
10+
* @author M.NAVEEN
11+
* RANDOM CODER'S
12+
* Tech/Project Lead Android Club
13+
*/
14+
public class IceCream {
15+
16+
17+
private String flavor;
18+
private int scoops;
19+
private final double PRICE_PER_SCOOP;//PRICE_PER_SCOOP=25 so fine
20+
21+
22+
public IceCream() {
23+
super();
24+
PRICE_PER_SCOOP = 25d;
25+
}
26+
27+
28+
public String getFlavor() {
29+
return flavor;
30+
}
31+
32+
33+
public void setFlavor(String flavor) {
34+
this.flavor = flavor;
35+
}
36+
37+
38+
public int getScoops() {
39+
return scoops;
40+
}
41+
42+
43+
public void setScoops(int scoops) {
44+
this.scoops = scoops;
45+
}
46+
47+
public double getPRICE_PER_SCOOP() {
48+
return PRICE_PER_SCOOP;
49+
}
50+
51+
52+
public void getIceCream() throws IceCreamFlavorException,IceCreamScoopException {
53+
Scanner nav=new Scanner(System.in);
54+
System.out.print("Enter the ice cream flavor :");
55+
flavor =nav.nextLine();
56+
System.out.println("Enter the no. of scoops :");
57+
scoops=nav.nextInt();
58+
59+
if(flavor.equalsIgnoreCase("Black Current")) {
60+
throw new IceCreamFlavorException () ;
61+
}
62+
63+
if(scoops>3) {
64+
throw new IceCreamScoopException ();
65+
}
66+
System.out.println("Enjoy the Strawberry ice cream "+getFlavor() +" Please pay Rs "+25*scoops);
67+
68+
}
69+
}
70+

0 commit comments

Comments
 (0)