Graderpractice for programmers

Back to 254275 OOP Lab 5-10

Q7. Is it a Large Palace

Problem

A Large Palace is a with if the castle more than 5 and principality 8 . Add a method named is LargePalace that returns true if the Palace is Large Palace

  public static void main(String[] args)
  {
        Scanner sc = new Scanner(System.in);
        int castle = Integer.parseInt(sc.nextLine());
        int principality = Integer.parseInt(sc.nextLine());
        String name = sc.nextLine();
        Palace p = new Palace(castle,principality,name);
        if (p.LargePalace()==true)
        {
          System.out.println(p.getName()+" is a Large Palace");
        }
        else
        {
          System.out.println(p.getName()+" is a Normal Palace");
        }
  }

Examples

Input

8
10
Atom

Output

Palace Atom is a Large Palace

Input

7
12
Versailles

Output

Palace Versailles is a Large Palace

Input

5
7
Alhambra

Output

Palace Alhambra is a Normal Palace

Submit your solution

java