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:
✅ Problem Breakdown
We are given:
- Charging Rules:
- 2 cents per minute for calls over 20 minutes and outside the customer’s area code.
- 13 cents per minute for all other calls.
- Inputs (Fields per Call):
- Customer Area Code (3 digits)
- Customer Phone Number (7 digits)
- Called Area Code (3 digits)
- Called Number (7 digits)
- Call Duration in Minutes (up to 4 digits)
- Output:
- Customer Area Code
- Customer Phone Number
- Called Area Code
- Called Number
- Call Duration
- Total Charge
Explanation
To solve this problem, we must calculate call charges based on duration and area codes. If a call lasts more than 20 minutes and is made outside the customer’s area code, the rate is 2 cents per minute. Otherwise, it is 13 cents per minute. We must collect relevant input fields, apply the correct condition, calculate the cost, and display all information.
Step-by-Step Logic:
- Input all data fields:
- Customer area code and phone number
- Called area code and phone number
- Call duration (in minutes)
- Decision Making:
- If the call duration is greater than 20 minutes AND the area codes differ, apply 2 cents/min.
- Else, apply 13 cents/min.
- Calculate the charge by multiplying rate by duration.
- Output all details along with the computed total charge.
This simple decision-based process is well suited to a flowchart. The flowchart uses standard symbols: parallelograms for input/output, rectangles for processes, and diamonds for decisions.
This kind of logic is commonly used in billing systems and helps ensure fairness and transparency in pricing. Proper validation and branching allow for efficient charge calculation and data processing.
🔄 Flowchart Design
Here’s the correct answer with a charge chart based on the telephone company billing rules:
✅ Correct Logic Summary
- Charge =
2 cents per minuteif call duration > 20 minutes AND the call is outside the customer’s area code- Else:
13 cents per minute
📊 Charge Calculation Chart
| Customer Area Code | Customer Phone | Called Area Code | Called Phone | Call Duration (min) | Rate Applied (¢/min) | Total Charge (¢) |
|---|---|---|---|---|---|---|
| 123 | 4567890 | 987 | 6543210 | 25 | 2 | 50 |
| 123 | 4567890 | 123 | 6543210 | 30 | 13 | 390 |
| 456 | 1234567 | 789 | 3210987 | 18 | 13 | 234 |
| 789 | 2345678 | 123 | 7654321 | 45 | 2 | 90 |
| 321 | 7890123 | 321 | 4567890 | 15 | 13 | 195 |
🔎 Explanation
- Row 1: 25 minutes and different area code →
2¢ × 25 = 50¢ - Row 2: 30 minutes but same area code →
13¢ × 30 = 390¢ - Row 3: Only 18 minutes →
13¢ × 18 = 234¢(short call) - Row 4: 45 minutes, different area code →
2¢ × 45 = 90¢ - Row 5: 15 minutes, same area code →
13¢ × 15 = 195¢
This chart helps visualize how different calls are billed under the given rules.
