solve this programming in java language.
Attachments:
Answers
Answered by
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);
}
}
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...
Similar questions
English,
8 months ago
Math,
8 months ago
English,
8 months ago
Social Sciences,
1 year ago
Social Sciences,
1 year ago
Science,
1 year ago
Math,
1 year ago