Computer Science, asked by roshan1234576, 1 month ago

11. BSNL charges for using telephone from their consumers according to the calls
made (per month) as per the given tariff:
Number of calls
Up to 50 calls
For next 100 calls
For next 200 calls
More than 350 calls
Charge
No.charge (free)
Re.1 per call
90 paisa per call
80 paisa per call
However, monthly rental charge is Rs. 180/- per month for all the consumers for
using telephones. Write a program in java to calculate monthly telephone bill
indicating no. of calls, monthly rental &total amount to be paid. Taken number of
calls as an input.

Answers

Answered by SUPERSHAN8747
34

Answer:

I am trying to add the document but it's not getting attached.. I am sorry...

< marquee ><marquee> ●═══════════◄ HOPE IT HELPS YOU PLEASE MARK AS BRAINLIEST 

Explanation:

sorry but pls mark me as brianlliest

Answered by s1274himendu3564
2

ANSWER

import java.util.Scanner;

public class Bill

{

private int bno;

private String name;

private int call;

private double amt;

public Bill() {

bno = 0;

name = "";

call = 0;

amt = 0.0;

}

public Bill(int bno, String name, int call) {

this.bno = bno;

this.name = name;

this.call = call;

}

public void calculate() {

double charge;

if (call <= 100)

charge = call * 0.6;

else if (call <= 200)

charge = 60 + ((call - 100) * 0.8);

else if (call <= 300)

charge = 60 + 80 + ((call - 200) * 1.2);

else

charge = 60 + 80 + 120 + ((call - 300) * 1.5);

amt = charge + 125;

}

public void display() {

System.out.println("Bill No: " + bno);

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

System.out.println("Calls: " + call);

System.out.println("Amount Payable: " + amt);

}

public static void main(String args[]) {

Scanner in = new Scanner(System.in);

System.out.print("Enter Name: ");

String custName = in.nextLine();

System.out.print("Enter Bill Number: ");

int billNum = in.nextInt();

System.out.print("Enter Calls: ");

int numCalls = in.nextInt();

Bill obj = new Bill(billNum, custName, numCalls);

obj.calculate();

obj.display();

Similar questions