Computer Science, asked by milithegrate, 7 months ago

Please help me asap !!!

Attachments:

Answers

Answered by manuprajapati519
1

import java.util.Scanner;

public class bill

{

public static void main(String args[])

{

Scanner in = new Scanner(System.in);

double sum=0.0;long a=0; String name=""; int b=0; String month="";

System.out.println("Input your name");

name=in.nextLine();

System.out.println("Input your phone number");

a=in.nextLong();

System.out.println("Input the units consumed");

b= in.nextInt();

System.out.println("Input the month");

month= in.nextLine();

if(b>99)

{

sum=b*1.80;

}

else if(b>100||b>299)

{

sum=b*2.30;

}

else if(b>300||b>499)

{

sum=b*2.80;

}

else;

{

sum=b*3.50;

}

System.out.println("Your Name :" +name);

System.out.println("Your phone number :" +a);

System.out.println("The month :" +month);

System.out.println("The units consumed :" +b);

System.out.println("The total bill :" +sum);

}

}

Similar questions