Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

QUESTION 6 - SUBMISSION QUESTION This program calculates the payment to be paid for purchasing bus ticket. - Declare all the variables used in this

image text in transcribed

image text in transcribed

QUESTION 6 - SUBMISSION QUESTION This program calculates the payment to be paid for purchasing bus ticket. - Declare all the variables used in this program. - Use a prompt() method to get the user input for the trip code. Save the user's data in a variable named as trip_code. - Use a prompt() method to get the user input for the amount of passengers. Save the user's data in a variable named as passenger_qty. - Ask the user to if the a return ticket is required using a contirm() method. save the user's response in a voriable named need_return_ticket. - Using If else statement, identify the trip destination and ticket price. Store the values in variables trip_dest and ticket_price. Use the table below to construct the If else striamente - Now, calculate the total ticket price. Save the result in a variable named totalticket_price. - Use If else statement to identify if a return ticket is required. If return ticket is required: - Set "Yes' to return_ticket. - Write a formula which doubles the total ticket price. - If return ticket is not required: - Set "No" to return_ticket. - The total ticket price remains unchanged. - Use another If eise statement to identify if a discount is available: If the number of passenger is more than 5 : - A FM 5.00 discount will be given. Otherwise: - No discount will be given. - Now calculate the total payment that need to be settled by the customer. Store the result in a variable named pay. - The sequence of execution ond final output is shown below. Thin page uys be porequie resm takest Sample Output on the browser If a return ticket is required and number of passengers are more than 5 . Destination: Kota Baru [RM 60.00] Number of Passengers : 10 Total: RM 600.00 Return Ticket: RM 1200.00 [Yes] Discount : RM 5.00 [More than 5 passengers] Total travel cost : RM 1195.00 Sample Output on the browser if no return ticket is required and number of passengers are 5 or less. Destination: Kota Baru [RM 60.00 ] Number of Passengers : 3 Total : RM 180.00 Return Ticket : RM 180.00 [No] Discount: RM 0.00 [ 5 passengers or less] Total travel cost : RM 180.00

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Organizing Information Digital And Information Literacy

Authors: Greg Roza

1st Edition

1448805929, 978-1448805921

More Books

Students also viewed these Databases questions

Question

What do you mean by dry condition in combustion?

Answered: 1 week ago

Question

Acceptance of the key role of people in this process of adaptation.

Answered: 1 week ago

Question

preference for well defined job functions;

Answered: 1 week ago