Skip to content

Commit 77c82d1

Browse files
committed
LP4 M2 - final review and updates to align instructions and starter code
1 parent c12e021 commit 77c82d1

7 files changed

Lines changed: 35 additions & 119 deletions

File tree

DownloadableCodeProjects/LP4_manage-app-data/Data_M2/Starter/Interfaces/IBankCustomer.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ public interface IBankCustomer
1414
string DisplayCustomerInfo();
1515

1616
// TASK 3: Step 2 - Add account-management methods
17-
1817

19-
// Task 3: Steps 3 - 6 should be completed in BankCustomer.cs
18+
2019
}

DownloadableCodeProjects/LP4_manage-app-data/Data_M2/Starter/Models/Bank.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,4 @@ public class Bank
1717
// TASK 2: Step 3 - Implement AddCustomer method
1818

1919

20-
// TASK 10: Add Dictionary for Reports
21-
// Purpose: Manage transaction data for reports in the Bank class.
22-
23-
// TASK 10: Step 1 - Add a method to add transactions to the dictionary
24-
// Placeholder for AddTransactionToReport method
25-
26-
// TASK 10: Step 2 - Add a method to retrieve transactions for a specific key
27-
// Placeholder for GetTransactionsForKey method
2820
}

DownloadableCodeProjects/LP4_manage-app-data/Data_M2/Starter/Models/BankCustomer.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ namespace Data_M2;
66

77
public partial class BankCustomer : IBankCustomer
88
{
9-
// TASK 3: Steps 1 and 2 should be completed in the IBankCustomer interface
109
private static int s_nextCustomerId;
1110
private string _firstName = "Tim";
1211
private string _lastName = "Shao";
@@ -58,6 +57,4 @@ public BankCustomer(BankCustomer existingCustomer)
5857
// TASK 3: Step 6 - initialize the Accounts field by copying from existingCustomer
5958

6059
}
61-
62-
// TASK 3: Step 7 - should be completed in BankCustomerMethods.cs
6360
}

DownloadableCodeProjects/LP4_manage-app-data/Data_M2/Starter/Models/Transaction.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,6 @@
22

33
namespace Data_M2;
44

