Computer Science, asked by sourajitakar, 1 year ago

solve this programming in java language.

Attachments:

Answers

Answered by abhay1302
1
import java.util.Scanner
class Electricity
{
public static void main (String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter units");
int u=sc.nextInt();
double bill=0;
if(u<100)
{
bill=u*1.80;
}
else if(u>100 && u<300)
{
bill=100*1.80 + (u-100)*2.30;
}
else if(u>300 && u<=500)
{
bill=100*1.80 + 200*2.30 + (u-100)*2.80;
}
else
{
bill=100*1.80 + 200*2.30 + 200*2.80 + (u-500)*3.50;
}
Sopln(bill);
}
}






sourajitakar: it really helped me a lot...
abhay1302: :)
Similar questions