Пример #1
0
        static void Main(string[] args)
        {
            Bank   newBank         = new Bank();
            double TotalPayPercent = 100;
            var    rolodex         = new List <IRobber>();
            var    robber1         = new Muscle()
            {
                Name          = "Subway",
                SkillLevel    = 100,
                PercentageCut = 20,
            };
            var robber2 = new Muscle()
            {
                Name          = "Garrett",
                SkillLevel    = 55,
                PercentageCut = 20,
            };
            var robber3 = new LockSpec()
            {
                Name          = "John Boy",
                SkillLevel    = 100,
                PercentageCut = 20,
            };
            var robber4 = new Hacker()
            {
                Name          = "Namita",
                SkillLevel    = 100,
                PercentageCut = 20,
            };
            var robber5 = new Muscle()
            {
                Name          = "James",
                SkillLevel    = 100,
                PercentageCut = 80,
            };
            var robber6 = new Hacker()
            {
                Name          = "Heidi",
                SkillLevel    = 67,
                PercentageCut = 54,
            };
            var robber7 = new LockSpec()
            {
                Name          = "Jansen",
                SkillLevel    = 62,
                PercentageCut = 34,
            };
            var robber8 = new Hacker()
            {
                Name          = "Holden",
                SkillLevel    = 67,
                PercentageCut = 45,
            };
            var robber9 = new Hacker()
            {
                Name          = "Taylor",
                SkillLevel    = 72,
                PercentageCut = 30,
            };

            rolodex.Add(robber1);
            rolodex.Add(robber2);
            rolodex.Add(robber3);
            rolodex.Add(robber4);
            rolodex.Add(robber5);
            rolodex.Add(robber6);
            rolodex.Add(robber7);
            rolodex.Add(robber8);
            rolodex.Add(robber9);
            Console.WriteLine(rolodex.Count);
            Console.WriteLine(@"
||====================================================================||
||//$\\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\//$\\||
||(100)==================| FEDERAL RESERVE NOTE |================(100)||
||\\$//        ~         '------========--------'                \\$//||
||<< /        /$\              // ____ \\                         \ >>||
||>>|  12    //L\\            // ///..) \\         L38036133B   12 |<<||
||<<|        \\ //           || <||  >\  ||                        |>>||
||>>|         \$/            ||  $$ --/  ||        One Hundred     |<<||
||<<|      L38036133B        *\\  |\_/  //* series                 |>>||
||>>|  12                     *\\/___\_//*   1989                  |<<||
||<<\      Treasurer     ________/HEIST\_________     Secretary 12 />>||
||//$\                ~| TEXTUAL ESPIONAGE ACTION |~              /$\\||
||(100)=================  HIDDEN IN PLAIN SIGHT  ================(100)||
||\\$//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\\$//||
||====================================================================||
            ");
            Console.WriteLine();
            Console.WriteLine("Plan Your...");
            Console.WriteLine(@"
 __  __     ______     __     ______     ______
/\ \_\ \   /\  ___\   /\ \   /\  ___\   /\__  _\
\ \  __ \  \ \  __\   \ \ \  \ \___  \  \/_/\ \/
 \ \_\ \_\  \ \_____\  \ \_\  \/\_____\    \ \_\
  \/_/\/_/   \/_____/   \/_/   \/_____/     \/_/
                                                    ");
            while (true)
            {
                Console.WriteLine("Please enter a new member name");
                var newMemberName = Console.ReadLine();
                if (newMemberName == "")
                {
                    break;
                }
                while (true)
                {
                    Console.Write("What is their speciality? Hackers disable alarms, Muscle handles the guards, and Lockspec cracks the vault.");
                    var newMemberSpeciality = Console.ReadLine();
                    if (newMemberSpeciality == "Muscle")
                    {
                        Muscle newMuscle = new Muscle()
                        {
                            Name = newMemberName
                        };
                        Console.WriteLine("Please enter Skill Level (1-100)");
                        var newMemberSkillLevel = Console.ReadLine();
                        try
                        {
                            int newMemberSkillLevelNumber = int.Parse(newMemberSkillLevel);
                        }
                        catch
                        {
                            Console.WriteLine($"No Bueno, that's not a number.");
                        }
                        newMuscle.SkillLevel = int.Parse(newMemberSkillLevel);
                        Console.WriteLine("What is this member's percentage pay cut? (1-100)");
                        var newMemberPayPercentage = Console.ReadLine();
                        try
                        {
                            int newMemberPayPercentageNumber = int.Parse(newMemberPayPercentage);
                        }
                        catch
                        {
                            Console.WriteLine($"No Bueno, that's not a number.");
                        }
                        rolodex.Add(newMuscle);
                        break;
                    }
                    else if (newMemberSpeciality == "Hacker")
                    {
                        Hacker newHacker = new Hacker()
                        {
                            Name = newMemberName
                        };
                        Console.WriteLine("Please enter Skill Level (1-100)");
                        var newMemberSkillLevel = Console.ReadLine();
                        try
                        {
                            int newMemberSkillLevelNumber = int.Parse(newMemberSkillLevel);
                        }
                        catch
                        {
                            Console.WriteLine($"No Bueno, that's not a number.");
                        }
                        newHacker.SkillLevel = int.Parse(newMemberSkillLevel);
                        Console.WriteLine("What is this member's percentage pay cut? (1-100)");
                        var newMemberPayPercentage = Console.ReadLine();
                        try
                        {
                            int newMemberPayPercentageNumber = int.Parse(newMemberPayPercentage);
                        }
                        catch
                        {
                            Console.WriteLine($"No Bueno, that's not a number.");
                        }
                        rolodex.Add(newHacker);
                        break;
                    }
                    else if (newMemberSpeciality == "LockSpec")
                    {
                        LockSpec newLockSpec = new LockSpec()
                        {
                            Name = newMemberName
                        };
                        Console.WriteLine("Please enter Skill Level (1-100)");
                        var newMemberSkillLevel = Console.ReadLine();
                        try
                        {
                            int newMemberSkillLevelNumber = int.Parse(newMemberSkillLevel);
                        }
                        catch
                        {
                            Console.WriteLine($"No Bueno, that's not a number.");
                        }
                        newLockSpec.SkillLevel = int.Parse(newMemberSkillLevel);
                        Console.WriteLine("What is this member's percentage pay cut? (1-100)");
                        var newMemberPayPercentage = Console.ReadLine();
                        try
                        {
                            int newMemberPayPercentageNumber = int.Parse(newMemberPayPercentage);
                        }
                        catch
                        {
                            Console.WriteLine($"No Bueno, that's not a number.");
                        }
                        rolodex.Add(newLockSpec);
                        break;
                    }
                    else
                    {
                        Console.WriteLine("That is a not a Valid speciality. Please try again.");
                    }
                    foreach (var member in rolodex)
                    {
                        Console.WriteLine(member.Name);
                    }
                }
            }
            Dictionary <string, int> bankScores = new Dictionary <string, int>();

            Random rand               = new Random();
            var    AlarmScore         = rand.Next(0, 101);
            var    VaultScore         = rand.Next(0, 101);
            var    SecurityGuardScore = rand.Next(0, 101);
            var    CashOnHand         = rand.Next(50000, 100000001);

            newBank.AlarmScore         = AlarmScore;
            newBank.VaultScore         = AlarmScore;
            newBank.SecurityGuardScore = SecurityGuardScore;
            newBank.CashOnHand         = CashOnHand;

            bankScores.Add("AlarmScore", AlarmScore);
            bankScores.Add("VaultScore", VaultScore);
            bankScores.Add("SecurityGuardScore", SecurityGuardScore);
            // bankScores.Add("CashOnHand", CashOnHand);
            //this sets the ordered scores to a variable to be called a few lines down
            var orderedScores = bankScores.OrderBy(score => score.Value);

            var mostSecure  = orderedScores.Last();
            var leastSecure = orderedScores.First();

            Console.WriteLine($"Most Secure: {mostSecure.Key}, {mostSecure.Value}");
            Console.WriteLine($"Least Secure: {leastSecure.Key}, {leastSecure.Value}");
            var Crew = new List <IRobber>();

            while (true)
            {
                foreach (var member in rolodex)
                {
                    if (!Crew.Contains(member))
                    {
                        Console.WriteLine($"{rolodex.IndexOf(member)} {member.ToString()}");
                    }
                }
                Console.WriteLine("Please choose a member by entering their index on the list.");
                var chosenMember = Console.ReadLine();
                try
                {
                    int chosenMemberNumber = int.Parse(chosenMember);
                }
                catch
                {
                    Console.WriteLine($"No Bueno, that's not a number.");
                }
                if (chosenMember == "")
                {
                    break;
                }
                var rolodexIndex  = int.Parse(chosenMember);
                var rolodexMember = rolodex.ElementAt(rolodexIndex);
                {
                    if (rolodexMember.PercentageCut > TotalPayPercent)
                    {
                        Console.WriteLine("This person is too expensive");
                    }
                    else
                    {
                        TotalPayPercent -= rolodexMember.PercentageCut;
                        Crew.Add(rolodexMember);
                        Console.WriteLine($"Remaining Cut: {TotalPayPercent}");
                    }
                }
            }
            Console.WriteLine("ASSEMBLED CREW");
            Console.WriteLine("===========================");
            foreach (var person in Crew)
            {
                Console.WriteLine($"{Crew.IndexOf(person)} {person.ToString()}");
            }

            foreach (var crewMember in Crew)
            {
                crewMember.PerformSkill(newBank);
            }
            if (newBank.IsSecure == true)
            {
                Console.WriteLine("The heist was a bust! Get out of there!");
            }
            else
            {
                Console.WriteLine("Great Job, I'll pull the van around, throw the money in and let's boogie.");
                double totalMemberEarnings = 0;
                foreach (var member in Crew)
                {
                    var yourTake = (member.PercentageCut / 100) * newBank.CashOnHand;
                    totalMemberEarnings += yourTake;
                    Console.WriteLine($"{member.Name}: your cut is {yourTake.ToString("C")}");
                }
                Console.Write($"The MasterMind earned {(newBank.CashOnHand - totalMemberEarnings).ToString("C")}");
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            Hacker         Hacker1         = new Hacker("Ronny", 60, 33);
            Hacker         Hacker2         = new Hacker("Bonny", 40, 20);
            Muscle         Muscle1         = new Muscle("Guido", 30, 23);
            Muscle         Muscle2         = new Muscle("Lido", 45, 33);
            LockSpecialist LockSpecialist1 = new LockSpecialist("Tom", 33, 13);
            LockSpecialist LockSpecialist2 = new LockSpecialist("Sam", 60, 33);

            Console.WriteLine($"{Hacker1.Name} is hacking the alarm system. Decreased security {Hacker1.SkillLevel} points");
            Console.WriteLine($"{Muscle1.Name} is hacking the alarm system. Decreased security {Muscle1.SkillLevel} points");
            Console.WriteLine($"{LockSpecialist1.Name} is hacking the alarm system. Decreased security {LockSpecialist1.SkillLevel} points");


            List <IRobber> rolodex = new List <IRobber>()
            {
                Hacker1, Muscle1, LockSpecialist1, Hacker2, Muscle2, LockSpecialist2
            };

            //When the program starts, print out the number of current operatives in the Rolodex.
            Console.WriteLine("=========================");
            Console.WriteLine($"You have {rolodex.Count} operatives in the rolodex");
            Console.WriteLine("Please enter the name of a possible new operative:");
            string NewName = Console.ReadLine();

            while (NewName != "")
            {
                Console.WriteLine("Please select the operatives specialty:");
                Console.WriteLine("1 - Hacker (Disables alarms)");
                Console.WriteLine("2 - Muscle (Disarms guards)");
                Console.WriteLine("3 - Lock Specialist (cracks vault)");
                int NewSelection = int.Parse(Console.ReadLine());
                Console.WriteLine("Please enter the operatives skill on a scale of 1 - 100");
                int NewSkillLevel = int.Parse(Console.ReadLine());
                Console.WriteLine("Please enter the operatives cut of the action");
                int NewPercentageCut = int.Parse(Console.ReadLine());
                // Console.WriteLine($"You entered {NewName} with a skill of {NewSelection} and Level of {NewSkillLevel} and cut of {NewPercentageCut }.");
                Console.WriteLine("=========================");



                if (NewSelection == 1)
                {
                    Hacker NextHacker = new Hacker(NewName, NewSkillLevel, NewPercentageCut);
                    rolodex.Add(NextHacker);
                }
                else if (NewSelection == 2)
                {
                    Muscle NextMuscle = new Muscle(NewName, NewSkillLevel, NewPercentageCut);
                    rolodex.Add(NextMuscle);
                }
                else if (NewSelection == 3)
                {
                    LockSpecialist NextLockSpecialist = new LockSpecialist(NewName, NewSkillLevel, NewPercentageCut);
                    rolodex.Add(NextLockSpecialist);
                }
                Console.WriteLine("Please enter the name of a possible new operative:");
                NewName = Console.ReadLine();
            }
            Random RandomNumber = new Random();
            Bank   Newbank      = new Bank()
            {
                CashOnHand         = RandomNumber.Next(49_999, 1_000_000_000),
                AlarmScore         = RandomNumber.Next(0, 101),
                VaultScore         = RandomNumber.Next(0, 101),
                SecurityGuardScore = RandomNumber.Next(0, 101)
            };

            Console.WriteLine("=========Recon Report==========");
            Console.WriteLine();



            foreach (var robber in rolodex)
            {
                Console.WriteLine(robber);
            }
        }
    }
Пример #3
0
        static void Main(string[] args)
        {
            //used for adding new member at the beginning
            bool nameCheck = true;
            //used for adding members to heist
            bool crewCheck = true;
            //Cut for heist
            int heistProfits = 100;

            Random rand = new Random();

            Hacker Strongbad = new Hacker();

            Strongbad.Name          = "StrongBad";
            Strongbad.SkillLevel    = 33;
            Strongbad.PercentageCut = 25;

            Hacker Schwartz = new Hacker();

            Schwartz.Name          = "Schwartz";
            Schwartz.SkillLevel    = 8;
            Schwartz.PercentageCut = 1;

            Muscle Akai = new Muscle();

            Akai.Name          = "Akai";
            Akai.SkillLevel    = 81;
            Akai.PercentageCut = 50;

            Muscle HeavyWeaponsGuy = new Muscle();

            HeavyWeaponsGuy.Name          = "HeavyWeaponsGuy";
            HeavyWeaponsGuy.SkillLevel    = 66;
            HeavyWeaponsGuy.PercentageCut = 50;

            Muscle FatTimAllen = new Muscle();

            FatTimAllen.Name          = "FatTimAllen";
            FatTimAllen.SkillLevel    = 19;
            FatTimAllen.PercentageCut = 33;

            LockSpecialist Genichiro = new LockSpecialist();

            Genichiro.Name          = "Genichiro";
            Genichiro.SkillLevel    = 81;
            Genichiro.PercentageCut = 0;

            //List of team members to choose from.///////////
            List <IRobber> rolodex = new List <IRobber>()
            {
                Strongbad,
                Schwartz,
                Akai,
                HeavyWeaponsGuy,
                FatTimAllen,
                Genichiro
            };

            //User constructed team for the heist.////////////
            List <IRobber> crew = new List <IRobber>();

            Console.WriteLine("I knew we'd see you again...funds dryin' up?");
            Console.WriteLine($"There are currently {rolodex.Count} operatives in your black book. \n");

            //Prompts continue until user enters no name for a new robber.
            while (nameCheck)
            {
                Console.WriteLine("Got some new blood in mind?");
                string Name = Console.ReadLine();
                if (Name == "")
                {
                    nameCheck = false;
                }
                else
                {
                    Console.WriteLine("\nThis ain't a daycare, what are they bringin' to the table? ");
                    Console.WriteLine("Choose one:");
                    Console.WriteLine("1.) Hacker,\n2.) Muscle,\n3.) LockSpecialist");

                    string choice = Console.ReadLine();
                    //changes set of prompts and class generation based on user choice
                    switch (choice)
                    {
                    case "1":
                        Hacker newHacker = new Hacker();
                        newHacker.Name = Name;

                        Console.WriteLine("\nA hacker, eh...they any good? On, like, an arbitrary integer based scale of 1 - 100?");
                        int SkillLevel = int.Parse(Console.ReadLine());
                        newHacker.SkillLevel = SkillLevel;

                        Console.WriteLine("\nI'll take your word for it...how much they want? Again, in an arbitrary 1-100 percentage kinda way");
                        int PercentageCut = int.Parse(Console.ReadLine());
                        newHacker.PercentageCut = PercentageCut;

                        rolodex.Add(newHacker);
                        break;

                    case "2":
                        Muscle newMuscle = new Muscle();
                        newMuscle.Name = Name;

                        Console.WriteLine("\nA Muscle, eh...they any good? On, like, an arbitrary integer based scale of 1 - 100?");
                        SkillLevel           = int.Parse(Console.ReadLine());
                        newMuscle.SkillLevel = SkillLevel;

                        Console.WriteLine("\nI'll take your word for it...how much they want? Again, in an arbitrary 1-100 percentage kinda way");
                        PercentageCut           = int.Parse(Console.ReadLine());
                        newMuscle.PercentageCut = PercentageCut;

                        rolodex.Add(newMuscle);
                        break;

                    case "3":
                        LockSpecialist newLockSpecialist = new LockSpecialist();
                        newLockSpecialist.Name = Name;

                        Console.WriteLine("\nA LockSpecialist, eh...they any good? On, like, an arbitrary integer based scale of 1 - 100?");
                        SkillLevel = int.Parse(Console.ReadLine());
                        newLockSpecialist.SkillLevel = SkillLevel;

                        Console.WriteLine("\nI'll take your word for it...how much they want? Again, in an arbitrary 1-100 percentage kinda way");
                        PercentageCut = int.Parse(Console.ReadLine());
                        newLockSpecialist.PercentageCut = PercentageCut;

                        rolodex.Add(newLockSpecialist);
                        break;
                    }
                }
            }
            Console.WriteLine("\nWell, let's get started then...\n");
            Console.ReadLine();

            //Generates a new bank with random security values.
            Bank newBank = new Bank();

            newBank.AlarmScore         = rand.Next(0, 101);
            newBank.VaultScore         = rand.Next(0, 101);
            newBank.SecurityGuardScore = rand.Next(0, 101);
            newBank.CashOnHand         = rand.Next(50_000, 1_000_000);
            newBank.ReconReport();

            Console.WriteLine("~^*~^*~^*~^*Rogue Gallery*^~*^~*^~*^~");
            foreach (IRobber member in rolodex)
            {
                int i = rolodex.IndexOf(member);
                Console.Write($"{i}.) ");
                member.RolodexReport();
            }
            Console.WriteLine("\nNow that you know who you've got to pick from, let's get to work...");

            while (crewCheck)
            {
                Console.Write($"\nYou've got {heistProfits}% profit remaining, who do you want to hire?: ");
                string crewChoice = Console.ReadLine();
                if (crewChoice == "")
                {
                    crewCheck = false;
                }
                else
                {
                    int crewChoiceNum = int.Parse(crewChoice);
                    //Adds selection to new crew
                    crew.Add(rolodex[crewChoiceNum]);
                    //Subtracts PercentageCut from heistProfits
                    heistProfits -= rolodex[crewChoiceNum].PercentageCut;
                    //Removes selection from rolodex
                    rolodex.RemoveAt(crewChoiceNum);

                    foreach (IRobber member in rolodex)
                    {
                        if (member.PercentageCut < heistProfits)
                        {
                            int i = rolodex.IndexOf(member);
                            Console.Write($"{i}.) ");
                            member.RolodexReport();
                        }
                        else
                        {
                            int i = rolodex.IndexOf(member);
                            Console.WriteLine($"{i}.) Sorry bub, they're too expensive.");
                        }
                    }
                }
            }

            Console.WriteLine("\n~^*~^*~^*~^*Your Team*^~*^~*^~*^~");
            foreach (IRobber member in crew)
            {
                member.RolodexReport();
            }
            Console.WriteLine("Let's get to work!");
            Console.ReadLine();

            foreach (IRobber member in crew)
            {
                member.PerformSkill(newBank);
            }
            newBank.IsSecure();

            if (newBank.AlarmScore > 0 && newBank.VaultScore > 0 && newBank.SecurityGuardScore > 0)
            {
                Console.WriteLine("\nWhat are you doing?! You're gonna get us killed!");
            }
            else
            {
                Console.WriteLine("\nWe're eatin' good tonight, crew!");
                int takeHomePercent = newBank.CashOnHand / 100;
                Console.WriteLine($"Of the stolen ${newBank.CashOnHand}");
                foreach (IRobber member in crew)
                {
                    int memberProfit = takeHomePercent * member.PercentageCut;
                    Console.WriteLine($"{member.Name} took home ${memberProfit}");
                    newBank.CashOnHand -= memberProfit;
                }
                Console.WriteLine($"Which leaves you with ${newBank.CashOnHand}. Enjoy!");
            }
        }
Пример #4
0
        static void Main(string[] args)
        {
            Hacker will = new Hacker()
            {
                name          = "Will",
                SkillLevel    = 50,
                PercentageCut = 15
            };
            Hacker noah = new Hacker()
            {
                name          = "Noah",
                SkillLevel    = 48,
                PercentageCut = 12
            };
            Muscle bobby = new Muscle()
            {
                name          = "Bobby",
                SkillLevel    = 12,
                PercentageCut = 7
            };
            Muscle liam = new Muscle()
            {
                name          = "Liam Neeson",
                SkillLevel    = 88,
                PercentageCut = 27
            };
            LockPickSpecialist ted = new LockPickSpecialist()
            {
                name          = "Teddy Roosevelt",
                SkillLevel    = 68,
                PercentageCut = 30
            };
            LockPickSpecialist grover = new LockPickSpecialist()
            {
                name          = "Grover Cleveland",
                SkillLevel    = 56,
                PercentageCut = 25
            };
            List <IRobber> rolodex = new List <IRobber>()
            {
                will, noah, bobby, liam, ted, grover
            };

            Console.WriteLine("WELCOME TO HEIST 2");
            Console.WriteLine("------------------");
            Console.WriteLine($"Number of Operatives in the Rolodex: {rolodex.Count}");
            Console.WriteLine("");

            Console.WriteLine("Create a New Operative");
            Console.Write("Name: ");
            string name = Console.ReadLine();

            while (name != "")
            {
                Console.WriteLine("Choose a Specialty");
                Console.WriteLine("");
                Console.WriteLine("- Hacker (Disables alarms)");
                Console.WriteLine("- Muscle (Disarms guards)");
                Console.WriteLine("- Lock Specialist (cracks vault)");
                Console.WriteLine("");
                Console.Write("Specialty: ");
                string specialty = Console.ReadLine();
                while (specialty.ToLower() != "")
                {
                    if (specialty.ToLower() == "hacker")
                    {
                        break;
                    }
                    else if (specialty.ToLower() == "muscle")
                    {
                        break;
                    }
                    else if (specialty.ToLower() == "lock specialist")
                    {
                        break;
                    }
                    else
                    {
                        Console.WriteLine("Please select a valid specialty!");
                        Console.Write("Specialty: ");
                        specialty = Console.ReadLine();
                    }
                }
                Console.WriteLine("");
                Console.Write("Enter a Skill Level (Between 1-100): ");
                int skillLevel = int.Parse(Console.ReadLine());

                Console.WriteLine("");
                Console.Write("Enter the operatives cut of the heist(Between 1-100): ");
                int percentageCut = int.Parse(Console.ReadLine());

                if (specialty.ToLower() == "hacker")
                {
                    Hacker newHacker = new Hacker()
                    {
                        name          = name,
                        SkillLevel    = skillLevel,
                        PercentageCut = percentageCut
                    };
                    rolodex.Add(newHacker);
                }
                if (specialty.ToLower() == "muscle")
                {
                    Muscle newMuscle = new Muscle()
                    {
                        name          = name,
                        SkillLevel    = skillLevel,
                        PercentageCut = percentageCut
                    };
                    rolodex.Add(newMuscle);
                }
                if (specialty.ToLower() == "lock specialist")
                {
                    LockPickSpecialist newLockPickSpcialist = new LockPickSpecialist()
                    {
                        name          = name,
                        SkillLevel    = skillLevel,
                        PercentageCut = percentageCut
                    };
                    rolodex.Add(newLockPickSpcialist);
                }

                Console.WriteLine("");
                Console.WriteLine("Create another operative (or press enter to continue)");
                Console.Write("Name: ");
                name = Console.ReadLine();
            }
            Random rnd  = new Random();
            Bank   HSBC = new Bank()
            {
                AlarmScore         = rnd.Next(101),
                VaultScore         = rnd.Next(101),
                SecurityGuardScore = rnd.Next(101),
                CashOnHand         = rnd.Next(50_000, 1_000_001)
            };

            Console.WriteLine("");
            HSBC.FindSecurityLevel();
            Console.WriteLine("");
            Console.WriteLine("Pick Your team");
            for (int i = 0; i < rolodex.Count; i++)
            {
                Console.WriteLine("- - - - - - - - - -");
                Console.WriteLine($"Name: {rolodex[i].name}");
                Console.WriteLine($"Index: {i + 1}");
                Console.WriteLine($"Specialty: {rolodex[i].specialty}");
                Console.WriteLine($"Skill Level: {rolodex[i].SkillLevel}");
                Console.WriteLine($"Percentage Cut: {rolodex[i].PercentageCut}%");
            }

            Console.WriteLine("");
            List <IRobber> crew = new List <IRobber>();

            Console.Write("Add crew by Index: ");
            string addCrew  = Console.ReadLine();
            int    finalCut = 0;

            while (addCrew != "")
            {
                crew.Add(rolodex[int.Parse(addCrew) - 1]);
                Console.WriteLine("");
                Console.WriteLine($"{rolodex[int.Parse(addCrew) - 1].name} has been added!");
                Console.WriteLine("");
                finalCut += rolodex[int.Parse(addCrew) - 1].PercentageCut;
                Console.WriteLine($"------------------------------");
                Console.WriteLine($"Current Total Cut: {finalCut}%");
                Console.WriteLine($"------------------------------");
                rolodex.Remove(rolodex[int.Parse(addCrew) - 1]);
                Console.WriteLine("");
                Console.WriteLine("Pick Your team");
                for (int i = 0; i < rolodex.Count; i++)
                {
                    if ((finalCut + rolodex[i].PercentageCut) > 100)
                    {
                        Console.WriteLine("");
                    }
                    else
                    {
                        Console.WriteLine("- - - - - - - - - -");
                        Console.WriteLine($"Name: {rolodex[i].name}");
                        Console.WriteLine($"Index: {i + 1}");
                        Console.WriteLine($"Specialty: {rolodex[i].specialty}");
                        Console.WriteLine($"Skill Level: {rolodex[i].SkillLevel}");
                        Console.WriteLine($"Percentage Cut: {rolodex[i].PercentageCut}%");
                    }
                }
                Console.WriteLine("");
                Console.Write("Add more crew by Index: ");
                addCrew = Console.ReadLine();
            }
            foreach (IRobber robber in crew)
            {
                robber.PerformSkill(HSBC);
                Console.WriteLine("");
            }
            bool bankSecure = HSBC.IsSecure();

            if (bankSecure == true)
            {
                Console.WriteLine("- - - - - - - - - - - - - - - ");
                Console.WriteLine("The Heist was a SUCCESS!!!");
                Console.WriteLine($"Heist Profits: {HSBC.CashOnHand}");
                Console.WriteLine("- - - - - - - - - - - - - - - ");
                foreach (IRobber robber in crew)
                {
                    double cutPercentage = (robber.PercentageCut * .01);
                    double profit        = (cutPercentage * HSBC.CashOnHand);
                    Console.WriteLine($"{robber.name} recieves ${Math.Round(profit, 2)} from the heist!");
                }
                double yourPercentage = (100 - finalCut);
                double yourProfit     = ((yourPercentage * .01) * HSBC.CashOnHand);
                Console.WriteLine("- - - - - - - - - - - - - - -");
                Console.WriteLine($"Your total profit from the Heist ${Math.Round(yourProfit, 2)}");
            }
            else
            {
                Console.WriteLine("- - - - - - - - - - - - - - - ");
                Console.WriteLine("The Heist was a failure, you are a failure.");
                Console.WriteLine("- - - - - - - - - - - - - - - ");
            }
        }
Пример #5
0
        static void Main(string[] args)
        {
            List <IRobber> rolodex = new List <IRobber>();

            var MrPink = new Hacker()
            {
                Name          = "Mr. Pink",
                SkillLevel    = 50,
                PercentageCut = 33
            };
            var MrBlue = new Hacker()
            {
                Name          = "Mr. Blue",
                SkillLevel    = 40,
                PercentageCut = 20
            };
            var MrWhite = new LockSpecialist()
            {
                Name          = "Mr. White",
                SkillLevel    = 55,
                PercentageCut = 40
            };
            var MrRed = new LockSpecialist()
            {
                Name          = "Mr. Red",
                SkillLevel    = 75,
                PercentageCut = 10
            };
            var MrGreen = new Muscle()
            {
                Name          = "Mr. Green",
                SkillLevel    = 33,
                PercentageCut = 10
            };
            var MrYellow = new Muscle()
            {
                Name          = "Mr. Brownlee",
                SkillLevel    = 100,
                PercentageCut = 99
            };

            rolodex.Add(MrBlue);
            rolodex.Add(MrGreen);
            rolodex.Add(MrPink);
            rolodex.Add(MrWhite);
            rolodex.Add(MrYellow);
            rolodex.Add(MrRed);

            Console.WriteLine($"\nThere are {rolodex.Count} robbers in your rolodex");
            Console.WriteLine("It's time to add robbers to the rolodex.");

            bool teamNameBlank = false;

            while (teamNameBlank == false)
            {
                Console.WriteLine("\nPlease enter the new robber's name:");
                string robberName = Console.ReadLine();
                if (string.IsNullOrEmpty(robberName))
                {
                    teamNameBlank = true;
                    break;
                }
                string robberSpeciality = "";
                while ((robberSpeciality != "Hacker") && (robberSpeciality != "Muscle") && (robberSpeciality != "Lock Specialist"))
                {
                    Console.WriteLine("\nPlease enter the new robber's speciality:");
                    Console.WriteLine("Hacker (Disables alarms)");
                    Console.WriteLine("Muscle (Disarms guards)");
                    Console.WriteLine("Lock Specialist (cracks vault)");
                    robberSpeciality = Console.ReadLine();
                    if (robberSpeciality != "Hacker" && robberSpeciality != "Muscle" && robberSpeciality != "Lock Specialist")
                    {
                        Console.WriteLine("\nYou've entered an invalid answer. Please select a valid speciality('Hacker', 'Muscle', 'Lock Specialist').\n");
                    }
                }
                int robberSkillLevel = 0;
                while (robberSkillLevel >= 0 && robberSkillLevel <= 100)
                {
                    Console.WriteLine("\nPlease enter the new robber's skill level as a number between 0 and 100:");
                    string skillLevelEntry = Console.ReadLine();
                    try
                    {
                        int skillLevelParsed = int.Parse(skillLevelEntry);
                        if (skillLevelParsed <= 0 || skillLevelParsed >= 100)
                        {
                            Console.WriteLine("\nThe robber's skill level must be between 0 and 100.\n");
                        }
                        else
                        {
                            robberSkillLevel = skillLevelParsed;
                            break;
                        }
                    }
                    catch (FormatException ex)
                    {
                        Console.WriteLine("\nYou have entered an invalid skill level. Please enter an integer between 0 and 100.\n");
                    }
                }
                int robberPercentageCut = 0;
                while (robberPercentageCut <= 0 || robberPercentageCut >= 100)
                {
                    Console.WriteLine("\nPlease enter the new robber's cut of the take as a number between 0 and 100:");
                    var percentageCutEntry = Console.ReadLine();
                    try
                    {
                        int percentageCutParsed = int.Parse(percentageCutEntry);
                        Console.WriteLine("The try for skill level executed");
                        if (percentageCutParsed <= 0 && percentageCutParsed >= 100)
                        {
                            Console.WriteLine("The robber's cut must be between 0 and 100.\n");
                        }
                        else
                        {
                            robberPercentageCut = percentageCutParsed;
                            Console.WriteLine($"robberPercentageCut = {robberPercentageCut}");
                        }
                    }
                    catch
                    {
                        Console.WriteLine("You have entered an invalid percentage cut. Please enter an integer between 0 and 100.\n");
                    }
                }
                if (robberSpeciality == "Hacker")
                {
                    var hacker = new Hacker()
                    {
                        Name          = robberName,
                        SkillLevel    = robberSkillLevel,
                        PercentageCut = robberPercentageCut
                    };
                    rolodex.Add(hacker);
                }
                else if (robberSpeciality == "Muscle")
                {
                    var muscle = new Muscle()
                    {
                        Name          = robberName,
                        SkillLevel    = robberSkillLevel,
                        PercentageCut = robberPercentageCut
                    };
                    rolodex.Add(muscle);
                }
                else if (robberSpeciality == "Lock Specialist")
                {
                    var lockpick = new LockSpecialist()
                    {
                        Name          = robberName,
                        SkillLevel    = robberSkillLevel,
                        PercentageCut = robberPercentageCut
                    };
                    rolodex.Add(lockpick);
                }
                Console.WriteLine($"\n\nThere are {rolodex.Count} robbers in your rolodex\n");
            }

            Random rand               = new Random();
            int    alarmScore         = rand.Next(0, 101);
            int    vaultScore         = rand.Next(0, 101);
            int    securityGuardScore = rand.Next(0, 101);
            int    cashOnHand         = rand.Next(50000, 1000001);

            Dictionary <string, int> systems = new Dictionary <string, int>();

            systems.Add("Alarm", alarmScore);
            systems.Add("Vault", vaultScore);
            systems.Add("Security Guards", securityGuardScore);


            var sortedSystems = systems.OrderBy(kvp => kvp.Value);

            var leastSecure = sortedSystems.First();
            var mostSecure  = sortedSystems.Last();

            Console.WriteLine("Recon Report");
            Console.WriteLine("---------------------");
            Console.WriteLine($"Most Secure: {mostSecure.Key} {mostSecure.Value}");
            Console.WriteLine($"Least Secure: {leastSecure.Key} {leastSecure.Value}");
            var bank = new Bank()
            {
                AlarmScore         = alarmScore,
                VaultScore         = vaultScore,
                SecurityGuardScore = securityGuardScore,
                CashOnHand         = cashOnHand
            };

            Console.WriteLine("Bank's alarm score: " + bank.AlarmScore);
            Console.WriteLine("Bank's vault score: " + bank.VaultScore);
            Console.WriteLine("Bank's security guard score: " + bank.SecurityGuardScore);
            Console.WriteLine("Bank's cash on hand: $" + bank.CashOnHand + "\n");

            List <IRobber> crew = new List <IRobber>();

            bool crewIndexBlank = false;

            Console.WriteLine("\nIt's time to build your crew!");

            double percentageTotal = 100;

            while (crewIndexBlank == false)
            {
                Console.WriteLine("Here are the robbers you can add to your crew:");
                Console.WriteLine("----------------------------------------------");
                foreach (var robber in rolodex)
                {
                    double robberCut           = robber.PercentageCut;
                    double percentageRemainder = percentageTotal - robberCut;
                    if (!crew.Contains(robber))
                    {
                        if (percentageRemainder > 0)
                        {
                            Console.Write($"{robber.Name}");
                            Console.Write($" - [{rolodex.IndexOf(robber)}]");
                            if (robber.GetType() == typeof(Hacker))
                            {
                                Console.WriteLine("\n*Hacker");
                            }
                            else if (robber.GetType() == typeof(Muscle))
                            {
                                Console.WriteLine("\n*Muscle");
                            }
                            else if (robber.GetType() == typeof(LockSpecialist))
                            {
                                Console.WriteLine("\n*Lock Specialist");
                            }
                            Console.WriteLine($"*Skill level: {robber.SkillLevel}");
                            Console.WriteLine($"*Percentage cut: {robber.PercentageCut}\n");
                        }
                    }
                }
                Console.WriteLine($"\nCut remaining: {percentageTotal}");
                Console.WriteLine("Add a robber to your crew by entering their number:");
                string enteredIndex = Console.ReadLine();
                if (enteredIndex.Length > 0)
                {
                    try
                    {
                        int robberIndex = int.Parse(enteredIndex);

                        if (robberIndex >= 0 && robberIndex <= rolodex.Count)
                        {
                            var    chosenRobber    = rolodex[robberIndex];
                            double chosenRobberCut = chosenRobber.PercentageCut;
                            if ((percentageTotal - chosenRobberCut) < 0)
                            {
                                Console.WriteLine("\nTheir cut is too high. Pick someone else.\n");
                            }
                            else
                            {
                                if (!crew.Contains(chosenRobber))
                                {
                                    crew.Add(chosenRobber);
                                    percentageTotal -= chosenRobber.PercentageCut;
                                }
                                else
                                {
                                    Console.WriteLine("That robber is already on your crew.\n");
                                }
                            }
                        }
                        else if (robberIndex < 0 || robberIndex > 100)
                        {
                            Console.WriteLine("Please enter a valid index.");
                        }
                    }
                    catch
                    {
                        Console.WriteLine("Invalid input. Please enter a valid index in the rolodex.\n");
                    }
                }
                else
                {
                    if (crew.Count <= 0)
                    {
                        Console.WriteLine("Your crew is empty! Add robbers to it\n");
                    }
                    else
                    {
                        break;
                    }
                }
            }

            foreach (var member in crew)
            {
                member.PerformSkill(bank);
            }

            if (bank.IsSecure)
            {
                Console.WriteLine("Your crew blew it! Enjoy the slammer!");
            }
            else
            {
                double teamTake = 0;
                foreach (var member in crew)
                {
                    double memberTake = (member.PercentageCut / 100) * bank.CashOnHand;
                    Console.WriteLine($"{member.Name}'s cut: " + String.Format("{0:00.0}", memberTake));
                    teamTake += memberTake;
                }
                double yourTake = bank.CashOnHand - teamTake;
                Console.WriteLine($"Your final take: " + String.Format("{0:00.0}", yourTake));
            }
        }
Пример #6
0
        static void Main(string[] args)
        {
            List <IRobber> rolodex = new List <IRobber>();

            Hacker neo = new Hacker()
            {
                Name = "Neo", SkillLevel = 50, PercentageCut = 33
            };
            Hacker trinity = new Hacker()
            {
                Name = "Trinity", SkillLevel = 60, PercentageCut = 35
            };
            Muscle therock = new Muscle()
            {
                Name = "The Rock", SkillLevel = 40, PercentageCut = 30
            };
            Muscle arnold = new Muscle()
            {
                Name = "Arnold", SkillLevel = 30, PercentageCut = 25
            };
            LockSpecialist jason = new LockSpecialist()
            {
                Name = "Jason", SkillLevel = 45, PercentageCut = 32
            };
            LockSpecialist brad = new LockSpecialist()
            {
                Name = "Brad", SkillLevel = 35, PercentageCut = 28
            };

            rolodex.Add(neo);
            rolodex.Add(trinity);
            rolodex.Add(therock);
            rolodex.Add(arnold);
            rolodex.Add(jason);
            rolodex.Add(brad);

            Console.WriteLine($"Operatives in Rolodex: {rolodex.Count()}");
            Console.WriteLine("Enter new operative name>");
            string newName = Console.ReadLine();

            while (newName != "")
            {
                Console.WriteLine("Choose operative speciality:");
                Console.WriteLine("1: Hacker (Disables alarms)");
                Console.WriteLine("2: Muscle (Disarms guards");
                Console.WriteLine("3: Lock Specialist (Cracks vault)");
                Console.WriteLine("Enter Speciality Number (1-3)>");
                string newSpeciality = Console.ReadLine();
                Console.WriteLine("Enter Skill Level (1-100)>");
                string newSkillLevel = Console.ReadLine();
                Console.WriteLine("Enter percentage cut (1-100)>");
                string newPercentageCut = Console.ReadLine();


                if (int.Parse(newSpeciality) == 1)
                {
                    Hacker newOperative = new Hacker()
                    {
                        Name          = newName,
                        SkillLevel    = int.Parse(newSkillLevel),
                        PercentageCut = int.Parse(newPercentageCut)
                    };
                    rolodex.Add(newOperative);
                }
                else if (int.Parse(newSpeciality) == 2)
                {
                    Muscle newOperative = new Muscle()
                    {
                        Name          = newName,
                        SkillLevel    = int.Parse(newSkillLevel),
                        PercentageCut = int.Parse(newPercentageCut)
                    };
                    rolodex.Add(newOperative);
                }
                else
                {
                    LockSpecialist newOperative = new LockSpecialist()
                    {
                        Name          = newName,
                        SkillLevel    = int.Parse(newSkillLevel),
                        PercentageCut = int.Parse(newPercentageCut)
                    };
                    rolodex.Add(newOperative);
                }

                Console.WriteLine("Enter new operative name>");
                newName = Console.ReadLine();
            }

            Random generator  = new Random();
            int    alarmValue = generator.Next(0, 101);
            int    vaultValue = generator.Next(0, 101);
            int    guardValue = generator.Next(0, 101);
            int    cashValue  = generator.Next(50_000, 1_000_001);

            Bank gothamCentral = new Bank()
            {
                AlarmScore         = alarmValue,
                VaultScore         = vaultValue,
                SecurityGuardScore = guardValue,
                CashOnHand         = cashValue
            };

            List <int> systems = new List <int>();

            systems.Add(gothamCentral.AlarmScore);
            systems.Add(gothamCentral.VaultScore);
            systems.Add(gothamCentral.SecurityGuardScore);

            Console.WriteLine("Recon Report");
            Console.WriteLine("-------------");
            Console.WriteLine($"Most Secure: {systems.Max()}");
            Console.WriteLine($"Least Secure: {systems.Min()}");

            Console.WriteLine("Rolodex Report");
            Console.WriteLine("--------------");
            foreach (var operative in rolodex)
            {
                Console.WriteLine($"Name: {operative.Name}");
                Console.WriteLine($"Specialty: {operative.Speciality}");
                Console.WriteLine($"Skill Level: {operative.SkillLevel}");
                Console.WriteLine($"Cut of Take: {operative.PercentageCut}%");
                Console.WriteLine("--------------");
            }
        }