Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Explanation:

here are some changes made to the code respectively!!!!!!!

Shape Interface: The getPrice method is now included in the Shape interface to return the price of the shape.

Rectangle and Circle Classes: Each of these classes has a base price, and the getPrice method returns the price of the shape.

ShapeDecorator: The ShapeDecorator class calculates the total price by adding the decoration cost to the base shape price.

RedShapeDecorator: This decorator adds a cost for the red border and calls showCost to display the total price.

This way, when you call draw() on any decorated shape, it will show the cost of the decoration in addition to the basic shape cost.

CODE 2

Added UTF8Decorator: A new decorator class that ensures data is encoded and decoded using UTF-8 during file write and read operations.

Decorator Logic:

On writeData: Converts the string to UTF-8 bytes and back to a string for consistent encoding.

On readData: Converts the read string back to UTF-8 bytes and then decodes it.

Integration: Can be added to the existing decorator chain (e.g., before EncryptionDecorator) to ensure UTF-8 compatibility.

Other Classes: No changes were made to FileDataSource, DataSourceDecorator, CompressionDecorator, or EncryptionDecorator.

This change enhances character encoding consistency in multi-layered data processing.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages