Skip to content

Commit 4dfe4fa

Browse files
committed
LP4 M2 Solution - removing unused code blocks
1 parent 834edeb commit 4dfe4fa

File tree

4 files changed

+0
-1207
lines changed

4 files changed

+0
-1207
lines changed

DownloadableCodeProjects/LP4_manage-app-data/Data_M2/Solution/Models/CertificateOfDepositAccount.cs

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

33
namespace Data_M2;
44

5-
// Step 1: Create derived classes
6-
7-
85
public class CertificateOfDeposit : BankAccount
96
{
107
public DateTime MaturityDate { get; set; }
@@ -60,11 +57,3 @@ public override string DisplayAccountInfo()
6057
return base.DisplayAccountInfo() + $", Maturity Date: {MaturityDate.ToShortDateString()}, Early Withdrawal Penalty: {EarlyWithdrawalPenalty * 100}%, Interest Rate: {InterestRate * 100}%";
6158
}
6259
}
63-
64-
65-
66-
// Step 2: Update the base class
67-
68-
69-
70-
// Step 3: Create a new instance of the derived class

DownloadableCodeProjects/LP4_manage-app-data/Data_M2/Solution/Services/SimulateCustomerAccountActivity.cs

Lines changed: 0 additions & 282 deletions
Original file line numberDiff line numberDiff line change
@@ -279,285 +279,3 @@ static double[] ReturnMonthlyExpenses()
279279
return monthlyExpenses;
280280
}
281281
}
282-
283-
284-
285-
286-
287-
288-
289-
// using System;
290-
291-
// namespace Data_M2;
292-
293-
// public class SimulateCustomerAccountActivity
294-
// {
295-
// public static BankCustomer SimulateActivityDateRange(DateOnly startDate, DateOnly endDate, BankCustomer bankCustomer)
296-
// {
297-
// // Determine the starting day, month, and year
298-
// int startDay = startDate.Day;
299-
// int startMonth = startDate.Month;
300-
// int startYear = startDate.Year;
301-
302-
// // Determine the ending day, month, and year
303-
// int endDay = endDate.Day;
304-
// int endMonth = endDate.Month;
305-
// int endYear = endDate.Year;
306-
307-
// // Check if the startDate is the first day of the month
308-
// bool isStartDateFirstDayOfMonth = startDay == 1;
309-
310-
// // Check if the endDate is the last day of the month
311-
// bool isEndDateLastDayOfMonth = endDay == DateTime.DaysInMonth(endYear, endMonth);
312-
313-
// // Call SimulateActivityStartDateToEndOfMonth if the startDate is not the first day of the month
314-
// if (!isStartDateFirstDayOfMonth)
315-
// {
316-
// bankCustomer = SimulateActivityStartDateToEndOfMonth(startDate, bankCustomer);
317-
// startDate = new DateOnly(startYear, startMonth, DateTime.DaysInMonth(startYear, startMonth)).AddDays(1);
318-
// }
319-
320-
// // Need to compare the month and year of the start and end dates
321-
// DateOnly startDayFirstFullMonth = new DateOnly(startDate.Year, startDate.Month, 1);
322-
// DateOnly startDayLastFullMonth = new DateOnly(endYear, endMonth, 1);
323-
324-
// // If the start date for the first month and the start date for the last month are the same, then the date range is exactly one month
325-
// if (startDayFirstFullMonth == startDayLastFullMonth)
326-
// {
327-
// // Call SimulateActivityFullMonth once
328-
// bankCustomer = SimulateActivityFullMonth(startDate.Month, startDate.Year, bankCustomer);
329-
// startDate = startDayFirstFullMonth.AddMonths(1);
330-
// }
331-
// else
332-
// {
333-
// // Call SimulateActivityFullMonth for each full month in the date range
334-
// DateOnly currentMonth = startDayFirstFullMonth;
335-
// while (currentMonth < new DateOnly(endYear, endMonth, 1))
336-
// {
337-
// bankCustomer = SimulateActivityFullMonth(currentMonth.Month, currentMonth.Year, bankCustomer);
338-
339-
// currentMonth = currentMonth.AddMonths(1);
340-
// }
341-
// }
342-
343-
// // Call SimulateActivityStartMonthToEndDate if the endDate is not the last day of the month
344-
// if (!isEndDateLastDayOfMonth)
345-
// {
346-
// bankCustomer = SimulateActivityStartMonthToEndDate(endDate, bankCustomer);
347-
// }
348-
349-
// // Return the updated bankCustomer
350-
// return bankCustomer;
351-
// }
352-
353-
// public static BankCustomer SimulateActivityFullMonth(int month, int year, BankCustomer bankCustomer)
354-
// {
355-
// DateOnly firstDayOfMonth = new DateOnly(year, month, 1);
356-
// DateOnly lastDayOfMonth = new DateOnly(year, month, DateTime.DaysInMonth(year, month));
357-
// return SimulateActivityForPeriod(firstDayOfMonth, lastDayOfMonth, bankCustomer);
358-
// }
359-
360-
// public static BankCustomer SimulateActivityStartDateToEndOfMonth(DateOnly startDate, BankCustomer bankCustomer)
361-
// {
362-
// DateOnly lastDayOfMonth = new DateOnly(startDate.Year, startDate.Month, DateTime.DaysInMonth(startDate.Year, startDate.Month));
363-
// return SimulateActivityForPeriod(startDate, lastDayOfMonth, bankCustomer);
364-
// }
365-
366-
// public static BankCustomer SimulateActivityStartMonthToEndDate(DateOnly endDate, BankCustomer bankCustomer)
367-
// {
368-
// DateOnly firstDayOfMonth = new DateOnly(endDate.Year, endDate.Month, 1);
369-
// return SimulateActivityForPeriod(firstDayOfMonth, endDate, bankCustomer);
370-
// }
371-
372-
// private static BankCustomer SimulateActivityForPeriod(DateOnly startDate, DateOnly endDate, BankCustomer bankCustomer)
373-
// {
374-
// double[] monthlyExpenses = ReturnMonthlyExpenses();
375-
376-
// double semiMonthlyPaycheck = monthlyExpenses[0];
377-
// double transferToSavings = monthlyExpenses[1];
378-
// double rent = monthlyExpenses[2];
379-
// double entertainment1 = monthlyExpenses[3];
380-
// double entertainment2 = monthlyExpenses[4];
381-
// double entertainment3 = monthlyExpenses[5];
382-
// double entertainment4 = monthlyExpenses[6];
383-
// double monthlyGasElectric = monthlyExpenses[7];
384-
// double monthlyWaterSewer = monthlyExpenses[8];
385-
// double monthlyWasteManagement = monthlyExpenses[9];
386-
// double monthlyHealthClub = monthlyExpenses[10];
387-
// double creditCardBill = monthlyExpenses[11];
388-
389-
// DateOnly middleOfMonth = new DateOnly(startDate.Year, startDate.Month, 14);
390-
// if (middleOfMonth.DayOfWeek == DayOfWeek.Saturday)
391-
// {
392-
// middleOfMonth = middleOfMonth.AddDays(2);
393-
// }
394-
// else if (middleOfMonth.DayOfWeek == DayOfWeek.Sunday)
395-
// {
396-
// middleOfMonth = middleOfMonth.AddDays(1);
397-
// }
398-
399-
// DateOnly endOfMonth = new DateOnly(endDate.Year, endDate.Month, DateTime.DaysInMonth(endDate.Year, endDate.Month));
400-
// if (endOfMonth.DayOfWeek == DayOfWeek.Saturday)
401-
// {
402-
// endOfMonth = endOfMonth.AddDays(-1);
403-
// }
404-
// else if (endOfMonth.DayOfWeek == DayOfWeek.Sunday)
405-
// {
406-
// endOfMonth = endOfMonth.AddDays(-2);
407-
// }
408-
409-
// if (middleOfMonth >= startDate && middleOfMonth <= endDate)
410-
// {
411-
// bankCustomer.Accounts[0].AddTransaction(new Transaction(middleOfMonth, new TimeOnly(12, 00), semiMonthlyPaycheck, bankCustomer.Accounts[0].AccountNumber, bankCustomer.Accounts[0].AccountNumber, "Deposit", "Bi-monthly salary deposit"));
412-
// }
413-
// if (endOfMonth >= startDate && endOfMonth <= endDate)
414-
// {
415-
// bankCustomer.Accounts[0].AddTransaction(new Transaction(endOfMonth, new TimeOnly(12, 00), semiMonthlyPaycheck, bankCustomer.Accounts[0].AccountNumber, bankCustomer.Accounts[0].AccountNumber, "Deposit", "Bi-monthly salary deposit"));
416-
// }
417-
418-
// if (startDate <= new DateOnly(startDate.Year, startDate.Month, 1) && new DateOnly(startDate.Year, startDate.Month, 1) <= endDate)
419-
// {
420-
// bankCustomer.Accounts[0].AddTransaction(new Transaction(new DateOnly(startDate.Year, startDate.Month, 1), new TimeOnly(12, 00), transferToSavings, bankCustomer.Accounts[0].AccountNumber, bankCustomer.Accounts[1].AccountNumber, "Transfer", "Transfer checking to savings account"));
421-
// bankCustomer.Accounts[0].AddTransaction(new Transaction(new DateOnly(startDate.Year, startDate.Month, 1), new TimeOnly(12, 00), rent, bankCustomer.Accounts[0].AccountNumber, bankCustomer.Accounts[0].AccountNumber, "Withdraw", "Auto-pay rent"));
422-
// }
423-
424-
// DateOnly saturday1 = new DateOnly(startDate.Year, startDate.Month, 1);
425-
// while (saturday1.DayOfWeek != DayOfWeek.Saturday)
426-
// {
427-
// saturday1 = saturday1.AddDays(1);
428-
// }
429-
// DateOnly saturday2 = saturday1.AddDays(7);
430-
// DateOnly saturday3 = saturday2.AddDays(7);
431-
// DateOnly saturday4 = saturday3.AddDays(7);
432-
433-
// if (saturday1 >= startDate && saturday1 <= endDate)
434-
// {
435-
// bankCustomer.Accounts[0].AddTransaction(new Transaction(saturday1, new TimeOnly(21, 00), entertainment1, bankCustomer.Accounts[0].AccountNumber, bankCustomer.Accounts[0].AccountNumber, "Withdraw", "Debit card purchase"));
436-
// }
437-
// if (saturday2 >= startDate && saturday2 <= endDate)
438-
// {
439-
// bankCustomer.Accounts[0].AddTransaction(new Transaction(saturday2, new TimeOnly(21, 00), entertainment2, bankCustomer.Accounts[0].AccountNumber, bankCustomer.Accounts[0].AccountNumber, "Withdraw", "Debit card purchase"));
440-
// }
441-
// if (saturday3 >= startDate && saturday3 <= endDate)
442-
// {
443-
// bankCustomer.Accounts[0].AddTransaction(new Transaction(saturday3, new TimeOnly(21, 00), entertainment3, bankCustomer.Accounts[0].AccountNumber, bankCustomer.Accounts[0].AccountNumber, "Withdraw", "Debit card purchase"));
444-
// }
445-
// if (saturday4 >= startDate && saturday4 <= endDate)
446-
// {
447-
// bankCustomer.Accounts[0].AddTransaction(new Transaction(saturday4, new TimeOnly(21, 00), entertainment4, bankCustomer.Accounts[0].AccountNumber, bankCustomer.Accounts[0].AccountNumber, "Withdraw", "Debit card purchase"));
448-
// }
449-
450-
// DateOnly billDate = new DateOnly(startDate.Year, startDate.Month, 20);
451-
// if (billDate >= startDate && billDate <= endDate)
452-
// {
453-
// bankCustomer.Accounts[0].AddTransaction(new Transaction(billDate, new TimeOnly(12, 00), monthlyGasElectric, bankCustomer.Accounts[0].AccountNumber, bankCustomer.Accounts[0].AccountNumber, "Withdraw", "Auto-pay gas and electric bill"));
454-
// bankCustomer.Accounts[0].AddTransaction(new Transaction(billDate, new TimeOnly(12, 00), monthlyWaterSewer, bankCustomer.Accounts[0].AccountNumber, bankCustomer.Accounts[0].AccountNumber, "Withdraw", "Auto-pay water and sewer bill"));
455-
// bankCustomer.Accounts[0].AddTransaction(new Transaction(billDate, new TimeOnly(12, 00), monthlyWasteManagement, bankCustomer.Accounts[0].AccountNumber, bankCustomer.Accounts[0].AccountNumber, "Withdraw", "Auto-pay waste management bill"));
456-
// bankCustomer.Accounts[0].AddTransaction(new Transaction(billDate, new TimeOnly(12, 00), monthlyHealthClub, bankCustomer.Accounts[0].AccountNumber, bankCustomer.Accounts[0].AccountNumber, "Withdraw", "Auto-pay health club membership"));
457-
// }
458-
459-
// DateOnly monday1 = new DateOnly(startDate.Year, startDate.Month, 1);
460-
// while (monday1.DayOfWeek != DayOfWeek.Monday)
461-
// {
462-
// monday1 = monday1.AddDays(1);
463-
// }
464-
// DateOnly monday2 = monday1.AddDays(7);
465-
// DateOnly monday3 = monday2.AddDays(7);
466-
// DateOnly monday4 = monday3.AddDays(7);
467-
468-
// if (monday1 >= startDate && monday1 <= endDate)
469-
// {
470-
// bankCustomer.Accounts[0].AddTransaction(new Transaction(monday1, new TimeOnly(9, 00), 400.00, bankCustomer.Accounts[0].AccountNumber, bankCustomer.Accounts[0].AccountNumber, "Withdraw", "Withdraw for expenses"));
471-
// }
472-
// if (monday2 >= startDate && monday2 <= endDate)
473-
// {
474-
// bankCustomer.Accounts[0].AddTransaction(new Transaction(monday2, new TimeOnly(9, 00), 400.00, bankCustomer.Accounts[0].AccountNumber, bankCustomer.Accounts[0].AccountNumber, "Withdraw", "Withdraw for expenses"));
475-
// }
476-
// if (monday3 >= startDate && monday3 <= endDate)
477-
// {
478-
// bankCustomer.Accounts[0].AddTransaction(new Transaction(monday3, new TimeOnly(9, 00), 400.00, bankCustomer.Accounts[0].AccountNumber, bankCustomer.Accounts[0].AccountNumber, "Withdraw", "Withdraw for expenses"));
479-
// }
480-
// if (monday4 >= startDate && monday4 <= endDate)
481-
// {
482-
// bankCustomer.Accounts[0].AddTransaction(new Transaction(monday4, new TimeOnly(9, 00), 400.00, bankCustomer.Accounts[0].AccountNumber, bankCustomer.Accounts[0].AccountNumber, "Withdraw", "Withdraw for expenses"));
483-
// }
484-
485-
// if (endOfMonth >= startDate && endOfMonth <= endDate)
486-
// {
487-
// bankCustomer.Accounts[0].AddTransaction(new Transaction(endOfMonth, new TimeOnly(12, 00), creditCardBill, bankCustomer.Accounts[0].AccountNumber, bankCustomer.Accounts[0].AccountNumber, "Withdraw", "Auto-pay credit card bill"));
488-
// }
489-
490-
// DateOnly refundDate = new DateOnly(startDate.Year, startDate.Month, 5);
491-
// if (refundDate >= startDate && refundDate <= endDate)
492-
// {
493-
// bankCustomer.Accounts[1].AddTransaction(new Transaction(refundDate, new TimeOnly(12, 00), 100.00, bankCustomer.Accounts[1].AccountNumber, bankCustomer.Accounts[0].AccountNumber, "Refund", "Refund for overcharge"));
494-
// }
495-
496-
// DateOnly feeDate1 = new DateOnly(startDate.Year, startDate.Month, 3);
497-
// DateOnly feeDate2 = new DateOnly(startDate.Year, startDate.Month, 10);
498-
// if (feeDate1 >= startDate && feeDate1 <= endDate)
499-
// {
500-
// bankCustomer.Accounts[0].AddTransaction(new Transaction(feeDate1, new TimeOnly(12, 00), -50.00, bankCustomer.Accounts[0].AccountNumber, bankCustomer.Accounts[0].AccountNumber, "Fee", "Monthly fee"));
501-
// }
502-
// if (feeDate2 >= startDate && feeDate2 <= endDate)
503-
// {
504-
// bankCustomer.Accounts[0].AddTransaction(new Transaction(feeDate2, new TimeOnly(12, 00), -50.00, bankCustomer.Accounts[0].AccountNumber, bankCustomer.Accounts[0].AccountNumber, "Fee", "Monthly fee"));
505-
// }
506-
507-
// return bankCustomer;
508-
// }
509-
510-
// static double[] ReturnMonthlyExpenses()
511-
// {
512-
// Random random = new Random();
513-
514-
// // Generate a salary paycheck amount. Calculate a random salary amount between 2000 and 5000.
515-
// double semiMonthlyPaycheck = random.Next(2000, 5000);
516-
517-
// // Generate a default transfer that's 25% of the salary paycheck amount rounded down to nearest 100.
518-
// double transferToSavings = Math.Floor(semiMonthlyPaycheck * 0.25 / 100) * 100;
519-
520-
// // Generate a rent amount using random value between 800 and 1600 plus 80% of a paycheck.
521-
// double rent = random.Next(800, 1600) + semiMonthlyPaycheck * 0.8;
522-
523-
// // Generate four random entertainment expense amounts between 150 and 220.
524-
// double entertainment1 = random.Next(150, 220);
525-
// double entertainment2 = random.Next(150, 220);
526-
// double entertainment3 = random.Next(150, 220);
527-
// double entertainment4 = random.Next(150, 220);
528-
529-
// // Generate a monthly gas and electric bill using a random number between 100 and 150.
530-
// double monthlyGasElectric = random.Next(100, 150);
531-
532-
// // Generate a monthly water and sewer bill using a random number between 80 and 90.
533-
// double monthlyWaterSewer = random.Next(80, 90);
534-
535-
// // Generate a monthly waste management bill using a random number between 60 and 70.
536-
// double monthlyWasteManagement = random.Next(60, 70);
537-
538-
// // Generate a monthly health club membership bill using a random number between 120 and 160.
539-
// double monthlyHealthClub = random.Next(120, 160);
540-
541-
// // Generate a random credit card bill between 1000 and 1500 plus 40% of a paycheck.
542-
// double creditCardBill = random.Next(1000, 1500) + semiMonthlyPaycheck * 0.4;
543-
544-
// // Create an array with the monthly expenses
545-
// double[] monthlyExpenses = new double[]
546-
// {
547-
// semiMonthlyPaycheck,
548-
// transferToSavings,
549-
// rent,
550-
// entertainment1,
551-
// entertainment2,
552-
// entertainment3,
553-
// entertainment4,
554-
// monthlyGasElectric,
555-
// monthlyWaterSewer,
556-
// monthlyWasteManagement,
557-
// monthlyHealthClub,
558-
// creditCardBill
559-
// };
560-
561-
// return monthlyExpenses;
562-
// }
563-
// }

0 commit comments

Comments
 (0)