COP 1000 Data Validation Project 7

Design and write a program that calculates and displays the number of minutes over the monthly contract minutes that a cell phone user incurred. The program should ask the user how many minutes were used during the month and how many minutes they were allowed. Validate the input as follows:
• The minimum minutes allowed should be at least 200, but not greater than 800. Validate input so that the minutes allowed are between 200 and 800.
• The minutes used must be over 0. Validate input so that the user does not enter a negative value.
Once correct data is entered, the program should calculate the number of minutes over the minute allowed. If minutes were not over, print a message that they were not over the limit. If minutes were over, for every minute over, a .20 fee should be added to the monthly contract rate of 74.99. Be sure not to add the .20 fee for minutes 1 to the number of minutes allowed, but rather just minutes over. Display the number of minutes used, minutes allowed, the number of minutes over, and the total due that month.
You might consider the following:
• A function that allows the user to enter in minutes allowed within the range of 200 and 800.
• A function that allows the user to enter in the minutes used greater than or equal to 0.
• A module that calculates the total due and the total minutes over.
• A module that outputs the monthly use report.

IPO Chart:
INPUT PROCESSING OUTPUT
Minutes allowed
Minutes used
Keep going Validate keep going
Validate minutes allowed
Validate minutes used

If minutes used minutes allowed
Calculate minutes over
Calculate total due + (minutes over * .20)
Else
Total due = 74.99
EndIf Minutes allowed
Minutes used
Total due
Minutes over

Pseudocode:
Begin main
Declare local variables
Initialize keepGoing to “yes”
While keepGoing = “yes”
Call function to get minutesAllowed
Call function to get minutesUsed
Call module to calculate the totalDue and to display minutesOver if any
Call module to output the monthly usage values
Input keepGoing
End main 
Begin function to get minutesAllowed
Input minutesAllowed
While minutesAllowed < 200 OR minutesAllowed 800
Display validation message
Input minutesAllowed
End While
Return minutesAllowed
End function
Begin function to get minutesUsed
Input minutesUsed
While minutesUsed < 0
Display validation message
Input minutesUsed
End While
Return minutesUsed
End function
Begin module to calculate totalDue and minutesOver
Declare and initialize variables
If minutesUsed minutesAllowed
Calculate minutesOver
Calculate totalDue + (minutesOver * .20)
Display “You were over your minutes by “, minutesOver
Else
Calculate totalDue = 74.99
Display “You were not over your minutes for the month.”
EndIf
Return totalDue, minutesOver
End module
Begin module to output monthly usage
Display “----------------MONTHLY USE REPORT----------------------“
Display “Minutes allowed were”, minutesAllowed
Display “Minutes used were”, minutesUsed
Display “Minutes over were”, minutesOver
Display “Total due is $”, totalDue
End module
Copy and paste each flowchart segment and screen shot of one your program output here.

Your sample output might look as follows (note the validation code):
Sample 1 Showing Validation:
How many minutes are allowed: 1000
Please enter minutes between 200 and 800
How many minutes are allowed: 801
Please enter minutes between 200 and 800
How many minutes are allowed: 350
How many minutes were used: -10
Please enter minutes used of at least 0
How many minutes were used: 400
You were over your minutes by 50

---------------MONTHLY USE REPORT------------------
Minutes allowed were 350
Minutes used were 400
Minutes over were 50
Total due is $ 84.99

Do you want to end program? (Enter no or yes): N
Please enter a yes or no
Do you want to end program? (Enter no or yes): 9
Please enter a yes or no
Do you want to end program? (Enter no or yes): no

Sample 2 Showing Minutes Over:
How many minutes are allowed: 600
How many minutes were used: 884
You were over your minutes by 284

---------------MONTHLY USE REPORT------------------
Minutes allowed were 600
Minutes used were 884
Minutes over were 284
Total due is $ 131.79

Do you want to end program? (Enter no or yes): no



Sample 3 Showing Minutes Not Over:
How many minutes are allowed: 400
How many minutes were used: 379
You were not over your minutes for the month

---------------MONTHLY USE REPORT------------------
Minutes allowed were 400
Minutes used were 379
Minutes over were 0
Total due is $ 74.99
Do you want to end program? (Enter no or yes): yes

Powered by