Skip to content

Commit 87887fe

Browse files
committed
Display currency values in appropriate format
1 parent 265dedd commit 87887fe

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/StructuralPatterns/Composite/CompositeLibrary/GiftExample/CompositeGift.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public void Add(Gift gift)
2424

2525
public void Remove(Gift gift)
2626
{
27-
// Please think about using HashSet or Dictionary if you need remove item from a collection
27+
// Consider using HashSet or Dictionary if you need remove item from a collection.
2828
_gifts.Remove(gift);
2929
}
3030

src/StructuralPatterns/Composite/CompositeLibrary/GiftExample/GiftExecutor.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ public static void Execute()
1111

1212
var smartWatchGift = new SimpleGift("Smart watch", 200);
1313
var smartWatchPrice = smartWatchGift.CalculatePrice();
14-
Console.WriteLine($"Total price for smart watch gift: {smartWatchPrice}");
14+
Console.WriteLine($"Total price for smart watch gift: {smartWatchPrice:C}");
1515

1616
Console.WriteLine();
1717

1818
var familyGift = new CompositeGift("Family gift");
1919
var dadsGift = new SimpleGift("Fishing rod", 50);
2020
var momsGift = new SimpleGift("Necklace", 80);
21-
var childrenGift = new CompositeGift("Children git");
21+
var childrenGift = new CompositeGift("Children gift");
2222
var soldierToy = new SimpleGift("Soldier toy", 40);
2323
var barbieToy = new SimpleGift("Barbie toy", 50);
2424

@@ -30,7 +30,7 @@ public static void Execute()
3030
familyGift.Add(childrenGift);
3131

3232
var familyGiftPrice = familyGift.CalculatePrice();
33-
Console.WriteLine($"Total price for family gift: {familyGiftPrice}");
33+
Console.WriteLine($"Total price for family gift: {familyGiftPrice:C}");
3434
}
3535
}
3636
}

src/StructuralPatterns/Composite/CompositeLibrary/GiftExample/SimpleGift.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public SimpleGift(string description, decimal price)
1212

1313
public override decimal CalculatePrice()
1414
{
15-
Console.WriteLine($"'{_description}' with the price {_price}");
15+
Console.WriteLine($"'{_description}' with the price of {_price:C}");
1616

1717
return _price;
1818
}

0 commit comments

Comments
 (0)