Totalnetpay totalnetpay netpay output empname

This preview shows page 27 - 32 out of 56 pages.

totalNetPay = totalNetPay + netPayoutput empName, grossPay, WITH_RATE[x] * 100, withTax, netPayoutput “Enter an employee name or ”, QUIT, “ to quit”input empNamereturnfinishUp()output totalHrsWorked, totalGrossPay, totalWithTax, totalNetPayreturn27
Programming Logic and Design, 6eSolutions 6-9.The Perfect Party Catering Company hosts events for clients. Create an application that accepts an event number, the event host’s last name, and numeric month, day, and year values representing the event date. The application should also accept the number of guests that will attend the event and a numeric meal code that represents the entrée the event hosts will serve. As each client’s data is entered, verify that the month, day, year, and meal code are valid; if any of these is not valid, continue to prompt the user until it is. The valid meal codes are shown in the accompanying table.CodeEntréePrice per Person ($)1Roast beef24.502Salmon19.003Linguine16.504Chicken18.00Design the logic for an application that outputs each event number, host name, validated date, meal code, entrée name, number of guests, gross total price for the party, and price for the party after discount. The gross total price for the party is the meal price per guest times the number of guests. The final price includes a discount based on the accompanying table.Number of GuestsDiscount ($)1-25026-507551-100125101-250200251 and over300
28
Programming Logic and Design, 6eSolutions 6-Pseudocode:startDeclarationsnum eventNumstring lastNamenum monthnum daynum year29
Programming Logic and Design, 6eSolutions 6-num numOfGuestsnum mealCodenum xnum invalidDate = 0num grossPricenum MSIZE = 4num DSIZE = 5string ENTREES[MSIZE] = “Roast beef”, “Salmon”, “Linguine”, “Chicken”num PRICE[MSIZE] = 24.50, 19, 16.50, 18num DIS_RANGE[DSIZE] = 1, 26, 51, 101, 251num DISCOUNT[DSIZE] = 0, 75, 125, 200, 300getReady()detail()finishUp()stopgetReady()output “Enter the event number, host’s last name, and event date (as month, day, and year)”input eventNum, lastName, month, day, yearoutput “Enter the number of guests and the meal code”input numOfGuests, mealCodereturndetail()validateMealCode()validateDate()grossPrice = PRICE[mealCode-1] * numOfGuestsx = DSIZE – 1while numOfGuests < DIS_RANGE[x]x = x – 1endwhileoutput eventNum, lastName, month, “/”, day, “/”, year,mealCode, ENTREES[mealCode-1], numOfGuests, grossPrice,(grossPrice – DISCOUNT[x])returnvalidateMealCode()while mealCode < 1 OR mealCode > MSIZEoutput “Invalid meal code, please reenter”input mealCodeendwhilereturnvalidateDate()checkDate()while invalidDate = 1ouput “Invalid date, please reenter”input month, day, yearendwhile returncheckDate()invalidDate = 0if (month < 1 OR month > 12 OR day < 1 OR day > 31 ORyear < 2009 OR year > 2012) then30
Programming Logic and Design, 6e

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture