Fix_M04

docx

School

Ivy Tech Community College, Indianapolis *

*We aren’t endorsed by this school

Course

104

Subject

Communications

Date

Feb 20, 2024

Type

docx

Pages

6

Uploaded by PrivateHippopotamusMaster2066

Report
// This pseudocode should create a report that contains an // apartment complex rental agent's commission. The // program accepts the ID number and name of the agent who // rented the apartment, and the number of bedrooms in the // apartment. The commission is $100 for renting a three-bedroom // apartment, $75 for renting a two-bedroom apartment, $55 for // renting a one-bedroom apartment, and $30 for renting a studio // (zero-bedroom) apartment. Output is the salesperson’s // name and ID number and the commission earned on the rental. start Declarations num salesPersonID string salesPersonName num commissionEarned num numBedrooms num COMM_3 = $100.00 num COMM_2 = $75.00 num COMM_1 = $55.00 num COMM_STUDIO = $30.00 num QUIT = 9999 getReady() while salesPersonID <> QUIT detailLoop() endwhile finish() stop getReady() output "Enter salesperson ID or ", QUIT, " to quit " output salesPersonID return detailLoop() output "Enter name " input salesPersonName output "Enter number of bedrooms rented " input numBedrooms if numBedrooms = 3 then commissionEarned = COMM_3 else if numBedrooms = 2 then commissionEarned = COMM_2 else if numBedrooms = 1 then commission = COMM_1 else commissionEarned - COMM_STUDIO endif
endif endif output "Salesperson ID: ", salesPersonID output "Salesperson Name: ", salesPersonName output "Commission Earned: $", commissionEarned output "Enter salesperson ID or ", QUIT, " to quit " input salesPersonID return finish() output "End of report" return // This pseudocode should create a list that describes annual profit // statistics for a retail store. Input records contain a department // name (for example, “Cosmetics”) and profits for each quarter for // the last two years. The program should determine whether // the profit is higher, lower, or the same // for this full year compared to the last full year. start Declarations string department num salesQuarter1ThisYear num salesQuarter2ThisYear num salesQuarter3ThisYear num salesQuarter4ThisYear num salesQuarter1LastYear num salesQuarter2LastYear num salesQuarter3LastYear num salesQuarter4LastYear num totalThisYear num totalLastYear string status string QUIT = "ZZZZ" housekeeping() while department <> QUIT compareProfit() endwhile finishUp() stop housekeeping() output "Enter department name or ", QUIT, " to quit " input department return
compareProfit() getSalesData() sumSalesData() if totalThisYear > totalLastYear then status = "Higher" else if totalThisYear < totalLastYear then status = "Lower" else status = "Same" endif endif output department, status output "Enter department name or ", QUIT, " to quit " input department return getSalesData() output "Enter sales for first quarter this year " input salesQuarter1ThisYear output "Enter sales for second quarter this year " input salesQuarter2ThisYear output "Enter sales for third quarter this year " input salesQuarter3ThisYear output "Enter sales for fourth quarter this year " input salesQuarter4ThisYear output "Enter sales for first quarter last year " input salesQuarter1LastYear output "Enter sales for second quarter last year " input salesQuarter2LastYear output "Enter sales for third quarter last year " input salesQuarter3LastYear output "Enter sales for fourth quarter last year " input salesQuarter4LastYear return sumSalesData() totalThisYear = salesQuarter1ThisYear + salesQuarter2ThisYear + salesQuarter3ThisYear + salesQuarter4ThisYear totalLastYear = salesQuarter1LastYear + salesQuarter2LastYear + salesQuarter3LastYear + salesQuarter4LastYear return finishUp() output "End of report" return
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
// This pseudocode should determine and output // the rental fees for cars. // Standard cars rent for $65 per day, // compacts rent for $40 per day, // and subcompacts rent for $30 per day. // Rentals for at least 7 days receive a 20% discount. // An error message is displayed if the car type // is not valid. start Declarations string carType num days num rate num STD_RATE = 65 num COM_RATE = 40 num SUB_RATE = 30 num DAYS_FOR_DISCOUNT = 7 num DISCOUNT_RATE = 0.20 string QUIT = "ZZZZ" getReady() while carType <> QUIT detailLoop() endwhile finish() stop getReady() output "Enter car type or ", QUIT, "to quit" input carType return detailLoop() output "Enter days rented " input days if carType = "Standard" then rate = STD_RATE else if carType = "Compact" then rate = COM_RATE else if carType = "Subcompact" then rate = SUB_RATE else rate = 0 output "Invalid car type" endif endif
endif if rate <> 0 if days >= DAYS_FOR_DISCOUNT then rate = rate - (rate * DISCOUNT_RATE) endif output "Car Type: ", carType output "Days Rented: ", days output "Total Rental Fee: $", rate * days endif output "Enter car type or ", QUIT, " to quit " input carType return finish() output "End of program" return //This program assigns a 10% discount of a customer orders more than 12 items and a 20% discount if a customer orders more than 24 items start Declarations string name num items num PRICEEACH = 1.39 num CUT_OFF1 = 12 num CUT_OFF2 = 24 num DISCOUNT1 = 0.10 num DISCOUNT2 = 0.20 num total string QUIT = "ZZZZ" housekeeping() detailLoop() while name <> QUIT detailLoop() endwhile finish() stop
housekeeping() output "Enter customer name or ", QUIT, " to quit" input name return detailLoop() output "Enter the number of items ordered for ", name input items total = items * PRICEEACH if items > CUT_OFF2 then total = total - (total * DISCOUNT2) else if items > CUT_OFF1 then total = total - (total * DISCOUNT1) endif endif output "Total cost for ", name, " is $", total output "Enter customer name or ", QUIT, " to quit" input name return finish() output "Program finished" return
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help