And over 300 table 6 7 countrywide tours discounts

• Homework Help
• 77
• 98% (250) 244 out of 250 people found this document helpful

This preview shows page 39 - 43 out of 77 pages.

We have textbook solutions for you!
The document you are viewing contains questions related to this textbook.
The document you are viewing contains questions related to this textbook.
Chapter 6 / Exercise 19
Programming Logic and Design, Introductory
Farrell
Expert Verified
200 51 and over 300 Table 6-7 Countrywide Tours discounts 39
We have textbook solutions for you!
The document you are viewing contains questions related to this textbook.
The document you are viewing contains questions related to this textbook.
Chapter 6 / Exercise 19
Programming Logic and Design, Introductory
Farrell
Expert Verified
Programming Logic and Design, 8e Solutions 6- Pseudocode: 40
Programming Logic and Design, 8e Solutions 6- start Declarations num tourNum num month num day num year num numOfTravs num destCode num x num invalidDate = 0 num grossPrice num finalPrice num DEST_SIZE = 4 num DISC_SIZE = 5 string DESTINATIONS[DEST_SIZE] = “Chicago”, “Boston”, “Miami”, “San Francisco” num PRICES[DEST_SIZE] = 300, 480, 1050, 1300 num DISC_RANGES[DISC_SIZE] = 1, 6, 13, 21, 51 num DISCOUNTS[DISC_SIZE] = 0, 75, 125, 200, 300 getReady() while not eof detail() endwhile finishUp() stop getReady() output “Enter the tour number and tour date (as month, day, and year)” input tourNum, month, day, year output “Enter the number of travellers and the destination code” input numOfTravs, destCode return detail() validateDestCode() validateDate() grossPrice = PRICES[destCode - 1] * numOfTravs x = DISC_SIZE – 1 while numOfTravs < DISC_RANGES[x] x = x – 1 endwhile finalPrice = grossPrice – (DISCOUNTS[x] * numOfTravs) output tourNum, month, “/”, day, “/”, year, destCode, DESTINATIONS[destCode-1], numOfTravs, grossPrice, finalPrice output “Enter the tour number and tour date (as month, day, and year)” input tourNum, month, day, year output “Enter the number of travellers and the destination code” input numOfTravs, destCode return validateDestCode() 41
Programming Logic and Design, 8e Solutions 6- while destCode < 1 OR destCode > DEST_SIZE output “Invalid destination code, please reenter” input destCode endwhile return validateDate() checkDate() while invalidDate = 1 ouput “Invalid date, please reenter” input month, day, year checkDate() endwhile return checkDate() invalidDate = 0 if (month < 1 OR month > 12 OR day < 1 OR day > 31 OR year < 2009 OR year > 2012) then invalidDate = 1 else if day = 31 AND (month = 4 OR month = 6 OR month = 9 OR month = 11) then invalidDate = 1 else if day > 28 AND month = 2 then invalidDate = 1 endif endif endif return finishUp() output “End of program” return 11. a. Daily Life Magazine wants an analysis of the demographic characteristics of its readers. The Marketing department has collected reader survey records containing the age, gender, marital status, and annual income of readers. Design an application that accepts reader data and, when data entry is complete, produces a count of readers by age groups as follows: under 20, 20–29, 30–39, 40–49, and 50 and older.