
Programming Logic and Design, Introductory 7th Edition by Joyce Farrell
Edition 7ISBN: 1285225562
Programming Logic and Design, Introductory 7th Edition by Joyce Farrell
Edition 7ISBN: 1285225562Countrywide Tours conducts sightseeing trips for groups from its home base in Iowa. Create an application that continuously accepts tour data, including a three-digit tour number; the numeric month, day, and year values representing the tour start date; the number of travelers taking the tour; and a numeric code that represents the destination. As data is entered for each tour, verify that the month, day, year, and destination code are valid; if any of these is not valid, continue to prompt the user until valid data is entered. The valid destination codes are shown in Table 6-6.
Design the logic for an application that outputs each tour number, validated start date, destination code, destination name, number of travelers, gross total price for the tour, and price for the tour after discount. The gross total price is the tour price per guest times the number of travelers. The final price includes a discount for each person in larger tour groups, based on Table 6-7.
Step 1 of 3
Pseudo Code:
start
Declarations
num tourNumber,day,month,year,noOfTravellers, destinationCode
num TOTAL_SIZE= 1000000
num ALL_TOUR_NUMBER[TOTAL_SIZE]
num ALL_DAY[TOTAL_SIZE]
num ALL_MONTH[TOTAL_SIZE]
num ALL_YEAR[TOTAL_SIZE]
num ALL_NO_OF_TRAVELLERS[TOTAL_SIZE]
num ALL_DESTINATION_CODE[TOTAL_SIZE]
num PER_PERSON_PRICE_AFTER_DISCOUNT[TOTAL_SIZE]
num GROSS_TOTAL_PRICE[TOTAL_SIZE]
string DESTINATION_NAME [4] = "Chicago", "Boston","Miami","San Francisco"
num PRICE_PER_PERSON[4] =300.00, 480.00, 1050.00,1300.00
num indexArray = 0
continuousAcceptTourDataInput()
TOTAL_SIZE = indexArray
displayandCalculateData()
finish()
stop
continuousAcceptTourDataInput()
while 1
output "Enter the tour number, month, day, year , no of travellers, destination code "
input tourNumber, month, day, year, noOfTravellers, destinationCode
if destinationCode>=1 and destinationCode<=4 and day>=1 and day<=31 and month>=1 and month<=12 then
ALL_TOUR_NUMBER[indexArray] = tourNumber
ALL_DAY[indexArray]= day
ALL_MONTH[indexArray] = month
ALL_YEAR[indexArray] = year
ALL_NO_OF_TRAVELLERS[indexArray] = noOfTravellors
ALL_DESTINATION_CODE[indexArray] =destinationCode
indexArray = indexArray+1
endif
return
displayandCalculateData()
num index = 0
while index<=TOTAL_SIZE
if ALL_NO_TRAVELLERS[index]>=1 and ALL_NO_TRAVELLERS[index]<=5 then
PER_PERSON_PRICE_AFTER_DISCOUNT[index] = PRICE_PER_PERSON[index]
endif
if ALL_NO_TRAVELLERS[index]>=6 and ALL_NO_TRAVELLERS[index]<=12 then
PER_PERSON_PRICE_AFTER_DISCOUNT[index] = PRICE_PER_PERSON[index]-75
endif
if ALL_NO_TRAVELLERS[index]>=13 and ALL_NO_TRAVELLERS[index]<=20 then
PER_PERSON_PRICE_AFTER_DISCOUNT[index] = PRICE_PER_PERSON[index]-125
endif
if ALL_NO_TRAVELLERS[index]>=21 and ALL_NO_TRAVELLERS[index]<=50 then
PER_PERSON_PRICE_AFTER_DISCOUNT[index] = PRICE_PER_PERSON[index]-200
endif
if ALL_NO_TRAVELLERS[index]>=51 then
PER_PERSON_PRICE_AFTER_DISCOUNT[index] = PRICE_PER_PERSON[index]-300
endif
GROSS_TOTAL_PRICE[index] = ALL_NO_OF_TRAVELLERS[index]*PER_PERSON_PRICE_AFTER_DISCOUNT[index]
index = index+1
endwhile
//output data
Step 2 of 3
Step 3 of 3
Why don’t you like this exercise?
Other