Exemple #1
0
        public static void create_account()
        {
            string name;
            int d, m, y;
            //string dob;
            string nominee;
            double balance=0;
            string id;
            //string c;
            int choice;
            Console.WriteLine("0. Debit Account");
            Console.WriteLine("1. Credit Account");
            Console.WriteLine("2. Savings Account");
            Console.Write("What is your Option: ");
            //c = Console.ReadLine();
            choice = checkException();
            if (choice == 0)
            {
                Console.Write("Account Name: ");
                name = Console.ReadLine();
                //Console.WriteLine("\n");

                Console.Write("Nominee: ");
                nominee = Console.ReadLine();
                //Console.WriteLine("\n");

                Console.WriteLine("Date of Birth:");

                Console.Write("Day(DD):");
                d = checkException();
                //Console.WriteLine("\n");

                Console.Write("Month(MM):");
                m = checkException();
                //Console.WriteLine("\n");

                Console.Write("Year(YYYY):");
                y = checkException();
                //Console.WriteLine("\n");

                DOB db = new DOB(y, m, d);
                if(db.set())
                {
                    id = IDGENERATOR.Generate(choice);
                    Account debit = new Debit(name, id, db.getDOB(), nominee, balance);
                    acccount.Add(debit);

                }
                else
                {
                    bool flag = false;
                    Console.Clear();
                    Console.WriteLine("Enter DOB Again Please:");
                    while (flag != true)
                    {
                        Console.WriteLine("Date of Birth:");

                        Console.Write("Day(DD):");
                        d = checkException();
                        //Console.WriteLine("\n");

                        Console.Write("Month(MM):");
                        m = checkException();
                        //Console.WriteLine("\n");

                        Console.Write("Year(YYYY):");
                        y = checkException();
                        //Console.WriteLine("\n");
                        DOB db1 = new DOB(y, m, d);
                        if (db1.set())
                        {
                            id = IDGENERATOR.Generate(choice);
                            Account debit = new Debit(name, id, db.getDOB(), nominee, balance);
                            acccount.Add(debit);
                            flag = true;
                        }
                    }
                }

            }
            else if(choice == 1)
            {
                Console.Write("Account Name: ");
                name = Console.ReadLine();
                //Console.WriteLine("\n");

                Console.Write("Nominee: ");
                nominee = Console.ReadLine();
                //Console.WriteLine("\n");

                Console.WriteLine("Date of Birth:");

                Console.Write("Day(DD):");
                d = checkException();
                //Console.WriteLine("\n");

                Console.Write("Month(MM):");
                m = checkException();
                //Console.WriteLine("\n");

                Console.Write("Year(YYYY):");
                y = checkException();
                //Console.WriteLine("\n");

                DOB db = new DOB(y, m, d);
                if (db.set())
                {
                    id = IDGENERATOR.Generate(choice);
                    Account credit = new Credit(name, id, db.getDOB(), nominee, balance);
                    acccount.Add(credit);
                }
                else
                {
                    bool flag = false;
                    Console.Clear();
                    Console.WriteLine("Enter DOB Again Please:");
                    while (flag != true)
                    {
                        Console.WriteLine("Date of Birth:");

                        Console.Write("Day(DD):");
                        d = checkException();
                        //Console.WriteLine("\n");

                        Console.Write("Month(MM):");
                        m = checkException();
                        //Console.WriteLine("\n");

                        Console.Write("Year(YYYY):");
                        y = checkException();
                        //Console.WriteLine("\n");
                        DOB db1 = new DOB(y, m, d);
                        if (db1.set())
                        {
                            id = IDGENERATOR.Generate(choice);
                            Account credit = new Credit(name, id, db.getDOB(), nominee, balance);
                            acccount.Add(credit);
                            flag = true;
                        }
                    }
                }
            }
            else if(choice ==2)
            {
                Console.Write("Account Name: ");
                name = Console.ReadLine();
                //Console.WriteLine("\n");

                Console.Write("Nominee: ");
                nominee = Console.ReadLine();
                //Console.WriteLine("\n");

                Console.WriteLine("Date of Birth:");

                Console.Write("Day(DD):");
                d = checkException();
                //Console.WriteLine("\n");

                Console.Write("Month(MM):");
                m = checkException();
                //Console.WriteLine("\n");

                Console.Write("Year(YYYY):");
                y = checkException();
                //Console.WriteLine("\n");

                DOB db = new DOB(y, m, d);
                if (db.set())
                {
                    id = IDGENERATOR.Generate(choice);
                    Account savings = new Savings(name, id, db.getDOB(), nominee, balance);
                    acccount.Add(savings);
                }
                else
                {
                    bool flag = false;
                    Console.Clear();
                    Console.WriteLine("Enter DOB Again Please:");
                    while (flag != true)
                    {
                        Console.WriteLine("Date of Birth:");

                        Console.Write("Day(DD):");
                        d = checkException();
                        //Console.WriteLine("\n");

                        Console.Write("Month(MM):");
                        m = checkException();
                        //Console.WriteLine("\n");

                        Console.Write("Year(YYYY):");
                        y = checkException();
                        //Console.WriteLine("\n");
                        DOB db1 = new DOB(y, m, d);
                        if (db1.set())
                        {
                            id = IDGENERATOR.Generate(choice);
                            Account savings = new Savings(name, id, db.getDOB(), nominee, balance);
                            acccount.Add(savings);
                            flag = true;
                        }
                    }
                }
            }
            else
            {
                create_account();
            }
        }
