#C12299. Person Class and Display

    ID: 41710 Type: Default 1000ms 256MiB

Person Class and Display

Person Class and Display

This problem requires you to implement a Person class (named MyClass) that encapsulates a person's name and age as private attributes. You must provide getter and setter methods for these attributes using properties (or equivalent language constructs). In addition, you should implement a function display_person that prints out the person's details in the following format:

Name: <name>
Age: <age>

Your program should read input from stdin and output the formatted results to stdout. The input will consist of two lines: the first line contains a string (the person's name) and the second line contains an integer (the person's age).

Note: Even though the problem may seem simple, proper encapsulation using getters and setters is required. Make sure your solution adheres to the specifications and passes all the test cases.

inputFormat

The input consists of exactly two lines:

  • The first line is a string representing the person's name.
  • The second line is an integer representing the person's age.

outputFormat

The program should output exactly two lines:

  • The first line should be in the format: Name: <name>
  • The second line should be in the format: Age: <age>
## sample
John
30
Name: John

Age: 30

</p>