// Program 51: Telephone Bill Using Inheritance import java.util.*; class Customer { String name; int calls; void input() { Scanner sc = new Scanner(System.in); System.out.print("Customer name: "); name = sc.nextLine(); System.out.print("Number of calls: "); calls = sc.nextInt(); } } class TelephoneBill extends Customer { void display() { // Assumed tariff: Rs. 200 rental includes 100 calls. // Each additional call costs Rs. 1. double bill = 200.0; if (calls > 100) { bill += (calls - 100) * 1.0; } System.out.println("Customer: " + name); System.out.println("Calls: " + calls); System.out.println("Bill amount: Rs. " + bill); } public static void main(String[] args) { TelephoneBill ob = new TelephoneBill(); ob.input(); ob.display(); } }