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 the problem, we need a program that:

  1. Accepts inputs:
    • Customer area code (3 digits)
    • Customer phone number (7 digits)
    • Called area code (3 digits)
    • Called number (7 digits)
    • Call time in minutes (up to 4 digits)
  2. Applies the correct rate logic:
    • If called area code is different from the customer area code and the call lasts more than 20 minutes, charge 2 cents per minute.
    • Otherwise, charge 13 cents per minute.
  3. Computes and displays:
    • Customer area code
    • Customer phone number
    • Called area code
    • Called number
    • Call duration in minutes
    • Total charge (in cents)

Correct Sample Logic

Here’s a step-by-step explanation with pseudocode, followed by the flowchart:

🔄 Pseudocode

START
INPUT customer_area_code
INPUT customer_phone_number
INPUT called_area_code
INPUT called_number
INPUT call_time_in_minutes

IF called_area_code ≠ customer_area_code AND call_time_in_minutes > 20 THEN
    charge_per_minute = 2
ELSE
    charge_per_minute = 13
END IF

total_charge = call_time_in_minutes * charge_per_minute

DISPLAY customer_area_code, customer_phone_number
DISPLAY called_area_code, called_number
DISPLAY call_time_in_minutes
DISPLAY total_charge
END

🧠 Explanation (300 words)

The purpose of this program is to compute the telephone charges for a given call based on specific billing rules. Calls are categorized into two types based on the area code and call duration.

If a call is made outside the customer’s area code and lasts more than 20 minutes, it is considered a discounted long-distance call, and the telephone company charges a reduced rate of 2 cents per minute. For all other calls — either local calls (same area code) or shorter long-distance calls (20 minutes or less) — the rate is 13 cents per minute.

The program starts by collecting five key inputs: customer’s area code and phone number, the called party’s area code and phone number, and the call duration in minutes. It then checks the conditions. If both the area codes are different and the call time exceeds 20 minutes, it assigns the reduced rate. Otherwise, the regular rate is used.

Once the rate is determined, the program calculates the total charge by multiplying the rate by the duration in minutes. Finally, it displays all relevant call information, including the total charge.

This program ensures accurate billing based on a clear decision structure and helps customers understand why a particular rate was applied. It can be used in telecommunications systems to automate billing and reduce manual errors.


🔁 Flowchart

I’ll now generate a flowchart for the above logic.

Scroll to Top