public void ProcessIncorrectPinInput(CreditCardAccount account)
 {
     account.IncorrectPinInputCounter++;
     if (account.IncorrectPinInputCounter > incorrectNumberOfPinInputsAllowed)
     {
         account.IsBlocked = true;
     }
 }
Beispiel #2
0
        public void TestGetMinPayment()
        {
            var testInput   = American.RandomAmerican(Etx.RandomAdultBirthDate(), Gender.Female);
            var testSubject = new CreditCardAccount(new VisaCc(testInput, new DateTime(2014, 1, 11), null), CreditCardAccount.DF_MIN_PMT_RATE, new Pecuniam(1800.0M));

            testSubject.MakePurchase(new DateTime(2014, 1, 11), new Pecuniam(63.32M));
            testSubject.MakePurchase(new DateTime(2014, 1, 11), new Pecuniam(7.54M));
            testSubject.MakePurchase(new DateTime(2014, 1, 12), new Pecuniam(139.47M));
            testSubject.MakePurchase(new DateTime(2014, 1, 12), new Pecuniam(2.38M));
            testSubject.MakePurchase(new DateTime(2014, 1, 14), new Pecuniam(57.89M));
            testSubject.MakePurchase(new DateTime(2014, 1, 14), new Pecuniam(10.09M));
            testSubject.MakePurchase(new DateTime(2014, 1, 15), new Pecuniam(7.78M));
            testSubject.MakePurchase(new DateTime(2014, 1, 15), new Pecuniam(52.13M));
            testSubject.MakePurchase(new DateTime(2014, 1, 15), new Pecuniam(22.95M));
            testSubject.MakePurchase(new DateTime(2014, 1, 16), new Pecuniam(47.59M));
            testSubject.MakePurchase(new DateTime(2014, 1, 17), new Pecuniam(703.65M));
            testSubject.MakePurchase(new DateTime(2014, 1, 17), new Pecuniam(32.11M));
            testSubject.MakePurchase(new DateTime(2014, 1, 17), new Pecuniam(12.83M));
            testSubject.MakePurchase(new DateTime(2014, 1, 18), new Pecuniam(60.83M));
            testSubject.MakePurchase(new DateTime(2014, 1, 20), new Pecuniam(57.64M));
            testSubject.MakePurchase(new DateTime(2014, 1, 20), new Pecuniam(49.07M));
            testSubject.MakePurchase(new DateTime(2014, 1, 21), new Pecuniam(3.55M));
            testSubject.MakePurchase(new DateTime(2014, 1, 24), new Pecuniam(6.94M));
            testSubject.MakePurchase(new DateTime(2014, 1, 25), new Pecuniam(6.94M));
            testSubject.MakePurchase(new DateTime(2014, 1, 27), new Pecuniam(10.61M));
            testSubject.MakePurchase(new DateTime(2014, 1, 27), new Pecuniam(50.73M));
            testSubject.MakePurchase(new DateTime(2014, 1, 28), new Pecuniam(8.32M));

            var testResult = testSubject.GetMinPayment(new DateTime(2014, 1, 28));

            Assert.AreEqual(-17.58M, testResult.Amount);
            Console.WriteLine(testResult);
            Console.WriteLine(testSubject.GetValueAt(new DateTime(2014, 1, 28)));

            testSubject.MakePurchase(new DateTime(2014, 1, 30), new Pecuniam(61.28M));
            testSubject.MakePurchase(new DateTime(2014, 2, 1), new Pecuniam(23.11M));
            testSubject.MakePurchase(new DateTime(2014, 2, 2), new Pecuniam(9.83M));
            testSubject.MakePurchase(new DateTime(2014, 2, 3), new Pecuniam(8.53M));
            testSubject.MakePurchase(new DateTime(2014, 2, 3), new Pecuniam(2.09M));
            testSubject.MakePurchase(new DateTime(2014, 2, 4), new Pecuniam(7.79M));
            testSubject.MakePurchase(new DateTime(2014, 2, 6), new Pecuniam(47.24M));
            testSubject.MakePurchase(new DateTime(2014, 2, 7), new Pecuniam(55.95M));
            testSubject.MakePurchase(new DateTime(2014, 2, 7), new Pecuniam(30.1M));
            testSubject.MakePurchase(new DateTime(2014, 2, 8), new Pecuniam(37.39M));
            testSubject.MakePurchase(new DateTime(2014, 2, 10), new Pecuniam(3.91M));
        }
        static void Main(string[] args)
        {
            Students s1 = new Students("Christina", "Zuniga", "123456", 3.9f);

            Console.WriteLine(s1);

            Vehicle v1 = new Vehicle("Toyota", "Prius", 2015, 2900);

            Console.WriteLine(v1);

            Login l1 = new Login("czuniga989", "bigbadbabbies");

            Console.WriteLine(l1);

            ContactInfo c1 = new ContactInfo("3919 Independance BLVD", "Kansas City", "Kansas", "66109", "(913)867-5309", "emailthis@hotmail");

            Console.WriteLine(c1);

            Customer cus1 = new Customer("123456", "Christina", "Zuniga", c1);

            Console.WriteLine(cus1);

            CreditCardAccount cc1 = new CreditCardAccount(12545235, cus1, 50, true, 15);

            Console.WriteLine(cc1);

            Book b1 = new Book("The Joy of Programing", "Michael Zuniga", 621);

            Console.WriteLine(b1);
            List <Book> Books = new List <Book>()
            {
                b1
            };

            Library lb1 = new Library(Books, "ParkHill Library", "12354 Happy Street", "Kansas City", "Kansas", "66025");

            Console.WriteLine(lb1);

            Song sg1 = new Song("Barnes & Barnes", "Fish Heads", 146);

            Console.WriteLine(sg1);

            Artist a1 = new Artist("The Firm", "Star Trekking'", 212, "Novelty Song");

            Console.WriteLine(a1);
        }
