From b48006ef8857c2f040d11a58133ecfa8001da5cd Mon Sep 17 00:00:00 2001 From: amin Date: Fri, 21 Jun 2024 17:48:41 +0100 Subject: [PATCH] docs: formatting --- .../java/checkpoints/date-formatter/README.md | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/subjects/java/checkpoints/date-formatter/README.md b/subjects/java/checkpoints/date-formatter/README.md index 4502c949f..fe5d1c2a0 100644 --- a/subjects/java/checkpoints/date-formatter/README.md +++ b/subjects/java/checkpoints/date-formatter/README.md @@ -2,26 +2,26 @@ ### Instructions -Write a class `DateFormatter` that has three private attributes: -* `date`: the date to be formatted (as a date). -* `format`: the format to convert the date to. -* `formattedDate`: contains the date converted into the given format. +Write a class `DateFormatter` that has three private attributes: + +- `date`: the date to be formatted (as a date). +- `format`: the format to convert the date to. +- `formattedDate`: contains the date converted into the given format. Create getters for all the attributes and setters for `date` and `format`. The conversion should happen when you set the `format` or the `date`. If the `format` is not correct, the conversion shouldn't happen. Additionally, create methods to output the date in the specified `format`, and constructors with only the `date`, with `date` and `format`, and a default constructor. #### The accepted date formats are: + - `DD/MM/YYYY` - `DD Month YYYY` - `DD.MM.YYYY` - #### The accepted date formats are: + - `DD/MM/YYYY` - `DD Month YYYY` - `DD.MM.YYYY` - - ### Expected Functions ```java @@ -38,6 +38,7 @@ public class DateFormatter { ``` ### Usage + Here is a possible ExerciseRunner.java to test your class: ```java @@ -59,6 +60,7 @@ public class ExerciseRunner { ``` ### Expected Output + ```shell $ javac *.java -d build $ java -cp build ExerciseRunner @@ -67,4 +69,4 @@ $ java -cp build ExerciseRunner 31.12.2022 31 December 2022 $ -``` \ No newline at end of file +```