Java Program Billing System According to Units Using `util` Package
import java.util.Scanner;
class HESCOBill{
public static void main(String[]args) throws Exception{
Scanner s = new Scanner(System.in);
System.out.print(" Enter Units ");
String bill = s.nextLine();
int units = Integer.parseInt(bill);
if( units >= 1 && units <=100 )
System.out.print("Your bill is " + units * 2 );
if( units > 100 && units <=200 )
System.out.print("Your bill is " + units * 4 );
if( units > 200 && units <= 300 )
System.out.print("Your bill is " + units * 6 );
if( units > 300 && units <= 400 )
System.out.print("Your bill is " + units * 8 );
if( units > 400 )
System.out.print("Your bill is " + units * 10 );
}
}
No comments:
Post a Comment