Beispiel #4
0
        public void TestGetMinPayment()
        {
            var testInput = new NorthAmerican(NoFuture.Rand.Domus.NAmerUtil.GetWorkingAdultBirthDate(), Gender.Female);
            var testSubject = new CreditCardAccount(new VisaCc(testInput, new DateTime(2014,1,11), null), CreditCardAccount.DF_MIN_PMT_RATE, new Pecuniam(1800.0M));

            testSubject.Pop(new DateTime(2014, 1, 11), new Pecuniam(63.32M));
            testSubject.Pop(new DateTime(2014, 1, 11), new Pecuniam(7.54M));
            testSubject.Pop(new DateTime(2014, 1, 12), new Pecuniam(139.47M));
            testSubject.Pop(new DateTime(2014, 1, 12), new Pecuniam(2.38M));
            testSubject.Pop(new DateTime(2014, 1, 14), new Pecuniam(57.89M));
            testSubject.Pop(new DateTime(2014, 1, 14), new Pecuniam(10.09M));
            testSubject.Pop(new DateTime(2014, 1, 15), new Pecuniam(7.78M));
            testSubject.Pop(new DateTime(2014, 1, 15), new Pecuniam(52.13M));
            testSubject.Pop(new DateTime(2014, 1, 15), new Pecuniam(22.95M));
            testSubject.Pop(new DateTime(2014, 1, 16), new Pecuniam(47.59M));
            testSubject.Pop(new DateTime(2014, 1, 17), new Pecuniam(703.65M));
            testSubject.Pop(new DateTime(2014, 1, 17), new Pecuniam(32.11M));
            testSubject.Pop(new DateTime(2014, 1, 17), new Pecuniam(12.83M));
            testSubject.Pop(new DateTime(2014, 1, 18), new Pecuniam(60.83M));
            testSubject.Pop(new DateTime(2014, 1, 20), new Pecuniam(57.64M));
            testSubject.Pop(new DateTime(2014, 1, 20), new Pecuniam(49.07M));
            testSubject.Pop(new DateTime(2014, 1, 21), new Pecuniam(3.55M));
            testSubject.Pop(new DateTime(2014, 1, 24), new Pecuniam(6.94M));
            testSubject.Pop(new DateTime(2014, 1, 25), new Pecuniam(6.94M));
            testSubject.Pop(new DateTime(2014, 1, 27), new Pecuniam(10.61M));
            testSubject.Pop(new DateTime(2014, 1, 27), new Pecuniam(50.73M));
            testSubject.Pop(new DateTime(2014, 1, 28), new Pecuniam(8.32M));

            var testResult = testSubject.GetMinPayment(new DateTime(2014, 1, 28));

            Assert.AreEqual(-17.68M, testResult.Amount);
            System.Diagnostics.Debug.WriteLine(testResult);
            System.Diagnostics.Debug.WriteLine(testSubject.GetValueAt(new DateTime(2014, 1, 28)));

            testSubject.Pop(new DateTime(2014, 1, 30), new Pecuniam(61.28M));
            testSubject.Pop(new DateTime(2014, 2, 1), new Pecuniam(23.11M));
            testSubject.Pop(new DateTime(2014, 2, 2), new Pecuniam(9.83M));
            testSubject.Pop(new DateTime(2014, 2, 3), new Pecuniam(8.53M));
            testSubject.Pop(new DateTime(2014, 2, 3), new Pecuniam(2.09M));
            testSubject.Pop(new DateTime(2014, 2, 4), new Pecuniam(7.79M));
            testSubject.Pop(new DateTime(2014, 2, 6), new Pecuniam(47.24M));
            testSubject.Pop(new DateTime(2014, 2, 7), new Pecuniam(55.95M));
            testSubject.Pop(new DateTime(2014, 2, 7), new Pecuniam(30.1M));
            testSubject.Pop(new DateTime(2014, 2, 8), new Pecuniam(37.39M));
            testSubject.Pop(new DateTime(2014, 2, 10), new Pecuniam(3.91M));
        }
Beispiel #5
0
        static void Main(string[] args)
        {
            Students s1 = new Students("Emily", "Briggs", "1001", 3.2f);

            Console.WriteLine(s1);

            Vehicle v1 = new Vehicle("Toyata", "Hatchback", 2010, 2900);

            Console.WriteLine(v1);

            Login l1 = new Login("bunnyH0ps", "ChimkenNuggetz");

            Console.WriteLine(l1);

            ContactInfo c1 = new ContactInfo("3100 Dependent Street", "Kansas City", "Kansas", "66109", "837-384-7734", "*****@*****.**");

            Console.WriteLine(c1);

            Customer cus1 = new Customer("CD8887", "John", "Briggs", c1);

            Console.WriteLine(cus1);

            CreditCardAccount credit1 = new CreditCardAccount(8484838, cus1, 180.82m, false, 9.2m);

            Console.WriteLine(credit1);

            Book bk1 = new Book("Necronomicon", "Lucifer", 666);

            Console.WriteLine(bk1);

            List <Book> books = new List <Book>()
            {
                bk1
            };

            Library lib1 = new Library(books, "Atchison Library", "3219 Apple Avenue", "Wood Cabin City", "Colorado", "68484");

            Console.WriteLine(lib1);
        }
