# If aftertaxcost displayamt then output custareacode

• Homework Help
• 71
• 96% (25) 24 out of 25 people found this document helpful

This preview shows page 22 - 29 out of 71 pages.

if afterTaxCost > DISPLAY_AMT thenoutput custAreaCode, custPhoneNum, numTxtMsgs, beforeTaxCost, afterTaxCostendifoutput PROMPTinput custAreaCodereturnfinish()output “End of program”
Programming Logic and Design, 7eSolutions 4-23returne. A program that prompts the user for a three-digit area code from which to select bills. Then the program continuously accepts text message data until a sentinel value is entered, and displays data only for messages sent from the specified area code.
Programming Logic and Design, 7eSolutions 4-24Pseudocode:startDeclarationsnum custAreaCodenum displayAreaCodenum custPhoneNum
Programming Logic and Design, 7eSolutions 4-25num numTxtMsgsnum taxesnum beforeTaxCostnum afterTaxCostnum BASE_RATE = 5num MIN_MSGS = 60num MAX_MSGS = 180num DISPLAY_MSGS = 100num MIN_RATE = 0.05num MAX_RATE = 0.10num TAX_RATE = 0.12num QUIT = -1string DATA_PROMPT = “Enter an area code or -1 to quit >> ”string INIT_PROMPT = “Enter an area code from which to select bills >> ”housekeeping()while custAreaCode <> QUITdeailLoop()endwhilefinish()stophousekeeping()output INIT_PROMPTinput displayAreaCodeoutput DATA_PROMPTinput custAreaCodereturndetailLoop()if custAreaCode = displayAreaCode theninput custPhoneNum, numTxtMsgsbeforeTaxCost = BASE_RATEif numTxtMsgs > MIN_MSGS thenif numTxtMsgs > MAX_MSGS thenbeforeTaxCost = beforeTaxCost + (MAX_MSGS – MIN_MSGS) * MIN_RATE +(numTxtMsgs – MAX_MSGS)* MAX_RATEelsebeforeTaxCost = beforeTaxCost +(numTxtMsgs – MIN_MSGS) * MIN_RATEendifendiftaxes = beforeTaxCost * TAX_RATEafterTaxCost = beforeTaxCost + taxesoutput custAreaCode, custPhoneNum, numTxtMsgs, beforeTaxCost, afterTaxCostendifoutput DATA_PROMPTinput custAreaCodereturnfinish()output “End of program”return
Programming Logic and Design, 7eSolutions 4-265.The Drive-Rite Insurance Company provides automobile insurance policies for drivers. Design a flowchart or pseudocode for following:a. A program that accepts insurance policy data, including a policy number, customer last name, customer first name, age, premium due date (month, day, and year), and number of driver accidents in the last three years. If an entered policy number is not between 1000 and 9999 inclusive, set the policy number to 0. If the month is not between 1 and 12 inclusive, or the day is not correct for the month (for example, not between 1 and 31 for January or 1 and 29 for February), set the month, day, and year to 0. Display the policy data after any revisions have been made.
Programming Logic and Design, 7eSolutions 4-27Pseudocode:startDeclarations