Wap in Java to accept the total units consumed by the customer and calculate the bill.Assume that a metre into rupees 500 discharge from the customer.
Attachments:
Answers
Answered by
0
Program :
import java.util.*;
public class MyClass
{
public static void main(String args[])
{
Scanner Sc = new Scanner(System.in);
double Amount , units;
System.out.print("Enter total units consumed : ");
units = Sc.nextDouble();
if(units <= 100)
{
Amount = 500 + (units * 0.80);
}
else if(units > 100 && units <= 300)
{
Amount = 500 + (100 * 0.80) + ((units - 100) * 1);
}
else
{
Amount = 500 + (100 * 0.80) + (200 * 1) + ((units - 300) * 2.50);
}
System.out.print("Bill : " + Amount);
}
}
Similar questions
Physics,
1 month ago
Math,
1 month ago
CBSE BOARD X,
2 months ago
CBSE BOARD X,
2 months ago
Physics,
9 months ago
Biology,
9 months ago