Beispiel #6
0
        public void AddCreditCardDetails(string voultID, string yearMonth, string ccnumber, string cardtype)
        {
            var familyMemberid          = _currentUserService.MemberID;
            int month                   = Convert.ToInt32(yearMonth.Substring(0, 2));
            int year                    = Convert.ToInt32(yearMonth.Substring(2, 2));
            var CreditCardfamilyDetails = Repository.Table <CreditCardAccount>().Where(p => p.FamilyMemberID == familyMemberid).FirstOrDefault();

            if (CreditCardfamilyDetails == null)
            {
                var ccDetails = new CreditCardAccount
                {
                    FamilyMemberID      = familyMemberid,
                    customer_vault_id   = voultID,
                    CardExpirationMonth = month,
                    CardExpirationYear  = year,
                    CardStatus          = CreditCardStatus.Verified,
                    CardType            = (CreditCardType)Enum.Parse(typeof(CreditCardType), cardtype.ToString().Trim()),
                    DateAdded           = DateTime.UtcNow,
                    IsCardExpired       = false,
                    Isdeleted           = false,
                    MaskedCardNumber    = ccnumber
                };
                Repository.Insert(ccDetails);
                var CreditCardfamilyDetails1 = Repository.Table <CreditCardAccount>().Where(p => p.FamilyMemberID == familyMemberid).FirstOrDefault();
                var familyIDDetails          = Repository.Table <User>().Where(p => p.Id == familyMemberid).FirstOrDefault();
                _signUpProgressService.UpdateSignUpProgress(SignUpStatus.Completed, familyIDDetails.FamilyID);
            }
            else
            {
                CreditCardfamilyDetails.customer_vault_id   = voultID;
                CreditCardfamilyDetails.CardExpirationMonth = month;
                CreditCardfamilyDetails.CardExpirationYear  = year;
                CreditCardfamilyDetails.DateAdded           = DateTime.UtcNow;
                CreditCardfamilyDetails.CardType            = (CreditCardType)Enum.Parse(typeof(CreditCardType), cardtype.Trim().ToString());
                CreditCardfamilyDetails.MaskedCardNumber    = ccnumber;
                Repository.Update(CreditCardfamilyDetails);
            }
        }
Beispiel #7
0
        private void GetAccountsFromTable(IList <CardListInfo> table, IList <ICreditCardAccount> result)
        {
            foreach (var card in table)
            {
                var newCard = new CreditCardAccount
                {
                    VendorId      = VendorId.Amex,
                    AccountId     = card.CardNumber,
                    CompanyName   = CompanyName,
                    UserId        = _amexApi.UserId,
                    Label         = CompanyName,
                    BankAccountId = card.BankAccountId,
                    BankBranchId  = card.BankBranchId,
                    BankId        = card.BankBranchId,
                    CardName      = card.CardName,
                    CardNumber    = card.CardNumber,
                    PartnerName   = card.PartnerName,
                    Balance       = Double.NaN
                };

                result.Add(newCard);
            }
        }
