Skip to content

Latest commit

 

History

History
25 lines (19 loc) · 1.02 KB

File metadata and controls

25 lines (19 loc) · 1.02 KB

oop-examples

OOP examples in Java

Extend existing code

Try to extend the examples in the following way.

package ex01

Users can now participate in a loyalty program, where they are allowed to collect points. For each 100 points, a user gains 1% discount on the price of a product. The maximum discount cannot be greater than 7%. Update existing source code to deal with this new requirement. Update the main method to demonstrate the new behavior.

package ex02

Revisit the main method in order to properly deal with possible exceptions.

package ex04

Update the DrawingMain method to print the aligned lines. Find and fix any bugs, if any.

Implement new code

Introduce package ex05

Create a new package ex05 that revisits the Drawing functionality to support Lines, Arrows and Shapes in a uniform manner. The new Drawing should allow users to both select and deselect its elements and also clean up the selection. Finally, the new Drawing should be Iterable (that is, provide an iterator for all its elements).