Page 309 - IT-802_class_12
P. 309
double amt_payable;
Scanner sc = new Scanner(System.in);
System.out.print(“Enter the Customer iD: “);
c_iD = sc.next();
System.out.print(“Enter the Customer Name: “);
c_Name = sc.next();
System.out.print(“Enter the previous Reading: “);
o_Reading = sc.nextint();
System.out.print(“Enter the present Reading: “);
c_Reading = sc.nextint();
if (o_Reading > c_Reading)
{
System.out.println(“previous reading cannot be greater than the
present reading”);
System.out.println(“Exiting...”);
System.exit(0);
}
u_Consumed = c_Reading - o_Reading;
if (u_Consumed <= 100)
amount = u_Consumed * 2.25;
else
amount = 225 +((u_Consumed - 100) * 3.75);
s_Tax = amount * 10.5 / 100;
amt_payable = min_amt + amount + s_Tax;
System.out.println(“\n\t@@@@@@@@@@@@@@@@@@@@@@@@@@@@@”);
System.out.println(“\n\tXyz power Corporation Limited”);
System.out.println(“\t\tNew Delhi\n”);
System.out.println(“\t@@@@@@@@@@@@@@@@@@@@@@@@@@@@@”);
System.out.println(“_____________________________________________”);
System.out.println(“Customer iD :”+c_iD);
System.out.println(“Customer Name :”+c_Name);
System.out.println(“previous meter Reading :”+o_Reading);
System.out.println(“present meter Reading :”+c_Reading);
System.out.println(“Total Units Consumed :”+u_Consumed);
System.out.println(“Fixed Amount & maintenance Charges :Rs.”+min_amt);
System.out.println(“Total Amount :Rs.”+(int)amount);
System.out.println(“Tax (10.5%) :Rs.”+(int)s_Tax);
System.out.println(“_____________________________________________”);
System.out.println(“Amount payable :Rs.”+(int)amt_payable);
System.out.println(“_____________________________________________”);
}
}
Projects 307

