Working With Abstraction Lab
Working With Abstraction Lab
Working With Abstraction Lab
Examples
input output input output input output input output
1 * 2 * 3 * 4 *
* * * * * *
* * * * * * *
* * * * * *
* * * *
* *
*
Hint
Create a PrintRow() method to easily reuse code.
Input
On the first line read the coordinates of the top left and bottom right corner of the Rectangle in the format:
“<topLeftX> <topLeftY> <bottomRightX> <bottomRightY>”.
On the second line, read an integer N and on the next N lines, read the coordinates of points.
Output
For each point, print out the result of the Contains() method.
Examples
input output input output input output
0 0 3 3 True 2 -3 12 3 True 5 8 12 15 False
5 True 4 True 6 True
0 0 False 8 -1 False 0 0 True
0 1 False 11 3 False 5 8 True
4 4 True 1 1 12 15 True
5 3 2 4 8 15 True
1 2 7 15
8 12
Page 1 of 3
Problem 3. Student System
You are given a working project for a small Student System, but the code is very poorly organized. Break up the
code logically into smaller functional units – methods and classes and don’t break the functionality.
The program supports the following commands:
“Create <studentName> <studentAge> <studentGrade>” – creates a new student and adds them to the
repository.
“Show <studentName>” – prints on the console information about a student in the format:
“<studentName> is <studentAge> years old. <commentary>”, where the commentary is based on the
student’s grade.
“Exit” – closes the program.
Do not add any extra validation or functionality to the app!
Examples
input output
Create Pesho 20 5.50 Pesho is 20 years old. Excellent student.
Create Mimi 18 4.50 Mimi is 18 years old. Average student.
Create Gosho 25 3
Show Pesho
Show Mimi
Exit
Input
On a single line you will receive all the information about the reservation in the format:
“<pricePerDay> <numberOfDays> <season> <discountType>”, where:
The price per day will be a valid decimal in the range [0.01…1000.00]
The number of days will be a valid integer in range [1…1000]
The season will be one of: Spring, Summer, Autumn, Winter
The discount will be one of: VIP, SecondVisit, None, but it can also be omitted from the input
Page 2 of 3
Output
On a single line, print the total price of the holiday, rounded to 2 digits after the decimal separator.
Examples
input output
Page 3 of 3