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 :

Designing a telephone billing system requires careful consideration of call details and applicable charges. Here’s how you can approach this:

Program Output:

The program should display the following details for each call:

  • Customer Area Code
  • Customer Phone Number
  • Called Area Code
  • Called Number
  • Call Duration (in minutes)
  • Total Charge (in cents)

Flowchart Explanation:

  1. Start: Initiate the program.
  2. Input Call Details: Collect inputs for customer area code, customer phone number, called area code, called number, and call duration.
  3. Check Area Code:
  • If the customer area code matches the called area code, proceed to step 4.
  • If they differ, proceed to step 5.
  1. Calculate Local Call Charge: Multiply the call duration by 13 cents/minute to get the total charge.
  2. Check Call Duration:
  • If the call duration exceeds 20 minutes, proceed to step 6.
  • If it’s 20 minutes or less, proceed to step 4.
  1. Calculate Long-Distance Call Charge: Multiply the call duration by 2 cents/minute to get the total charge.
  2. Display Call Details and Charge: Output all collected and calculated information.
  3. End: Terminate the program.

Flowchart Illustration:

To visualize the process, you can refer to the following flowchart:

+------------------------+
| Start                  |
+------------------------+
           |
           v
+------------------------+
| Input Call Details     |
+------------------------+
           |
           v
+------------------------+
| Are Area Codes Equal?  |
+------------------------+
           |
     +-----+-----+
     |           |
    Yes          No
     |           |
     v           v
+------------------------+    +------------------------+
| Calculate Local        |    | Is Call Duration > 20? |
| Call Charge            |    +------------------------+
| (13 cents/min)         |           |
+------------------------+      +----+----+
           |                 Yes |         | No
           v                    v         v
+------------------------+    +------------------------+
| Display Call Details   |    | Calculate Long-        |
| and Charge             |    | Distance Call Charge   |
+------------------------+    | (2 cents/min)          |
           |                 +------------------------+
           v                            |
+------------------------+               |
| End                    |               |
+------------------------+               |
                                        v
                             +------------------------+
                             | Display Call Details   |
                             | and Charge             |
                             +------------------------+
                                        |
                                        v
                             +------------------------+
                             | End                    |
                             +------------------------+

Explanation:

  • Input Call Details: The program begins by collecting all necessary information about the call.
  • Area Code Comparison: Determines if the call is local or long-distance based on area codes.
  • Local Call Charge Calculation: Applies a rate of 13 cents per minute for local calls.
  • Long-Distance Call Duration Check: For long-distance calls, it checks if the duration exceeds 20 minutes to apply the appropriate rate.
  • Long-Distance Call Charge Calculation: Applies a rate of 2 cents per minute for qualifying long-distance calls.
  • Display and End: Outputs the call details and total charge, then ends the program.

This structured approach ensures accurate billing based on call specifics.

Scroll to Top