Graderpractice for programmers

Back to 254275 OOP Lab 5-10

Q5. Palace of Atom

Problem

Palace of Atom, also known as "Wang Dong Programmer", this elegant place is full of knowledge of Various programming The palace is located at Phitsanulok - Nakhon Sawan 99 Moo 9, Tha Pho Subdistrict Tha Pho, Mueang Phitsanulok District, 65000 The key is that this palace has been stung by programmers as Provide the best programming knowledge
Write a class named Palace with fields for "castle" and "principality".

  • getCastle returns the number of castles
  • getPrincipality returns the number of principality
Template:
 public static void main(String[] args)
 {
      Scanner sc = new Scanner(System.in);
      Palace p = new Palace(sc.nextInt(), sc.nextInt());
      System.out.print("Palace of Atom has "+p.getCastle()+ " Castle");
      if(p.getCastle()>1)
      {
          System.out.print("s");
      }
      System.out.print(" including "+p.getPrincipality()+" Principality");
      if(p.getPrincipality()>1)
      {
          System.out.print("s");
      }
   }

Examples

Input

1
1

Output

Palace of Atom has 1 Castle including 1 Principality

Input

3
5

Output

Palace of Atom has 3 Castles including 5 Principalitys

Submit your solution

java