Beispiel #8
0
        static void Main(string[] args)
        {
            ////then test the class you created in TesterProgram by creating objects using both constructors and writing them to the screen.

            Student s1 = new Student();

            s1.FirstName = "Elizardbreath";
            s1.LastName  = "Needs Ham";
            s1.ID        = "1234";
            s1.GPA       = 3.6f;

            Console.WriteLine($"Student first name: {s1.FirstName}\nStudent last name: {s1.LastName}\nStudent ID: {s1.ID}\nStudent GPA: {s1.GPA}");

            Student s2 = new Student();

            Console.WriteLine(s2);

            Vehicle v1 = new Vehicle();

            v1.Make   = "Subaru";
            v1.Model  = "Forester";
            v1.Year   = 2018;
            v1.Weight = 2000;

            Vehicle v2 = new Vehicle();

            Console.WriteLine($"Car make: {v1.Make}\nCar Model: {v1.Model}\nCar year: {v1.Year}\nCar Weight: {v1.Weight}");
            Console.WriteLine(v2);

            Login l1 = new Login();

            l1.Username = "******";
            l1.Password = "******";

            Login l2 = new Login();

            Console.WriteLine($"Username: {l1.Username}\nPassword: {l1.Password}");
            Console.WriteLine(l2);

            ContactInfo c = new ContactInfo();

            c.StreetAddress = "brain broke";
            c.City          = "brain brok";
            c.State         = "brain bro";
            c.Zip           = "brain br";
            c.Phone         = "brain b";
            c.Email         = "brain ";

            ContactInfo c2 = new ContactInfo();

            Console.WriteLine($"{c.StreetAddress}\n{c.City}\n{c.State}\n{c.Zip }\n{c.Phone}\n{c.Email}");
            Console.WriteLine(c2.StreetAddress); //what is it supposed to look like when I print out the thing I made with the default method???

            Customer cust1 = new Customer();

            cust1.CustomerId         = "who cares";
            cust1.FirstName          = "Elizardbreath";
            cust1.LastName           = "Needsham";
            cust1.ContactInformation = c;

            Console.WriteLine($"{cust1.CustomerId}\n{cust1.FirstName}\n {cust1.LastName}\n{cust1.ContactInformation}"); //here I was making it more difficult than it was - Once I assigned the values to the fields of the customer all I had to do was the linebelow and all the customer info is printed out
            Console.WriteLine(cust1);

            Customer cust2 = new Customer();

            Console.WriteLine(cust2);

            CreditCardAccount a = new CreditCardAccount(13545, cust1, 1000, false, 4);

            Console.WriteLine("\n" + a);

            CreditCardAccount b = new CreditCardAccount();

            Console.WriteLine("\n" + b);

            Book book1 = new Book("Stuff White People Like", "Christian Lander", 211);

            Console.WriteLine(book1);
            Book book2 = new Book();

            book2.Title = "Lord of the Rings";
            //Console.WriteLine(book2);

            List <Book> books = new List <Book>();

            books.Add(book1);
            books.Add(book2);
            //Console.WriteLine(books);

            Library lib1 = new Library(books, "Plaza Branch", " 50000 Holmes st", "KC", "MO", "65454");

            Console.WriteLine(lib1); //it's not writing the books out here.....

            //Library lib2 = new Library();
            //Console.WriteLine(lib2);
            ////TODO get help with why this isn't printing off the empty properties or whatever

            Song song1 = new Song("Billy Joel", "some billy joel song", 546545);

            Console.WriteLine(song1);

            Song song2 = new Song();

            Console.WriteLine(song2);

            Song[] songs = { song1, song2 };
            //foreach (Song song in songs)
            //{
            //    Console.WriteLine(song);
            //}

            Artist artist1 = new Artist(songs, "Billy Joel", "random genre");

            Console.WriteLine(artist1);

            //Artist artist2 = new Artist();
            //Console.WriteLine(artist2); //TODOgetting error messages for the classes that have lists in them as properties - they won't print off if no value is passed to them I just get an error msg on the consol

            MotorHome minnieWinnie = new MotorHome("winnie", "winnie model", 1986, 54654, 5);

            Console.WriteLine(minnieWinnie);

            Truck newTruck = new Truck("Toyota", "Tundra", 1995, 2050, 500);

            Console.WriteLine(newTruck);
        }
 public void ProcessCorrectPinInput(CreditCardAccount account)
 {
     account.IncorrectPinInputCounter = 0;
 }