Exemple #2
0
        public static void create_account()
        {
            string name;
            int    d, m, y;
            //string dob;
            string nominee;
            double balance = 0;
            string id;
            //string c;
            int choice;

            Console.WriteLine("0. Debit Account");
            Console.WriteLine("1. Credit Account");
            Console.WriteLine("2. Savings Account");
            Console.Write("What is your Option: ");
            //c = Console.ReadLine();
            choice = checkException();
            if (choice == 0)
            {
                Console.Write("Account Name: ");
                name = Console.ReadLine();
                //Console.WriteLine("\n");

                Console.Write("Nominee: ");
                nominee = Console.ReadLine();
                //Console.WriteLine("\n");

                Console.WriteLine("Date of Birth:");

                Console.Write("Day(DD):");
                d = checkException();
                //Console.WriteLine("\n");

                Console.Write("Month(MM):");
                m = checkException();
                //Console.WriteLine("\n");

                Console.Write("Year(YYYY):");
                y = checkException();
                //Console.WriteLine("\n");

                DOB db = new DOB(y, m, d);
                if (db.set())
                {
                    id = IDGENERATOR.Generate(choice);
                    Account debit = new Debit(name, id, db.getDOB(), nominee, balance);
                    acccount.Add(debit);
                }
                else
                {
                    bool flag = false;
                    Console.Clear();
                    Console.WriteLine("Enter DOB Again Please:");
                    while (flag != true)
                    {
                        Console.WriteLine("Date of Birth:");

                        Console.Write("Day(DD):");
                        d = checkException();
                        //Console.WriteLine("\n");

                        Console.Write("Month(MM):");
                        m = checkException();
                        //Console.WriteLine("\n");

                        Console.Write("Year(YYYY):");
                        y = checkException();
                        //Console.WriteLine("\n");
                        DOB db1 = new DOB(y, m, d);
                        if (db1.set())
                        {
                            id = IDGENERATOR.Generate(choice);
                            Account debit = new Debit(name, id, db.getDOB(), nominee, balance);
                            acccount.Add(debit);
                            flag = true;
                        }
                    }
                }
            }
            else if (choice == 1)
            {
                Console.Write("Account Name: ");
                name = Console.ReadLine();
                //Console.WriteLine("\n");

                Console.Write("Nominee: ");
                nominee = Console.ReadLine();
                //Console.WriteLine("\n");

                Console.WriteLine("Date of Birth:");

                Console.Write("Day(DD):");
                d = checkException();
                //Console.WriteLine("\n");

                Console.Write("Month(MM):");
                m = checkException();
                //Console.WriteLine("\n");

                Console.Write("Year(YYYY):");
                y = checkException();
                //Console.WriteLine("\n");

                DOB db = new DOB(y, m, d);
                if (db.set())
                {
                    id = IDGENERATOR.Generate(choice);
                    Account credit = new Credit(name, id, db.getDOB(), nominee, balance);
                    acccount.Add(credit);
                }
                else
                {
                    bool flag = false;
                    Console.Clear();
                    Console.WriteLine("Enter DOB Again Please:");
                    while (flag != true)
                    {
                        Console.WriteLine("Date of Birth:");

                        Console.Write("Day(DD):");
                        d = checkException();
                        //Console.WriteLine("\n");

                        Console.Write("Month(MM):");
                        m = checkException();
                        //Console.WriteLine("\n");

                        Console.Write("Year(YYYY):");
                        y = checkException();
                        //Console.WriteLine("\n");
                        DOB db1 = new DOB(y, m, d);
                        if (db1.set())
                        {
                            id = IDGENERATOR.Generate(choice);
                            Account credit = new Credit(name, id, db.getDOB(), nominee, balance);
                            acccount.Add(credit);
                            flag = true;
                        }
                    }
                }
            }
            else if (choice == 2)
            {
                Console.Write("Account Name: ");
                name = Console.ReadLine();
                //Console.WriteLine("\n");

                Console.Write("Nominee: ");
                nominee = Console.ReadLine();
                //Console.WriteLine("\n");

                Console.WriteLine("Date of Birth:");

                Console.Write("Day(DD):");
                d = checkException();
                //Console.WriteLine("\n");

                Console.Write("Month(MM):");
                m = checkException();
                //Console.WriteLine("\n");

                Console.Write("Year(YYYY):");
                y = checkException();
                //Console.WriteLine("\n");

                DOB db = new DOB(y, m, d);
                if (db.set())
                {
                    id = IDGENERATOR.Generate(choice);
                    Account savings = new Savings(name, id, db.getDOB(), nominee, balance);
                    acccount.Add(savings);
                }
                else
                {
                    bool flag = false;
                    Console.Clear();
                    Console.WriteLine("Enter DOB Again Please:");
                    while (flag != true)
                    {
                        Console.WriteLine("Date of Birth:");

                        Console.Write("Day(DD):");
                        d = checkException();
                        //Console.WriteLine("\n");

                        Console.Write("Month(MM):");
                        m = checkException();
                        //Console.WriteLine("\n");

                        Console.Write("Year(YYYY):");
                        y = checkException();
                        //Console.WriteLine("\n");
                        DOB db1 = new DOB(y, m, d);
                        if (db1.set())
                        {
                            id = IDGENERATOR.Generate(choice);
                            Account savings = new Savings(name, id, db.getDOB(), nominee, balance);
                            acccount.Add(savings);
                            flag = true;
                        }
                    }
                }
            }
            else
            {
                create_account();
            }
        }