Knowee
Questions
Features
Study Tools

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.

Question

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.

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

Solution

Sure, here is a simple Java application that meets the requirements:

import java.util.Scanner;

public class SkyAirlines {
    private String name;
    private String source;
    private String destination;

    public SkyAirlines(String name, String source, String destination) {
        this.name = name;
        this.source = source;
        this.destination = destination;
    }

    public void printMessage() {
        System.out.println("Dear " + this.name + ", welcome onboard with service from " + this.source + " to " + this.destination + ". Thank you for choosing Sky Airlines. Enjoy your flight.");
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("Enter name");
        String name = scanner.nextLine();
        System.out.println("Enter source");
        String source = scanner.nextLine();
        System.out.println("Enter destination");
        String destination = scanner.nextLine();
        SkyAirlines skyAirlines = new SkyAirlines(name, source, destination);
        skyAirlines.printMessage();
    }
}

This program first asks for the user's name, source, and destination. It then creates a SkyAirlines object with these values and calls the printMessage method to print the desired message.

This problem has been solved

Similar Questions

A coffee shop wants to display the message "Thank you for your order" on the screen for the customers who have placed their orders. Write a Java program to print that message.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 exit the program.Hi, I'm "Friendly Hendy" and I can help you write the solution for this description.You are provided with a UserInterface class with the main method. Print the statement "Thank you for your order" using System.out.println() method. System.out.println("Thank you for your order");Sample Input /Output:Thank you for your order

Complete the main method in the StringPrinter class by: Declaring an instance of a String variable called message, which stores the user’s response when asked to “Input string: “.Using a for loop to print each character stored inside the message variable.(Hint: use the .length() and .charAt() methods for String objects)

Select the correct answerWhat is the output of the following Java program?class Parent { String name = "parent"; String message() { return "from parent"; }}class Child extends Parent { String name = "child"; String message() { return "from child"; }}public class Main { public static void main(String[] args) { Parent p = new Child(); System.out.println(p.name + " " + p.message()); }}Options"child from child""parent from parent""parent from child""child from parent"

Select the correct answerWhat is the output of the following Java program?class Parent { String name = "parent"; String message() { return "from parent"; }}class Child extends Parent { String name = "child"; String message() { return "from child"; }}public class Main { public static void main(String[] args) { Parent p = new Child(); System.out.println(p.name + " " + p.message()); }}Options"parent from parent""parent from child""child from parent""child from child"

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

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.