Beispiel #10
0
        static void Main(string[] args)//only do 1-4 8 objects total
        {
            //1) student
            Student transfer = new Student("Maria", "Sanchez", "3579", 3.9f);
            Student current  = new Student();

            current.FirstName = "Larry";
            current.LastName  = "Walters";
            current.Id        = "0123";
            current.Gpa       = 2.9f;

            Console.WriteLine($"{transfer}\n\n{current}\n\n");

            //2) vehicle
            Vehicle old      = new Vehicle("Chevy", "Celebrity", 1984, 2.5f);
            Vehicle newModel = new Vehicle();

            newModel.Make   = "Toyota";
            newModel.Model  = "Prius";
            newModel.Year   = 2005;
            newModel.Weight = 3;

            Console.WriteLine($"{old} compared to the new {newModel}\n\n");

            //3) Username
            Login currentPass = new Login("asdghkl", "1234asdf");
            Login previous    = new Login();

            previous.UserName = "******";
            previous.Password = "******";

            Console.WriteLine($"{currentPass}\n\n");
            Console.WriteLine($"{previous}\n\n");

            //4) Contact Info

            ContactInfo info1 = new ContactInfo("413 Ranchero Pl", "Belton", "Missouri", "64012",
                                                "555-555-5555", "*****@*****.**");
            ContactInfo bigBird = new ContactInfo();

            bigBird.StreetAddress = "123 Sesame Street";
            bigBird.City          = "New York City";
            bigBird.State         = "New York";
            bigBird.Zip           = "12345";
            bigBird.Phone         = "(123) 456-7890";
            bigBird.Email         = "*****@*****.**";
            Console.WriteLine($"{info1}\n\n{bigBird}");


            //Wednesday Homework 5-8

            Console.Clear();
            //List<ContactInfo> customerContact = new List<ContactInfo> { info1, bigBird };//list for customer info
            //5)Customer info

            Customer c1 = new Customer("13357", "Alysha", "Williams", info1);
            Customer c2 = new Customer();

            c2.CustomerId      = "1234";
            c2.FirstName       = "Big";
            c2.LastName        = "Bird";
            c2.CustomerContact = bigBird;
            Console.WriteLine($"{c1}\n");
            Console.WriteLine($"{c2}\n");


            //6)Credit Card Account //giving me index errors how to fix them


            CreditCardAccount cc1 = new CreditCardAccount(768450, c1, 789596.98m, false, 15.3m);
            CreditCardAccount cc2 = new CreditCardAccount();

            cc2.AccountNumber     = 02345;
            cc2.CustomerInfo      = c2;
            cc2.Balance           = 1345.2m;
            cc2.IsPastDue         = true;
            cc2.AnnualInterstRate = 1.3m;
            Console.WriteLine($"{cc1}\n");
            Console.WriteLine($"{cc2}\n");

            //7)Book

            Book newb1 = new Book("How to Write Adventure Modules that Don't Suck", "Goodman Games", 156);
            Book newb2 = new Book();

            newb2.Title         = "The Den of Shadows";
            newb2.Author        = "Amelia Atwater-Rhoades";
            newb2.NumberOfPages = 595;
            Console.WriteLine($"{newb1}\n");
            Console.WriteLine($"{newb2}\n");

            //8) Library
            List <Book> books = new List <Book> {
                newb1, newb2
            };

            Library library1 = new Library(books, "Peculiar Library", "123 Street", "Peculiar", "Missouri", "64080");
            Library library2 = new Library();

            library2.Books         = books;
            library2.LibraryName   = "Grandview Library";
            library2.StreetAddress = "123 Main";
            library2.City          = "Grandview";
            library2.State         = "Missouri";
            library2.Zip           = "64012";
            Console.WriteLine($"{library1}\n");
            Console.WriteLine($"{library2}\n");

            //9)Songs parent of CD

            Songs ns1 = new Songs("Panic! At the Disco", "Saturday Night", 120);
            Songs ns2 = new Songs();

            ns2.Artist          = "Panic! At the Disco";
            ns2.Title           = "Amen";
            ns2.LengthInSeconds = 200;

            Console.WriteLine(ns1);
            Console.WriteLine(ns2);
            Console.Clear();
            //10) CD
            string[] Songs = new string[2];
            Songs[0] = Convert.ToString(ns1);
            Songs[1] = Convert.ToString(ns2);
            Console.WriteLine(Songs[1]);
            Console.WriteLine(Songs[0]);

            CDs ncd1 = new CDs("Panic! At the Disco", "Alternative", Songs);//last spot is printing System.String[]

            Console.WriteLine(ncd1);
            CDs ncd2 = new CDs();

            ncd2.Artist = "Little Mix";
            //ncd2.Title = "Hair";
            //ncd2.LengthInSeconds = 380;
            ncd2.Genre = "Pop";
            ncd2.Songs = Songs;
            Console.WriteLine(ncd2);

            //11)
            //11. MotorHome – extend Vehicle
            //a.numberOfBeds – int
            MotorHome mh1 = new MotorHome("Ford", "OffRoad", 1999, 3.4f, 1.5f);
            MotorHome mh2 = new MotorHome();

            mh2.Make         = "Chevy";
            mh2.Model        = "Forester";
            mh2.Year         = 2003;
            mh2.Weight       = 4;
            mh2.NumberOfBeds = 2.5f;
            Console.WriteLine(mh1);
            Console.WriteLine(mh2);

            //12)Truck ==loadCapacity
            Trucks nt1 = new Trucks("Jeep", "Jeep", 2015, 2.4f, 2.2f);
            Trucks nt2 = new Trucks();

            nt2.Make         = "Toyota";
            nt2.Model        = "Sienna";
            nt2.Year         = 2019;
            nt2.Weight       = 3;
            nt2.LoadCapacity = 4;
            Console.WriteLine(nt1);
            Console.WriteLine(nt2);
        } //end main()
Beispiel #11
0
    public void CreditTransaction()
    {
        Show("please insert your credit card");
        string id = GetInput();

        Show("please enter your password");
        string pwd = GetInput();

        CreditCardAccount account = bank.FindCreditAccount(id, pwd);

        if (account == null)
        {
            Show("card invalid or password not corrent");
            return;
        }
        bool next = false;

        do
        {
            Show("1: display; 2: save; 3: withdraw");
            string op = GetInput();
            if (op == "1")
            {
                Show("limit: " + account.CreditLimit);
            }
            else if (op == "2")
            {
                Show("save money");
                string smoney = GetInput();
                double money  = double.Parse(smoney);

                bool ok = account.SaveMoney(money);
                if (ok)
                {
                    Show("ok");
                }
                else
                {
                    Show("eeer");
                }

                Show("limit: " + account.CreditLimit);
            }
            else if (op == "3")
            {
                Show("withdraw money");
                string smoney = GetInput();
                double money  = double.Parse(smoney);

                bool ok = account.WithdrawMoney(money);
                if (ok)
                {
                    Show("ok");
                }
                else
                {
                    Show("error");
                }

                Show("limit: " + account.CreditLimit);
            }
            Show("1:finish; 2:continue");
            op = GetInput();
            if (op == "1")
            {
                next = false;
            }
            else if (op == "2")
            {
                next = true;
            }
        } while (next);
    }
        static void Main(string[] args)
        {
            IAccount currentAccount = new CurrentAccount();
            currentAccount.Address = "Test";
            currentAccount.Id = "1";
            currentAccount.Name = "Test";
            currentAccount.BankName = "BTest";
            currentAccount.DepositAmount(100000);
            AddAccount(currentAccount);
            Display();

            IAccount savingsAccount = new SavingsAccount();
            savingsAccount.Address = "Test1";
            savingsAccount.Id = "2";
            savingsAccount.Name = "Test1";
            savingsAccount.BankName = "BTest";
            savingsAccount.DepositAmount(20000);
            AddAccount(savingsAccount);

            Display();

            IAccount creditCardAccount = new CreditCardAccount();
            creditCardAccount.Address = "Test2";
            creditCardAccount.Id = "3";
            creditCardAccount.Name = "Test2";
            creditCardAccount.BankName = "BTest";
            creditCardAccount.DepositAmount(300000);
            AddAccount(creditCardAccount);
            List<IAccount> tempList=new List<IAccount>();
            tempList.AddRange(accountList);
            Display();
            accountList.RemoveAt(1);
            Console.WriteLine();
            Console.WriteLine();
            Display();

            Console.WriteLine();
            Console.WriteLine();

            accountList.Remove(creditCardAccount);
            Display();
            accountList.Clear();
            Display();

            accountList = tempList;
            Display();

            IDictionary<string, string> accountDictionary = new Dictionary<string, string>(3);
            foreach(IAccount account in accountList)
            {
                accountDictionary.Add(account.Id, account.ToString());
                //accountDictionary[account.Id] = account.ToString();
            }

            foreach(KeyValuePair<string,string> keyValuePair in accountDictionary)
            {
                Console.WriteLine("{0}=>{1}", keyValuePair.Key, keyValuePair.Value);
            }

            Console.WriteLine("Enter Id ");
            string id = Console.ReadLine();
            if(accountDictionary.ContainsKey(id))
            {
                Console.WriteLine("{0}=>{1}", id, accountDictionary[id]);
            }
            else
            {
                Console.WriteLine("Invalid Key");
            }
        }
