Page 135 - CA_Blue( J )_Class10
P. 135
22 amt = (150 * 4.25)+(unit-150)*5.50;
23 else if(unit<=600)
24 amt = (150*4.25) + (200 * 5.50) + (unit-350)* 6.75;
25 else
26 amt = (150*4.25) + (200 * 5.50) + (250* 6.75) + (unit - 600) * 8;
27 System.out.println("\tBill for ABC Electricity Board");
28 System.out.println("Month of "+month);
29 System.out.println("Name of Consumer : "+ name);
30 System.out.println("Previous Meter Reading : "+ prv);
31 System.out.println("Current Meter Reading : "+cur);
32 System.out.println("Bill Amount : " + amt);
33 }
34 }
You will get the following output:
To input three valid sides of a triangle and print whether the triangle is Equilateral, Isosceles or
Program 2
Scalene. (In order to form a triangle the sum of any two sides should always be greater than the
third side.)
1 import java.util.*;
2 class triangle
3 {
4 public static void main()
5 {
6 Scanner sc = new Scanner(System.in);
7 int s1, s2, s3;
8
9 System.out.println("Enter three sides of triangle: ");
10 System.out.print("Side 1 : ");
11 s1=sc.nextInt();
133
Conditional Constructs in Java 133

