Graderpractice for programmers

Back to 254275 OOP - Labs 6-10 Review

3. Is it a jumbo jet?

Problem

A jumbo jet has 250 or more seats. Add a method named isJumbo that returns true if the aeroplane is a jumbo jet.

Test code:

class Task3 {

    public static void main(String[] args) {
        Aeroplane ap = input();
        if (ap.isJumbo()) {
            System.out.println(ap.getModel() + " is a jumbo jet");
        } else {
            System.out.println(ap.getModel() + " is not a jumbo jet");
        }
    }

    public static Aeroplane input() {
        Scanner sc = new Scanner(System.in);
        String model = sc.nextLine();
        int engines = Integer.parseInt(sc.nextLine());
        int seats = Integer.parseInt(sc.nextLine());
        return new Aeroplane(model, engines, seats);
    }
}

Examples

Input

Boeing 747
4
416

Output

Boeing 747 is a jumbo jet

Input

Airbus A320
2
180

Output

Airbus A320 is not a jumbo jet

Submit your solution

java