5-
// TASK 5: Create Transaction Class
6-
// Purpose: Represent deposits, withdrawals, and transfers.
7-
8-
// TASK 5: Step 1 - Add properties for transaction details
9-
// Placeholder for adding properties to represent transaction details
10-
11-
// TASK 5: Step 2 - Add a constructor to initialize transaction details
12-
// Placeholder for adding a constructor to initialize the transaction
13-
14-
155
public class Transaction
166
{
177
// private fields

DownloadableCodeProjects/LP4_manage-app-data/Data_M2/Starter/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class Program
66
{
77
static void Main()
88
{
9-
Console.WriteLine("Bank Application - demonstrate using object collections and dictionaries.");
9+
Console.WriteLine("Bank Application - demonstrate the use of Collections, HashSets, and Dictionaries.");
1010

1111
// TASK 6: Create and Manage Bank, Customers, and Accounts
1212
// This task will set up a bank with customers, accounts, and transactions using object collections.

DownloadableCodeProjects/LP4_manage-app-data/Data_M2/Starter/Services/SimulateDepositsWithdrawalsTransfers.cs

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace Data_M2;
55

6-
// TASK 6: Update SimulateDepositWithdrawTransfer Class
6+
// TASK 5: Update SimulateDepositWithdrawTransfer Class
77
// Purpose: Simulate and log transactions using accounts collection for a customer.
88

99
public class SimulateDepositsWithdrawalsTransfers
@@ -66,7 +66,7 @@ public static BankCustomer SimulateActivityDateRange(DateOnly startDate, DateOnl
6666
private static BankCustomer SimulateActivityForPeriod(DateOnly startDate, DateOnly endDate, BankCustomer bankCustomer)
6767
{
6868

69-
// Task 6: Step 1 - Reset withdrawal limits for savings accounts at the start of the month
69+
// Task 5: Step 1 - Reset withdrawal limits for savings accounts at the start of the month
7070

7171

7272
double[] monthlyExpenses = ReturnMonthlyExpenses();
@@ -210,7 +210,7 @@ private static BankCustomer SimulateActivityForPeriod(DateOnly startDate, DateOn
210210
transactions.Add(new TransactionInfo { Date = feeDate2, Time = new TimeOnly(12, 00), Amount = 50.00, Description = "-(BANK FEE)", TransactionType = "Withdraw" });
211211
}
212212

213-
// Task 6: Step 2 - Check account balance and perform transfers between checking and savings accounts at the end of the month
213+
// Task 5: Step 2 - Check account balance and perform transfers between checking and savings accounts at the end of the month
214214

215215

216216

@@ -221,7 +221,7 @@ private static BankCustomer SimulateActivityForPeriod(DateOnly startDate, DateOn
221221
foreach (var transaction in transactions)
222222
{
223223

224-
// Task 6: Step 3 - Update accounts for each transaction based on its type
224+
// Task 5: Step 3 - Update accounts for each transaction based on its type
225225

226226

227227

@@ -284,17 +284,6 @@ static double[] ReturnMonthlyExpenses()
284284
return monthlyExpenses;
285285
}
286286

287-
// TASK 6: Step 4 - Add methods to simulate deposits
288-
289-
290-
291-
// TASK 6: Step 5 - Add methods to simulate withdrawals
292-
293-
294-
295-
// TASK 6: Step 6 - Add methods to simulate transfers
296-
297-
298287
}
299288

300289
public class TransactionInfo : IComparable<TransactionInfo>

Instructions/Labs/l2p2-lp4-m2-exercise-implement-collection-types.md

Lines changed: 29 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@ Use the following steps to complete this section of the exercise:
109109

110110
1. Run the app and review the output in the terminal window.
111111

112+
Your app should produce output similar to the following:
113+
114+
```plaintext
115+
Bank Application - demonstrate the use of Collections, HashSets, and Dictionaries.
116+
```
117+
112118
To run your app, right-click the **Data_M2** project under SOLUTION EXPLORER, select **Debug**, and then select **Start New Instance**.
113119
114120
## Task 2: Update the Bank class for a customers collection
@@ -334,7 +340,7 @@ Use the following steps to complete this task:
334340
}
335341
```
336342

337-
> **NOTE**: The interface provides both `Transactions (IReadOnlyList<Transaction>)` for safe enumeration and `GetAllTransactions()` for a concrete, potentially mutable list (useful for operations that require a `List<T>`). Use `Transactions` when you don’t need to modify the collection.
343+
> **NOTE**: The application provides `Transactions (IReadOnlyList<Transaction>)` for safe enumeration and `GetAllTransactions()` for a concrete, potentially mutable list (useful for operations that require a `List<T>`).
338344

339345
1. Locate the code comment that begins with `// Task 4: Step 7a`.
340346
@@ -382,6 +388,8 @@ Use the following steps to complete this task:
382388

383389
```
384390

391+
1. Save the BankAccount.cs file.
392+
385393
1. Open the CheckingAccount.cs file, and then locate the `// Task 4: Step 8a` comment.
386394
387395
1. To add logic that logs the withdrawal transaction, add the following code below the comment:
@@ -398,7 +406,7 @@ Use the following steps to complete this task:
398406
AddTransaction(new Transaction(transactionDate, transactionTime, priorBalance, overdraftFee, AccountNumber, AccountNumber, transactionType, overdraftDescription));
399407
```
400408

401-
1. Save the BankAccount.cs file.
409+
1. Save the CheckingAccount.cs file.
402410

403411
1. Build and run the application.
404412

@@ -414,7 +422,7 @@ In this task, you update the SimulateDepositWithdrawTransfer class to support si
414422

415423
Use the following steps to complete this task:
416424

417-
1. Open the SimulateDepositWithdrawTransfer.cs file, and then locate the `// Task 6: Step 1` comment.
425+
1. Open the SimulateDepositWithdrawTransfer.cs file, and then locate the `// Task 5: Step 1` comment.
418426
419427
1. To reset the withdrawal limits for savings accounts at the start of the month, add the following code below the comment:
420428

@@ -429,7 +437,7 @@ Use the following steps to complete this task:
429437
}
430438
```
431439

432-
1. Locate the `// Task 6: Step 2` comment.
440+
1. Locate the `// Task 5: Step 2` comment.
433441
434442
1. To check the account balance and perform transfers between checking and savings accounts, add the following code below the comment:
435443

@@ -448,7 +456,7 @@ Use the following steps to complete this task:
448456
}
449457
```
450458

451-
1. Locate the `// Task 6: Step 3` comment.
459+
1. Locate the `// Task 5: Step 3` comment.
452460
453461
1. To Update accounts for each transaction based on its type, add the following code below the comment:
454462

@@ -474,67 +482,6 @@ Use the following steps to complete this task:
474482
}
475483
```
476484

477-
<!--
478-
1. Locate the `// Task 6: Step 4` comment.
479-
480-
1. To add a method to simulate deposits, add the following code below the comment:
481-
482-
```csharp
483-
public void SimulateDeposit(BankAccount account, double amount)
484-
{
485-
var transaction = new Transaction(
486-
Guid.NewGuid().ToString(),
487-
DateTime.Now,
488-
"Deposit",
489-
amount
490-
);
491-
account.AddTransaction(transaction);
492-
}
493-
```
494-
495-
1. Locate the `// Task 6: Step 4` comment.
496-
497-
1. To add a method to simulate withdrawals, add the following code below the comment:
498-
499-
```csharp
500-
public void SimulateWithdrawal(BankAccount account, double amount)
501-
{
502-
var transaction = new Transaction(
503-
Guid.NewGuid().ToString(),
504-
DateTime.Now,
505-
"Withdrawal",
506-
amount
507-
);
508-
account.AddTransaction(transaction);
509-
}
510-
```
511-
512-
1. Locate the `// Task 6: Step 4` comment.
513-
514-
1. To add a method to simulate transfers, add the following code below the comment:
515-
516-
```csharp
517-
public void SimulateTransfer(BankAccount fromAccount, BankAccount toAccount, double amount)
518-
{
519-
var withdrawal = new Transaction(
520-
Guid.NewGuid().ToString(),
521-
DateTime.Now,
522-
"Transfer Out",
523-
amount
524-
);
525-
fromAccount.AddTransaction(withdrawal);
526-
527-
var deposit = new Transaction(
528-
Guid.NewGuid().ToString(),
529-
DateTime.Now,
530-
"Transfer In",
531-
amount
532-
);
533-
toAccount.AddTransaction(deposit);
534-
}
535-
```
536-
-->
537-
538485
1. Save the SimulateDepositWithdrawTransfer.cs file.
539486

540487
1. Build and run the application.
@@ -666,7 +613,7 @@ Use the following steps to complete this task:
666613
Your app should produce output similar to the following:
667614

668615
```plaintext
669-
Bank Application - demonstrate using object collections and dictionaries.
616+
Bank Application - demonstrate the use of Collections, HashSets, and Dictionaries.
670617

671618
Bank object created...
672619

@@ -871,32 +818,34 @@ Use the following steps to complete this task:
871818
Your app should produce a monthly statement similar to the following:
872819

873820
```plaintext
821+
Monthly statement showing Transfers, Deposits, and Withdrawals...
822+
874823
Monthly Statement for Ni Kang - December 2025
875824
Date Range: 12/1/2025 to 12/31/2025
876825
Summary: Deposits=2, Withdrawals=14, Transfers (unique)=1
877826

878827
Transfers (unique):
879-
12/31/2025 12:00 - Transfer $800.00 - Transfer from checking to savings account
828+
12/31/2025 12:00 - Transfer $900.00 - Transfer from checking to savings account
880829

881830
Deposits:
882-
12/15/2025 12:00 - Deposit $3,272.00 (Checking)
883-
12/31/2025 12:00 - Deposit $3,272.00 (Checking)
831+
12/15/2025 12:00 - Deposit $3,780.00 (Checking)
832+
12/31/2025 12:00 - Deposit $3,780.00 (Checking)
884833

885834
Withdrawals:
886835
12/1/2025 08:00 - Withdrawal $400.00 (Checking)
887-
12/1/2025 12:00 - Withdrawal $2,845.60 (Checking)
888-
12/6/2025 21:00 - Withdrawal $197.00 (Checking)
836+
12/1/2025 12:00 - Withdrawal $3,050.00 (Checking)
837+
12/6/2025 21:00 - Withdrawal $171.00 (Checking)
889838
12/8/2025 08:00 - Withdrawal $400.00 (Checking)
890-
12/13/2025 21:00 - Withdrawal $154.00 (Checking)
839+
12/13/2025 21:00 - Withdrawal $173.00 (Checking)
891840
12/15/2025 08:00 - Withdrawal $400.00 (Checking)
892-
12/20/2025 12:00 - Withdrawal $67.00 (Checking)
893-
12/20/2025 12:00 - Withdrawal $81.00 (Checking)
894-
12/20/2025 12:00 - Withdrawal $102.00 (Checking)
895-
12/20/2025 12:00 - Withdrawal $141.00 (Checking)
896-
12/20/2025 21:00 - Withdrawal $196.00 (Checking)
841+
12/20/2025 12:00 - Withdrawal $61.00 (Checking)
842+
12/20/2025 12:00 - Withdrawal $80.00 (Checking)
843+
12/20/2025 12:00 - Withdrawal $138.00 (Checking)
844+
12/20/2025 12:00 - Withdrawal $132.00 (Checking)
845+
12/20/2025 21:00 - Withdrawal $174.00 (Checking)
897846
12/22/2025 08:00 - Withdrawal $400.00 (Checking)
898-
12/27/2025 21:00 - Withdrawal $185.00 (Checking)
899-
12/31/2025 12:00 - Withdrawal $1,428.00 (Checking)
847+
12/27/2025 21:00 - Withdrawal $164.00 (Checking)
848+
12/31/2025 12:00 - Withdrawal $1,673.00 (Checking)
900849
```
901850

902851
## Clean up

0 commit comments

Comments
 (0)