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 design a program that calculates the total charge for each call based on the criteria provided. We can break down the problem as follows:

Problem Breakdown:

  1. Input Fields:
  • Customer Area Code (3 digits)
  • Customer Phone Number (7 digits)
  • Called Area Code (3 digits)
  • Called Number (7 digits)
  • Called Time in Minutes (4 digits)
  1. Charges Criteria:
  • The telephone company charges a rate of two cents per minute for calls outside the customer’s area code, but only if the call lasts longer than 20 minutes.
  • For all other calls, the charge is 13 cents per minute.
  1. Output:
  • Customer Area Code
  • Customer Phone Number
  • Called Area Code
  • Called Number
  • Called Time in Minutes
  • Total Charge for the call

Steps to Calculate the Charge:

  1. If the called area code is different from the customer area code and the call time exceeds 20 minutes, the charge is calculated as:
  • Charge = Called Time in Minutes * 0.02 (since it’s 2 cents per minute)
  1. If the call is within the customer’s area code or the call time is less than or equal to 20 minutes, the charge is:
  • Charge = Called Time in Minutes * 0.13 (since it’s 13 cents per minute)

Flowchart Description:

Here’s a detailed explanation of the flowchart:

  1. Start: The program begins.
  2. Input Data: Read customer area code, customer phone number, called area code, called number, and called time.
  3. Check Area Code: If the customer’s area code is equal to the called area code, proceed to step 4. If not, proceed to step 5.
  4. Check Call Time: If the call time is less than or equal to 20 minutes, calculate the charge at 13 cents per minute.
  5. Calculate Charge: If the call time is more than 20 minutes, calculate the charge at 2 cents per minute for calls outside the area code.
  6. Output: Display the customer area code, customer phone number, called area code, called number, called time, and the total charge.
  7. End: The program ends.

Flowchart Design:

Here is a visual description of the flow:

  1. Start
  2. Input customer area code, customer phone number, called area code, called number, called time
  3. Compare customer area code with called area code
  • Yes → Check if called time is more than 20 minutes
  • No → Calculate charge as 13 cents per minute
  1. Calculate charge as 2 cents per minute for calls > 20 minutes outside area code
  2. Display the results
  3. End

Explanation (300 words):

The program calculates the total charge for a call based on whether it is within or outside the customer’s area code, and the duration of the call. The customer area code and called area code are compared to check if the call is within the same area. If the area codes are different and the call lasts more than 20 minutes, the rate of 2 cents per minute is applied. For calls that are either within the same area code or last 20 minutes or less, the rate is 13 cents per minute.

To implement this, the program uses conditional statements to decide which rate to apply based on the area code comparison and call time. The flowchart represents these decisions in a step-by-step process. The program first takes input for the customer’s and called area codes, the phone numbers, and the call duration. It then checks the area codes: if they are the same, it applies the 13 cents per minute charge; if they are different and the call lasts more than 20 minutes, it applies the 2 cents per minute charge.

Once the charge is calculated, the program displays the results, which include the customer and called area codes, phone numbers, call duration, and the total charge. The program concludes after displaying the necessary output.

This process ensures that the customer is correctly charged based on the call duration and whether the call is local or long-distance. The flowchart provides a clear visual representation of the decision-making process within the program, making it easy to understand the program’s logic.

Scroll to Top