Beispiel #13
0
        /************************************************************************/

        #region Constructor (internal)
        /// <summary>
        /// Initializes a new instance of the <see cref="Transaction"/> class.
        /// </summary>
        /// <param name="rootNode">The root node from which to find data for this class.</param>
        /// <param name="owner">The statement that owns this transaction.</param>
        internal Transaction(XmlNode rootNode, CommonStatementBase owner)
        {
            // Null values here indicate programmer error.
            ValidateNull(rootNode, nameof(rootNode));
            ValidateNull(owner, nameof(owner));

            TransType     = GetNodeValue(GetNestedNode(rootNode, GetNodeName(nameof(TransType)))).ToOfxTransactionType();
            DatePosted    = GetDateTimeValue(rootNode, nameof(DatePosted));
            DateInitiated = GetNullableDateTimeValue(rootNode, nameof(DateInitiated));
            DateAvailable = GetNullableDateTimeValue(rootNode, nameof(DateAvailable));
            Amount        = GetDecimalValue(GetNestedNode(rootNode, GetNodeName(nameof(Amount))));

            TransactionId = GetNodeValue(GetNestedNode(rootNode, GetNodeName(nameof(TransactionId))));
            ValidateOfxParseOperation(String.IsNullOrEmpty(TransactionId), "Cannot retreive transaction id");

            CorrectedTransactionId = GetNodeValue(GetNestedNode(rootNode, GetNodeName(nameof(CorrectedTransactionId))));
            CorrectionAction       = GetNodeValue(GetNestedNode(rootNode, GetNodeName(nameof(CorrectionAction)))).ToTransactionCorrectionAction();
            ServerTransactionId    = GetNodeValue(GetNestedNode(rootNode, GetNodeName(nameof(ServerTransactionId))));

            CheckNumber = GetNodeValue(GetNestedNode(rootNode, GetNodeName(nameof(CheckNumber))));
            // the check number may come in left-padded with zeros. Take out left padding.
            while (CheckNumber.StartsWith("0") && CheckNumber.Length > 0)
            {
                CheckNumber = CheckNumber.Remove(0, 1);
            }

            ReferenceNumber = GetNodeValue(GetNestedNode(rootNode, GetNodeName(nameof(ReferenceNumber))));
            Sic             = GetNodeValue(GetNestedNode(rootNode, GetNodeName(nameof(Sic))));
            PayeeId         = GetNodeValue(GetNestedNode(rootNode, GetNodeName(nameof(PayeeId))));

            Name = GetNodeValue(GetNestedNode(rootNode, GetNodeName(nameof(Name))));
            Memo = GetNodeValue(GetNestedNode(rootNode, GetNodeName(nameof(Memo))));

            // This is not strictly spec. Some ofx responses don't have Name b/c they have a Payee
            if (String.IsNullOrEmpty(Name))
            {
                Name = Memo;
            }

            // Get the payee if it exists.
            XmlNode payeeNode = GetNestedNode(rootNode, GetNodeName(nameof(Payee)));

            if (payeeNode != null)
            {
                Payee = new Payee(payeeNode);
            }

            Currency = new CurrencyAggregate(rootNode, owner);

            //Currency = GetNodeValue(GetNestedNode(rootNode, GetNodeName(nameof(Currency))));
            //if (String.IsNullOrEmpty(Currency))
            //{
            //    Currency = GetNodeValue(GetNestedNode(rootNode, "ORIGCURRENCY"));
            //    if (String.IsNullOrEmpty(Currency))
            //    {
            //        Currency = defaultCurrency;
            //    }
            //}

            XmlNode bankToNode = GetNestedNode(rootNode, "BANKACCTTO");
            XmlNode ccToNode   = GetNestedNode(rootNode, "CCACCTTO");

            if (bankToNode != null)
            {
                ToAccount = new BankAccount(bankToNode);
            }
            else if (ccToNode != null)
            {
                ToAccount = new CreditCardAccount(ccToNode);
            }
        }
