Revision Programs

Set 9

Mobile Bill: Slab Calculation

1. Sequence Construct

  1. Input name of a subscriber, mobile number, previous reading and present reading. Find number of calls, phone charge and print a bill. The charge is Rs. 0.80 per call.

2. Conditional Construct: Selection Statement

if

  1. Input previous reading and present reading. Find number of calls, mobile charge and print a bill. If the calls are above 50 then the charge is Rs. 0.80 per unit. (Otherwise no charge). Use simple if.

if else

  1. Input previous reading and present reading. Find the mobile charge and print a bill.
    For the first 50 calls the charge is Rs. 0.0 per unit. For remaining calls Rs. 0.80 per unit.
-->

if else if else

  1. Input previous reading and present reading. Find mobile charge and print a bill.
    For the first 50 calls the charge is Rs. 0.0 per unit.
    Next 50 calls Rs. 0.80 per unit.
    For remaining calls Rs. 1.20 per unit.

Nested if else if else

  1. No need

if After if else

  1. Input previous reading and present reading. Find mobile charge and print a bill.
    For the first 50 calls charge is Rs. 0.80 per call.
    For remaining calls Rs. 1.00 per call.
    For BSNL employees 60% reduction.

switch case

  1. No need

3. Iterative Construct (Loop):

for

  1. Input n subscribers’ names and number of calls. Find mobile charge and print a bill for each subscriber. Also find total collection.
    For first 50 calls charge is Rs. 0.80 per unit.
    Remaining calls Rs. 1.00 per unit.