Write a program to find the Phone Bill of the using if else statement in java ?


Hii everyone, here we are going to construct a  program on phone bill. The billing in this program is based on call minutes.We made some of the conditions to calculate the monthly phone bill. Our first condition is user should pay Rs. 50 up to 99 calls, then 50 paise will be charged above then 99 calls and up to 199 calls, again 75 paise will be charged above than 199 calls and up to 299 calls, and more than 300 calls the charges will be applied as Rs. 1 for each call.

Description Of Program:

First of all, we will input a scanner since we want to make our program user flexible, i.e. user can input the calls made by the customer.Moving forward we made our program using function so at first, we will define all the variables we are going to use in the program and if we are using that variable throughout our program so it would be better to define it globally so that we don’t need to define it again and again. The second function we are making for the conditions for billing and the procedure used for the billing purpose we have discussed before in the introduction part.At the end, we will make a function so that we can conclude our program, here we are using a new function for “PhoneBilling”  so that the system can create new space for inserting the new values and then call the “Billing” function.Hope you find it helpful.

Thank You!


package oops;

import java.util.Scanner;
public class PhoneBill {
int calls;
double money;
public PhoneBill(){
Scanner s=new Scanner(System.in);
System.out.println(“Enter the calls made by customer”);
public double billing(){
money =50 + 50 + (calls-199)* 0.75;

money=50 + 50 + 75 + (calls-299)* 1;
return money;
public static void main(String[] args) {
PhoneBill p=new PhoneBill();
System.out.println(“Bill generated Of Total Calls made by the customer=”+ p.billing());



Leave a Reply