Browse Source

docs: formatting

pull/2651/head
amin 3 months ago committed by zanninso
parent
commit
b48006ef88
  1. 14
      subjects/java/checkpoints/date-formatter/README.md

14
subjects/java/checkpoints/date-formatter/README.md

@ -3,25 +3,25 @@
### Instructions ### Instructions
Write a class `DateFormatter` that has three private attributes: 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. - `date`: the date to be formatted (as a date).
* `formattedDate`: contains the date converted into the given format. - `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. 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: #### The accepted date formats are:
- `DD/MM/YYYY` - `DD/MM/YYYY`
- `DD Month YYYY` - `DD Month YYYY`
- `DD.MM.YYYY` - `DD.MM.YYYY`
#### The accepted date formats are: #### The accepted date formats are:
- `DD/MM/YYYY` - `DD/MM/YYYY`
- `DD Month YYYY` - `DD Month YYYY`
- `DD.MM.YYYY` - `DD.MM.YYYY`
### Expected Functions ### Expected Functions
```java ```java
@ -38,6 +38,7 @@ public class DateFormatter {
``` ```
### Usage ### Usage
Here is a possible ExerciseRunner.java to test your class: Here is a possible ExerciseRunner.java to test your class:
```java ```java
@ -59,6 +60,7 @@ public class ExerciseRunner {
``` ```
### Expected Output ### Expected Output
```shell ```shell
$ javac *.java -d build $ javac *.java -d build
$ java -cp build ExerciseRunner $ java -cp build ExerciseRunner

Loading…
Cancel
Save