A telephone company charges to cents per minutefor all calls outside the customers area code that last over 20 minutes

A telephone company charges to cents per minutefor all calls outside the customers area code that last over 20 minutes .All other calls are 13 percents minute.Fields for each call include customer area code (three digits),customer phone number (seven digits),called area code (three digits),called number(seven digits)and called time in minutes(four digits).Display the customer area code,customer phone number,called area code,called number,called time in minutes and the total charge.Draw the flowchart for this program.

The Correct Answer and Explanation is:

To solve this problem, we need to:

  1. Collect input data for each call:
    • Customer area code (3 digits)
    • Customer phone number (7 digits)
    • Called area code (3 digits)
    • Called number (7 digits)
    • Call duration (in minutes)
  2. Calculate the charge:
    • If the call is outside the customer’s area code and lasts more than 20 minutes, charge 20 cents per minute.
    • Otherwise, charge 13 cents per minute.
  3. Display the results:
    • Customer area code, customer phone number, called area code, called number, duration, and total charge.

Correct Flowchart Steps

  1. Start
  2. Input:
    • Customer area code
    • Customer phone number
    • Called area code
    • Called number
    • Call time (in minutes)
  3. Check: Is called area code ≠ customer area code AND call time > 20?
    • Yes → Charge = 0.20 × minutes
    • No → Charge = 0.13 × minutes
  4. Display:
    • Customer area code, customer phone number
    • Called area code, called number
    • Call time in minutes
    • Total charge
  5. End

🧠 Explanation

This program is designed to compute the total cost of a phone call based on a specific set of billing rules applied by a telephone company. It distinguishes between long-distance and local calls by comparing the customer’s area code with the called area code. If the area codes are different and the call lasts more than 20 minutes, it is considered a long-distance call and charged at a higher rate (20 cents per minute). All other calls, including shorter or local calls, are charged at a lower rate of 13 cents per minute.

The logic is implemented using conditional statements. A key part of the program is the decision-making block that evaluates whether both conditions (area code mismatch and call duration) are satisfied. This ensures accurate billing based on the call type.

This structure makes it easy for developers and businesses to ensure correct billing procedures, reduce errors, and allow for future modifications. For instance, if rates or conditions change, only a small section of the program would need updating.

The program also ensures transparency by displaying all relevant details: both parties’ numbers, duration of the call, and the calculated charge. This output helps in validating the billing for both users and service providers.


📊 Flowchart

Here’s a simplified representation of the flowchart:

     ┌────────────┐
     │   Start    │
     └────┬───────┘
          │
          ▼
 ┌────────────────────┐
 │ Input customer and │
 │ call details       │
 └────┬───────────────┘
      │
      ▼
 ┌────────────────────────────────────┐
 │ Is called area code ≠ customer’s  │
 │ AND call time > 20 minutes?       │
 └────┬──────────────────────────────┘
      │Yes                          No│
      ▼                               ▼
┌────────────┐              ┌────────────────┐
│ Charge =   │              │ Charge =       │
│ 0.20 × min │              │ 0.13 × min     │
└────┬───────┘              └─────┬──────────┘
     │                            │
     ▼                            ▼
 ┌────────────────────────────────────────────┐
 │ Display all call info and total charge     │
 └────────────────────────────────────────────┘
                     │
                     ▼
                ┌────────┐
                │  End   │
                └────────┘
Scroll to Top