class Charge
{
public static void main(String[] args)
{
float p;
int units=Integer.parseInt(System.console().readLine("enter the units="));
String userName=System.console().readLine("entr the user name=");
if(units<=100)
{
p=units*.4f;
System.out.println("rs="+p);
}
else
{
if((units>100)&&(units<=300))
{
p=(100*.40f)+((units-100)*.50f);
System.out.println("rs="+p);
}
else
{
p=(100*(40/100f))+(200*(50/100f))+((units-300)*(60/100f));
System.out.println("rs="+p);
}
}
if(p>250)
{
p=p+p*(15/100f);
System.out.println("Bill="+p);
}
System.out.println("userName="+userName+" & Bill="+p);
}
}
what is f
ReplyDeleteIs the program correct??
ReplyDelete