Page 481 - CA_Blue( J )_Class10
P. 481
37 private void calculate() // Private method to be called
from display method
38 {
39 if(price<=10000)
40 dis=0.05*price;
41 else
42 if(price<=20000)
43 dis=0.1*price;
44 else
45 if(price<=35000)
46 dis=0.15*price;
47 else
48 dis=0.2*price;
49 bill=price-dis;
50 }
51
52 void display()
53 {
54 calculate();
55 System.out.println("...................Object Number "+ count+
"......................");
56 System.out.println("customer name" + " " + "mobile" + " " + "price" +" "
+ "discount" + " " + "Amount");
57 System.out.println(cusname + " " + mobile + " " + price +" " + dis + " "
+ bill);
58 }
59 public static void main()
60 {
61 Scanner sc = new Scanner(System.in);
62 String na;
63 long mo;
64 double pr;
65 System.out.println("Enter name , mobno and price");
66 na = sc.next();
67 mo = sc.nextLong();
68 pr = sc.nextDouble();
479
Internal Assessment 479

