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 develop a program that calculates telephone charges based on the given criteria and displays the required details, follow these steps:

  1. Input Data: Collect the following information for each call:
  • Customer area code (three digits)
  • Customer phone number (seven digits)
  • Called area code (three digits)
  • Called number (seven digits)
  • Call duration in minutes (up to four digits)
  1. Determine Call Type:
  • Check if the called area code differs from the customer area code to identify if it’s an out-of-area call.
  1. Calculate Charges:
  • For out-of-area calls lasting more than 20 minutes, apply a rate of 2 cents per minute.
  • For all other calls, apply a rate of 13 cents per minute.
  1. Compute Total Charge:
  • Multiply the call duration by the applicable rate to get the total charge.
  1. Display Results:
  • Present the customer area code, customer phone number, called area code, called number, call duration, and the total charge.

Flowchart Explanation:

A flowchart visually represents the sequence of operations in the program. Here’s a breakdown of the flowchart components:

  • Start: Indicates the beginning of the program.
  • Input: Boxes where user inputs are collected, including customer area code, customer phone number, called area code, called number, and call duration.
  • Decision: Diamonds represent decision points:
  • First decision checks if the called area code is different from the customer area code.
  • If yes, the next decision checks if the call duration exceeds 20 minutes.
  • Process: Rectangles where calculations are performed:
  • If both conditions are met, the charge is calculated at 2 cents per minute.
  • Otherwise, the charge is calculated at 13 cents per minute.
  • Output: Displays the collected inputs along with the calculated total charge.
  • End: Marks the termination of the program.

Conclusion:

By following this structured approach, the program efficiently calculates the correct charges for each call based on area codes and duration.

Scroll to Top