write a program in Java to complete monthly bill to be paid according to the given condition.
CALLS MADE. RATE
UP TO 100 CALLS. NO CHARGE
FOR THE NEXT 100 CALLS. 90PAISE/CALL
FOR THE NEXT 200 CALLS. 80PAISE/CALL
MORE THAN 400 CALLS. 70PAISE/CALL
HOWEVER, EVERY CUSTOMER HAS TO PAY 180/MONTH AS MONTHLY RENT FOR THE SERVICE. DISPLAY THE NAME OF THE CUSTOMER, CALLS MADE AND AMOUNT TO BE PAID.
SOLVE USING SCANNER CLASS ONLY
Answers
Answer:
To make it more realistic, I even added G.S.T. price. If you don't like it you can just erase the particular code. Hope you like it !!!
(P.S. - Please mark as Brainliest if you like it)
Explanation:
import java.util.Scanner;
class Input
{
Scanner sc = new Scanner (System.in);
int call,rate;
double gst;
String name;
void enter()
{
System.out.println("Enter name of the customer :");
String name = sc.nextLine();
System.out.println("Enter number of calls");
call=sc.nextInt();
gst=call*(0.15);
if(call<=100)
{
System.out.println("Name of the customer is : "+name);
System.out.println("No charge");
System.out.println("Monthly cost : "+180);
System.out.println("GST : Rs."+gst);
System.out.println("Total amount : "+(180+gst));
}
if(call>100&&call<=200)
{
rate=90*call+180;
System.out.println("Name of the customer is : "+name);
System.out.println("The charge is (including monthly) : "+rate);
System.out.println("GST : Rs."+gst);
System.out.println("Total amount : "+(rate+gst));
}
if(call>200&&call<400)
{
rate=80*call+180;
System.out.println("Name of the customer is : "+name);
System.out.println("The charge is (including monthly) : "+rate);
System.out.println("GST : Rs."+gst);
System.out.println("Total amount : "+(rate+gst));
}
if(call>400)
{
rate=70*call+180;
System.out.println("Name of the customer is : "+name);
System.out.println("The charge is (including monthly) : "+rate);
System.out.println("GST : Rs."+gst);
System.out.println("Total amount : "+(rate+gst));
}
}
}
public class Call_bill
{
public static void main (String [] args)
{
Scanner sc = new Scanner(System.in);
Input a1 = new Input();
a1.enter();
}
}