Beispiel #14
0
        static void Main(string[] args)
        {
            //*******
            Student mumford = new Student("Marcus", "Mumford", "1900", 3.2f);

            Student ferdinand = new Student();

            ferdinand.LastName  = "Ferdinand";
            ferdinand.FirstName = "Franz";
            ferdinand.Gpa       = 3.9f;
            ferdinand.Id        = "17";

            Console.WriteLine(ferdinand);
            Console.WriteLine(mumford);

            //******
            Vehicle falcon = new Vehicle("Corellian Corvette", "YT-1300", 5, 30000);

            Vehicle enterprise = new Vehicle();

            enterprise.Make   = "Federation Starship";
            enterprise.Model  = "Galaxy Class";
            enterprise.Year   = 2300;
            enterprise.Weight = 1000000;

            Console.WriteLine(enterprise);
            Console.WriteLine(falcon);

            //*******

            Login myActualLogin = new Login("myName", "12345");

            Login secondLogin = new Login();

            secondLogin.Username = "******";
            secondLogin.Password = "******";

            Console.WriteLine(myActualLogin);
            Console.WriteLine(secondLogin);

            //********

            ContactInfo myInfo = new ContactInfo("3180 Main Street", "Kansas City", "KS", "45825", "913-555-5885", "*****@*****.**");

            ContactInfo newAddress = new ContactInfo();

            newAddress.StreetAddress = "100 S. Baker Street";
            newAddress.City          = "London";
            newAddress.State         = "MO";
            newAddress.Zip           = "10000";
            newAddress.Phone         = "816-555-4000";
            newAddress.Email         = "*****@*****.**";

            //Console.WriteLine(myInfo);
            //Console.WriteLine(newAddress);

            //********

            Customer doorBuster = new Customer("789", "Upton", "Sinclar", myInfo);

            Customer carlSagan = new Customer();

            carlSagan.CustomerId         = "790";
            carlSagan.FirstName          = "Carl";
            carlSagan.LastName           = "Sagan";
            carlSagan.ContactInformation = newAddress;

            Console.WriteLine("\n");
            Console.WriteLine(doorBuster);
            Console.WriteLine("\n");
            Console.WriteLine(carlSagan);

            //*************

            CreditCardAccount account1 = new CreditCardAccount(1700, doorBuster, 7256.3m, false, .1m);

            CreditCardAccount account2 = new CreditCardAccount();

            account2.AccountNumber      = 1701;
            account2.AnnualInterestRate = .05m;
            account2.Balance            = 304.12m;
            account2.CustomerInfo       = carlSagan;
            account2.IsPastDue          = false;

            Console.WriteLine("\n");
            Console.WriteLine(account1);
            Console.WriteLine("\n");
            Console.WriteLine(account2);

            //***********

            Book frankenstein = new Book("Frankenstein", "Mary Shelly", 300);

            Book foreverWar = new Book("The Forever War", "Joe Haldman", 320);

            Book fourteenNinetyOne = new Book("1491", "Charles C. Mann", 400);

            Book lotr = new Book();

            lotr.Title         = "Lord of the Rings";
            lotr.Author        = "J.R.R. Tolkein";
            lotr.NumberOfPages = 1200;

            Console.WriteLine("\n");
            Console.WriteLine(frankenstein);
            Console.WriteLine("\n");
            Console.WriteLine(lotr);

            //*************

            List <Book> myBooks = new List <Book>();

            myBooks.Add(lotr);
            myBooks.Add(frankenstein);
            myBooks.Add(fourteenNinetyOne);
            myBooks.Add(foreverWar);

            Library shawneePublicLibrary = new Library(myBooks, "Shawnee Public Library", "400 E. Shawnee Mission Parkway", "Shawnee", "KS", "74147");

            Library myPersonalBookshelf = new Library();

            myPersonalBookshelf.Books         = myBooks;
            myPersonalBookshelf.City          = "Kansas City";
            myPersonalBookshelf.LibraryName   = "My personal book collection";
            myPersonalBookshelf.State         = "MO";
            myPersonalBookshelf.Zip           = "99999";
            myPersonalBookshelf.StreetAddress = "700 31st Street";

            Console.WriteLine("\n");
            Console.WriteLine(shawneePublicLibrary);
            Console.WriteLine("\n");
            Console.WriteLine(myPersonalBookshelf);

            //*****************

            Song immigrantSong = new Song("Led Zepplin", "Immigrant Song", 190);

            Song holdYouNow = new Song();

            holdYouNow.Artist          = "Vampire Weekend";
            holdYouNow.Title           = "Hold you now";
            holdYouNow.LengthInSeconds = 140;

            Console.WriteLine("\n");
            Console.WriteLine(immigrantSong);
            Console.WriteLine("\n");
            Console.WriteLine(holdYouNow);

            //*****************

            Song stairway = new Song("Led Zepplin", "Stairway to heaven", 400);
            Song jnyb     = new Song("Vampire Weekend", "Jerusalem, New York, Berlin", 181);

            Song[] lz = { immigrantSong, stairway };
            Song[] vw = { holdYouNow, jnyb };

            Artist ledZeppHits = new Artist(lz, "Led Zepplin Greatest Hits", "Rock");
            Artist vampWeekend = new Artist(vw, "Vampire Weekend Presents", "Alt-Rock");

            Console.WriteLine("\n");
            Console.WriteLine(ledZeppHits);
            Console.WriteLine(vampWeekend);

            //************

            MotorHome winabango   = new MotorHome("Winabango", "S-7", 1989, 4000, 3);
            MotorHome modifiedBus = new MotorHome();

            modifiedBus.Make         = "School Bus";
            modifiedBus.Model        = "modified by owner";
            modifiedBus.Year         = 2000;
            modifiedBus.Weight       = 8000;
            modifiedBus.NumberOfBeds = 6;

            Console.WriteLine("\n");
            Console.WriteLine(winabango);
            Console.WriteLine("\n");
            Console.WriteLine(modifiedBus);

            //************

            Truck fjordTough      = new Truck("Ford", "F-150", 2003, 1500, 3500f);
            Truck scottsDadsTruck = new Truck();

            scottsDadsTruck.Make            = "Chevy";
            scottsDadsTruck.Model           = "S10";
            scottsDadsTruck.Year            = 1988;
            scottsDadsTruck.Weight          = 1200;
            scottsDadsTruck.LoadCapacityLbs = 2000f;

            Console.WriteLine("\n");
            Console.WriteLine(fjordTough);
            Console.WriteLine("\n");
            Console.WriteLine(scottsDadsTruck);
        }
        static void Main(string[] args)
        {
            Console.WriteLine("====== Testing for Classes Library ======\n\n");

            Student s1 = new Student();

            s1.FirstName = "Tony";
            s1.LastName  = "Stark";
            s1.Id        = "54321";
            s1.GPA       = 4.0F;

            Student s2 = new Student();

            s2.FirstName = "Steve";
            s2.LastName  = "Rogers";
            s2.Id        = "12345";
            s2.GPA       = 3.95F;

            Console.WriteLine(s1);
            Console.WriteLine(s2);

            Vehicle v1 = new Vehicle();

            v1.Make   = "Honda";
            v1.Model  = "Civic";
            v1.Year   = 2012;
            v1.Weight = 25450f;

            Console.WriteLine(v1);

            Login l1 = new Login();

            l1.Username = "******";
            l1.Password = "******";

            Console.WriteLine(l1);

            ContactInfo c1 = new ContactInfo();

            c1.StreetAddress = "1400 Veterans United Drive";
            c1.City          = "Columbia";
            c1.State         = "MO";
            c1.Zip           = "65203";
            c1.Phone         = "800-814-1103";
            c1.Email         = "*****@*****.**";

            Console.WriteLine(c1);

            Customer cu1 = new Customer();

            cu1.CustomerId         = "1234";
            cu1.FirstName          = "Ron";
            cu1.LastName           = "Swanson";
            cu1.ContactInformation = c1;

            Console.WriteLine(cu1);

            CreditCardAccount cc1 = new CreditCardAccount();

            cc1.AccountNumber      = 1234;
            cc1.CustomerInfo       = cu1;
            cc1.Balance            = 125.56m;
            cc1.IsPastDue          = false;
            cc1.AnnualInterestRate = 0.05m;

            Console.WriteLine(cc1);

            Book bk1 = new Book();

            bk1.Title      = "Where the Red Fern Grows";
            bk1.Author     = "Blue";
            bk1.NbrOfPages = 325;

            Book bk2 = new Book("How to Get People to Like You", "Ryan Burton", 450);

            Console.WriteLine(bk1);
            Console.WriteLine(bk2);


            Library lb1 = new Library();

            lb1.Books = new List <Book>()
            {
                bk1, bk2
            };
            lb1.LibraryName   = "Columbia Public Library";
            lb1.StreetAddress = "1400 Broadway";
            lb1.City          = "Columbia";
            lb1.State         = "MO";
            lb1.Zip           = "65203";

            Console.WriteLine(lb1);

            Song sg1 = new Song("Mariah Carey", "Always Be My Baby", 150);
            Song sg2 = new Song("Mariah Carey", "Daydream", 150);
            Song sg3 = new Song("Mariah Carey", "When I Saw You", 150);


            Console.WriteLine(sg1);

            Song[] cd1tracks = { sg1, sg2, sg3 };

            CD cd1 = new CD(cd1tracks, "Daydream", "Pop");

            Console.WriteLine(cd1);

            MotorHome m1 = new MotorHome("Winnie", "RR", 1995, 2000, 4);

            Console.WriteLine(m1);

            Truck t1 = new Truck("Ford", "F150", 2005, 35000, 225.50f);

            Console.WriteLine(t1);
        }
Beispiel #16
0
 public void TestMakePayment()
 {
     var testInput = new NorthAmerican(NoFuture.Rand.Domus.NAmerUtil.GetWorkingAdultBirthDate(), Gender.Female);
     var testSubject = new CreditCardAccount(new VisaCc(testInput, DateTime.Today.AddDays(-15), null), CreditCardAccount.DF_MIN_PMT_RATE, new Pecuniam(1800.0M));
 }