Number of Destinations
Price
Label
=300
good or expensive
>=5
=500
Good or Expensive
Write a program that asks the user to enter the number of destinations in a tour and the price of this tour. The program should display the label for this tour. 3). Repetition Structure: Note: this question is based on question 2), feel free to add the loops directly into the code for question 2) if you want. a). Add a validation loop for question 2). The validation loop should verify that the user’s input for the number of destinations is a positive number, otherwise it should display an error message and ask for another input. b). Add a loop for question 2) so that the program repeats when the user wants to check another tour. (In other words, the program should ask the user whether he/she wants to check another tour after labeling a tour; if the user answers ‘yes’, the program should again prompt the user to enter the number of destinations and price, and display the corresponding label.) Part 2) and 3) Sample input & output: (Prompt) Enter the number of destinations: (User enter) 3 (Prompt) Enter the price for the tour: (User enter) 500 (Output) The label of this tour is Expensive (Prompt) Do you want to check another tour? Enter yes if you do: (User enter) yes (Prompt) Enter the number of destinations: (User enter) -1 (Output) Please enter a positive number of destinations. (Prompt) Enter the number of destinations: (User enter) 6 (Prompt) Enter the price for the tour: (User enter) 450 (Output) The label of this tour is Good (Prompt) Do you want to check another tour? Enter yes if you do: (User enter) no
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here