Welcome to Nick and Ian's DevPro Christmas Code-Off 2024! We will review these instructions with you before starting the timer.
Every mistake in your solution will add 1 minute to your time! Also, if your solution fails to produce the exact output for part 1 will result in a 5 minute penalty.
npm install
npm start
- Create
NicenessRating.ts
exporting aNicenessRating
enum with 4 values:NICE
VERY_NICE
NAUGHTY
VERY_NAUGHTY
- Convert hardcoded strings to enum references in
main.ts
andCoalCalculator.ts
. - Refactor all nicenessRating function arguments to use the new enum.
- Lines 7-15, refactor nicenessRating
if-else-if
to a switch statement. - Lines 17-23, remove
else
statements and return totalCoal as soon as it is known. - Extract coalCoefficient and totalCoal calculations into separate methods named
getCoalCoefficient
andgetTotalCoal
.
- Rename the
GiftThing
class toGiftCalculator
. - Rename the
GiftThing.ts
file toGiftCalculator.ts
. - Remove
else
statements ingetGiftThing
and return giftTotal as soon as it is known. - Rename the
getGiftThing
method togetGiftTotal
.
- create a
Person.ts
file and create and export aPerson
interface containing the following fields:name
of typestring
age
of typenumber
nicenessRating
of typeNicenessRating
- Update the
printGiftTotal
method inmain.ts
to take in a singlePerson
argument instead of 3 seperate arguments.
- Create and export a new
NiceList
class in a newNiceList.ts
file with one method calledgetList
returning an array ofPerson
. Return the hard-coded values insantasList
frommain.ts
from this method. - Update
main.ts
to use the new function to populatesantasList
.
- Move
CoalCalculator.ts
andGiftCalculator.ts
into a newcalculator
directory undersrc
. - Move
Person.ts
andNicenessRating.ts
into a newmodel
directory undersrc
.
Nick recieves: 1 gifts
Nick Jr. recieves: 2 gifts
Baby Nick recieves: 3 gifts
Ian recieves: 1 gifts
Ian Jr. recieves: 2 gifts
Baby Ian recieves: 3 gifts
Rawley recieves: 4 lumps of coal
Rawley Jr. recieves: 1 lumps of coal
Baby Rawley recieves: 1 gifts
Tim recieves: 9 lumps of coal
Tim Jr. recieves: 4 lumps of coal
Baby Tim recieves: 1 lumps of coal
Manually convert the InvoiceListDto
class in JavaClass.java
into a valid JSON object with the same schema.
Include the the following values with the JSON object:
{
[
{
0d16892e-7992-4d70-9301-d7ecaca1ebd3
553ba3a1-24b4-433b-a0e2-4f210b71aaaa
"Jan-15-2023"
"Sep-1-2024"
"PAID"
"Nick&Ian"
"ACME Coding INC. Memo: Fixed all DevPro bugs"
"ACME Coding INC."
"acmecoding@inc.com"
"P. Sherman, 42 Wallaby Way, Sydney"
"H. Potter, 42 Privet Drive, Little Whinging, England"
9001
"$800"
"$800,000"
[
{
6fb56f4a-9b36-4a04-b1f6-7960b8907be8
aa426d90-c699-4e1a-b871-f54ad0566e85
"Nick&Ian"
}
]
false
true
}
]
"oldInvoices"
}