public void Information() //Promting the user with a menu to insert name and age { Console.WriteLine("Bank Register"); Console.Write("Name:"); string name = Console.ReadLine(); Console.Write("Age:"); int age = int.Parse(Console.ReadLine()); DebitCard debit = new DebitCard(name); Maestro maestro = new Maestro(name); Mastercard mastercard = new Mastercard(name); Visaelectron visaelectron = new Visaelectron(name); Visa visa = new Visa(name); if (age <= 18)//Only showing cards that are relevant for the users age { Cardform(debit); } if (age >= 18) { Cardform(visa); Cardform(maestro); } if (age >= 15) { Cardform(visaelectron); } Cardform(mastercard); }
static void Main(string[] args) { CardUser user = new CardUser("Nicky Hansen", 18); BankAccount[] bankAccounts = new BankAccount[5]; for (int i = 0; i < 5; i++) { bankAccounts[i] = new BankAccount(user); } DebitCard debitCard = new DebitCard(bankAccounts[0]); MaestroCard maestroCard = new MaestroCard(bankAccounts[1], DateTime.Now + TimeSpan.FromDays(365 * 5)); VisaElectron visaElectron = new VisaElectron(bankAccounts[2], DateTime.Now + TimeSpan.FromDays(365 * 5)); VisaDankort visaDankort = new VisaDankort(bankAccounts[3], DateTime.Now + TimeSpan.FromDays(365 * 5)); MasterCard masterCard = new MasterCard(bankAccounts[4], DateTime.Now + TimeSpan.FromDays(365 * 5)); debitCard.Deposit(16000); maestroCard.Deposit(16000); visaElectron.Deposit(11000); visaDankort.Deposit(10000); masterCard.Deposit(10000); // DebitCard / MaestroCard Test. Console.WriteLine($"Trying to withdraw: 15000 from debitCard got: {debitCard.Withdraw(15000)}"); Console.WriteLine($"Trying to withdraw: 15000 from maestroCard got: {maestroCard.Withdraw(15000)}"); // VisaElectron Test. Console.WriteLine($"Trying to withdraw: 10000 from visaElectron got: {visaElectron.Withdraw(10000)}"); Console.WriteLine($"Trying to withdraw: 1 from visaElectron got: {visaElectron.Withdraw(1)}"); // VisaDankort Test. Console.WriteLine($"Trying to withdraw: 25000 from visaDankort got: {visaDankort.Withdraw(25000)}"); Console.WriteLine($"Trying to withdraw: 1 from visaDankort got: {visaDankort.Withdraw(1)}"); // MasterCard Test. for (int i = 0; i < 7; i++) { Console.WriteLine($"Trying to withdraw: 5000 from masterCard got: {masterCard.Withdraw(5000)}"); Console.WriteLine("MasterCard Reset Daily Limit"); masterCard.ResetDailyUse(); } Console.WriteLine("-------------------------------------------------------------------"); Console.WriteLine(); Console.WriteLine(debitCard); Console.WriteLine(maestroCard); Console.WriteLine(visaElectron); Console.WriteLine(visaDankort); Console.WriteLine(masterCard); Console.ReadLine(); Console.ReadLine(); }
static void Main(string[] args) { CardNumber cn = new CardNumber(); DateTime dt = DateTime.Now; Maestro mst = new Maestro("Ole", "Jensen", cn.CreateCNumber(14), dt.AddYears(3), "23", 18); DebitCard dbc = new DebitCard("Jørgen", "Hansen", cn.CreateCNumber(14), dt.AddYears(3), "23"); Electron ect = new Electron("Ulla", "Helstrup", cn.CreateCNumber(14), dt.AddYears(3), "23", 10000, 15); Visa via = new Visa("Ole", "Jensen", cn.CreateCNumber(14), dt.AddYears(3), "23", 20000, 25000, 18); Master mtr = new Master("Ole", "Jensen", cn.CreateCNumber(14), dt.AddYears(3), "23", 30000, 40000, 5000); Console.WriteLine("{0}{1}{2}{3}{4}", mst.FirstName, mst.LastName, mst.Cardnumber, mst.ExpirationDate, mst.Accountnumber); }
static void Main(string[] args) { //Instantiere kortene VISAElectron ve = new VISAElectron("Christian Bøgh"); VISA v = new VISA("Christian Bøgh"); Mastercard mas = new Mastercard("Christian Bøgh"); Maestro mae = new Maestro("Christian Bøgh"); DebitCard d = new DebitCard("Christian Bøgh"); //Udskriver ToString metoden Console.WriteLine(ve.ToString()); Console.WriteLine(v.ToString()); Console.WriteLine(mas.ToString()); Console.WriteLine(mae.ToString()); Console.WriteLine(d.ToString()); //Pauser koden og venter på klikket på en tast Console.ReadKey(); }
static void Menu() { while (true) { string temp = ""; Console.WriteLine("Hvad er dit navn"); tempString = Console.ReadLine(); Console.WriteLine("Hvad er din alder"); tempInt = Convert.ToInt32(Console.ReadLine()); User user = new User(tempString, tempInt); if (user.Age < 15) { Console.WriteLine("Du kan få DebitCard eller MasterCard"); Console.WriteLine("Skriv D for Debit M for master"); temp = Console.ReadLine().ToLower(); switch (temp) { case "m": CreditCard M = new MasterCard(); M.CreateCard(user.Name); Console.WriteLine(M.ToString()); break; case "d": CreditCard DC = new DebitCard(); DC.CreateCard(user.Name); Console.WriteLine(DC.ToString()); break; } } if (user.Age > 18 || user.Age == 18) { Console.WriteLine("Du kan få Maestro, DebitCard, Mastercard eller Visa/Dankort"); Console.WriteLine("Skriv D for Debit MC for master VD for Visa M for Maestro"); temp = Console.ReadLine().ToLower(); switch (temp) { case "d": CreditCard DC = new DebitCard(); DC.CreateCard(user.Name); Console.WriteLine(DC.ToString()); break; case "mc": CreditCard MC = new MasterCard(); MC.CreateCard(user.Name); Console.WriteLine(MC.ToString()); break; case "vd": CreditCard VD = new VisaDankort(); VD.CreateCard(user.Name); Console.WriteLine(VD.ToString()); break; case "m": CreditCard M = new Maestro(); M.CreateCard(user.Name); Console.WriteLine(M.ToString()); break; default: break; } } if (user.Age == 15 || user.Age > 15) { Console.WriteLine("Du kan få Maestro, DebitCard, Mastercard, Visa Electron eller Visa/Dankort"); Console.WriteLine("Skriv D for Debit MC for master VD for VisaDankort VE for VisaElectron M for Maestro"); temp = Console.ReadLine().ToLower(); switch (temp) { case "d": CreditCard DC = new DebitCard(); DC.CreateCard(user.Name); Console.WriteLine(DC.ToString()); break; case "mc": CreditCard MC = new MasterCard(); MC.CreateCard(user.Name); Console.WriteLine(MC.ToString()); break; case "vd": CreditCard VD = new VisaDankort(); VD.CreateCard(user.Name); Console.WriteLine(VD.ToString()); break; case "m": CreditCard M = new Maestro(); M.CreateCard(user.Name); Console.WriteLine(M.ToString()); break; case "ve": CreditCard VE = new VisaElectron(); VE.CreateCard(user.Name); Console.WriteLine(VE.ToString()); break; default: break; } } } }