Knowee
Questions
Features
Study Tools

Raju requires a program that prompts him to enter his name, ticket price, and travel destination. The program should then verify the availability of the chosen destination. If the destination is Delhi, the program should display a message indicating its unavailability. For all other destinations, the program should print Raju's details, including his name, ticket price, and destination.Input format :The first line of input consists of the string, representing the Passenger's name.The second line of input consists of a double, representing the ticket price.The third line of input consists of the string, and destination location.Output format :The output displays the following passenger information:Name: [Passenger's Name]Ticket Price: Rs. [Ticket Price]Destination Location: [Destination Location]If the destination is Delhi, print "Sorry, Delhi is not available as a destination".Refer to the sample output for the formatting specifications.Code constraints :In this scenario, the test cases will fall under the following constraintsThe input string with at most 49 characters.1000.00 ≤ ticket price ≤ 10000.00Sample test cases :Input 1 :Harpreet1200.50AmritsarOutput 1 :Passenger Information:Name: HarpreetTicket Price: Rs. 1200.50Destination Location: AmritsarInput 2 :Gurpreet1800.75DelhiOutput 2 :Sorry, Delhi is not available as a destination

Question

Raju requires a program that prompts him to enter his name, ticket price, and travel destination. The program should then verify the availability of the chosen destination. If the destination is Delhi, the program should display a message indicating its unavailability. For all other destinations, the program should print Raju's details, including his name, ticket price, and destination.Input format :The first line of input consists of the string, representing the Passenger's name.The second line of input consists of a double, representing the ticket price.The third line of input consists of the string, and destination location.Output format :The output displays the following passenger information:Name: [Passenger's Name]Ticket Price: Rs. [Ticket Price]Destination Location: [Destination Location]If the destination is Delhi, print "Sorry, Delhi is not available as a destination".Refer to the sample output for the formatting specifications.Code constraints :In this scenario, the test cases will fall under the following constraintsThe input string with at most 49 characters.1000.00 ≤ ticket price ≤ 10000.00Sample test cases :Input 1 :Harpreet1200.50AmritsarOutput 1 :Passenger Information:Name: HarpreetTicket Price: Rs. 1200.50Destination Location: AmritsarInput 2 :Gurpreet1800.75DelhiOutput 2 :Sorry, Delhi is not available as a destination

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

This problem can be solved using a simple if-else statement in any programming language. Here is a step-by-step solution in Python:

Step 1: First, we need to take the inputs from the user. We can use the input() function in Python for this purpose.

name = input("Enter your name: ")
ticket_price = float(input("Enter the ticket price: "))
destination = input("Enter the destination: ")

Step 2: Next, we need to check if the destination is Delhi. If it is, we print a message indicating its unavailability. If it's not, we print the passenger's details.

if destination == "Delhi":
    print("Sorry, Delhi is not available as a destination")
else:
    print("Passenger Information:")
    print("Name: " + name)
    print("Ticket Price: Rs. " + str(ticket_price))
    print("Destination Location: " + destination)

That's it! This program will work as per Raju's requirements.

This problem has been solved

Similar Questions

Rohan's VacationRohan was going on a long vacation across various cities in the world. He had made an itinerary containing all the information about his journey. He had flight tickets booked as well.Unfortunately, at the last minute, someone just ran into him and all his tickets fell on the floor.Help him to find the correct order of all the tickets by finding the correct path from source to destination.Input Format:First line of the input contains a number N, indicating the number of tickets he has.Next lines each contain two strings made of alphabets, each separated by a space, the src(source) and the dest (destination).Output format:Print a single line containing the entire journey plan (itinery) of Rahul.Constraints:1 <= N <= 5001 <= len(src), len(dest) <= 50Source and destination strings are made up of alphabets(uppercase/lowercase).Example Input:3DEL KOLMAA DELKOL GOAExample Output:MAA DEL KOL GOAExplanation:Given the tickets from DEL to KOL, MAA to DEL, KOL to GOA,If we arrange the properly, we can see that Rohan starts from MAA then goes to DEL,And then from DEL he has ticket to KOL and from KOL he has ticket to GOA, so we print his entire itinerary.

Luxury transport service offers luxurious travel facilities to passengers. At the time of ticket booking, the passengers have to give their details like name, age, gender, aadhaar number, pickup location and destination location.  You are free to use any of the collection types to store passengers’ details. Write a user-defined function in python:To display the count of male and female passengers.To fetch the passenger details for a specific pickup location. If that location is not found,  print “not found”. Else, display the name and age of those passengers.Given an aadhaar number, display the pickup location and destination location of that passenger. Input FormatFirst line represents the number of passengers, N.Subsequent lines represent passenger information (name, age, gender, aadhaar number, pickup location and destination location).Next line represents the pickup location for which the name and age of those passengers who board at that location have to be foundLast line represents the aadhaar number for whom the pickup location and destination location have to be found Sample Input:3Deepu29female123456789011chrompettrichyAnanya21female123567849010airportmaduraiVarun27male789456123074chrompetmaduraichrompet123567849010 Sample Output:male 1female 2Deepu 29Varun 27

Single File Programming QuestionProblem StatementIn a busy airport, passengers are holding tickets with unique numbers. Write a program using the linear search algorithm to check if a given ticket number exists in the array of ticket numbers. If the ticket number is found, print a congratulatory message along with the position where it's found. If the ticket number is not found, encourage the passenger with a message for better luck on the next attempt.Input format :The first line of input consists of an integer N, representing the number of tickets.The second line consists of N space-separated integers, representing the ticket numbers.The third line consists of an integer, representing the ticket number to search.Output format :If the ticket number is found, print "Congratulations! Ticket number X found at position Y!", where X is the ticket number and Y is the position (position starts from 1).Otherwise, print "Better luck next time! Ticket number X not found!", where X is the ticket number.Refer to the sample output for formatting specifications.Code constraints :1 ≤ N ≤ 1010 ≤ ticket number ≤ 1000Sample test cases :Input 1 :5123 456 789 321 654321Output 1 :Congratulations! Ticket number 321 found at position 4!Input 2 :6741 456 982 364 789 258369Output 2 :Better luck next time! Ticket number 369 not found!

The Sky Airlines company wants to print a message based on the inputs given by the customers. Help them by writing a Java application to get the customer's name, source, and destination and print the message in the following format.Note:In the Sample Input / Output provided, the highlighted text in bold corresponds to the input given by the user, and the rest of the text represents the output.Ensure to follow the object-oriented specifications provided in the question description.Ensure to provide the names for classes, attributes, and methods as specified in the question description.Adhere to the code template, if provided.Please do not use System.exit(0) to terminate the program.Sample Input:Enter nameJackEnter sourceDubai Enter destinationChicagoSample Output:Dear Jack, welcome onboard with service from Dubai to Chicago. Thank you for choosing Sky Airlines. Enjoy your flight.

Problem StatementRahul wants to share some basic information about his college and location with others. Rahul attends Lovely Professional University in Punjab, India. To express this information, Rahul writes a small program that prints out these details when executed. Ensure that the program precisely outputs these details, emphasizing the correct spelling, spacing, and character set (new line). The details are:My College Name: Lovely Professional UniversityMy Place: PunjabMy Country: IndiaInput format :No console input.Output format :The output displays the details as mentioned in the problem statement.Refer to the sample output for formatting specifications.Sample test cases :Input 1 :Output 1 :My College Name: Lovely Professional UniversityMy Place: PunjabMy Country: India

1/1

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.