Advertisement
ScottishLad

MonopolyModuleHelp

Jan 25th, 2018
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.87 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace MonopolyCSharpNonForm
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.  
  14.             //Primary Settings
  15.             int StartingBallance = 2000;
  16.             int PassGo = 200;
  17.             int Bail = 50;
  18.             int IncomeTax = 100;
  19.             int SuperTax = 200;
  20.             string TaxLocation = 1; // 1 goes to the bank
  21.  
  22.             //Players/Economy
  23.             string Player1 = "Player1";
  24.             string Player2 = "";
  25.             string Player3 = "";
  26.             string Player4 = "";
  27.             int Ballance1 = 2000;
  28.             int Ballance2 = 2000;
  29.             int Ballance3 = 2000;
  30.             int Ballance4 = 2000;
  31.             int FreeParking = 0;
  32.             string[] BankRupties = { };
  33.  
  34.             MainMenu(); // Calling Main Menu
  35.         }
  36.  
  37.         static void MainMenu()
  38.         {
  39.             Console.WriteLine("Welcome to Monpoly Banker V4");
  40.             Console.WriteLine("Would you to use the Default or Custom settings?"); //Ask for Default or Custom option
  41.             string LocalOption = Console.ReadLine(); //Record the option as a local variable 'LocalOption'
  42.             while (LocalOption != "Default" && LocalOption != "Custom")//Check if LocalOption is 'Default' or 'Custom'
  43.             {
  44.                 Console.WriteLine("Niether option has been specified, type 'Default' or 'Custom'"); // If not state there is an Error.
  45.                 LocalOption = Console.ReadLine(); //Record the input again.
  46.             }
  47.  
  48.             if (LocalOption == "Custom") // Check if local variable is equal to custom.
  49.             {
  50.                 SetCustom(ref StartingBallance, ref PassGo, ref Bail, ref IncomeTax, ref SuperTax, ref TaxLocation); //If it is run the SetCustom module below with the required parameters
  51.             }
  52.             else //Anything else it runs GettingNames module with required parameters
  53.             {
  54.                 GettingNames(ref Player1, ref Player2, ref Player3, ref Player4);
  55.             }
  56.         }
  57.  
  58.         static void SetCustom(ref int StartingBallance, ref int PassGo, ref int Bail, ref int IncomeTax, ref int SuperTax, ref string TaxLocation)
  59.         {
  60.             Console.WriteLine("\nHow much money is everyone starting with? "); // Ask for Starting Ballance
  61.             StartingBallance = Convert.ToInt32(Console.ReadLine()); // Change the StartingBallance to entered integer
  62.             Console.WriteLine("\nHow much money if you pass go? "); // Ask how much you get for passing go
  63.             PassGo = Convert.ToInt32(Console.ReadLine()); // change PassGo to entered integer
  64.             Console.WriteLine("\nHow much will bail cost? "); // Ash how much Bail is going to cost
  65.             Bail = Convert.ToInt32(Console.ReadLine()); // change Bail to entered integer
  66.             Console.WriteLine("\nHow much will income tax cost? "); // Ask how much Income Tax will cost
  67.             IncomeTax = Convert.ToInt32(Console.ReadLine()); // Change IncomeTax to entered Integer
  68.             Console.WriteLine("\nHow much will super tax cost? "); // Ask how much Super Tax will cost
  69.             SuperTax = Convert.ToInt32(Console.ReadLine()); // Record the entered integer
  70.             Console.WriteLine("\nDoes tax go to the bank for free parking? (1 = Bank | 2 = Free Parking)"); // Ask for where free parking will go (1/2 to make options easier)
  71.             TaxLocation = Console.ReadLine(); // Change TaxLocation to entered String
  72.             while (TaxLocation != "1" && TaxLocation != "2") // Check TaxLocation is either '1' or '2'
  73.             {
  74.                 Console.WriteLine("Invalid Input. Try again."); // If not state its invalid input
  75.                 TaxLocation = Console.ReadLine(); // Record entered Integer
  76.             }
  77.  
  78.             GettingNames(ref Player1, ref Player2, ref Player3, ref Player4); // When done continue on to module Getting Names passing required parameters
  79.  
  80.         }
  81.  
  82.         static void GettingNames(ref string Player1, ref string Player2, ref string Player3, ref string Player4)
  83.         {
  84.             Console.WriteLine("\nWhat is Player1 name? "); // Ask Player1 name
  85.             Player1 = Console.ReadLine(); // Set Player1 to entered string
  86.             Console.WriteLine("\nWhat is Player2 name? "); // Ask Player2 name
  87.             Player2 = Console.ReadLine(); // Set Player1 to entered string
  88.             Console.WriteLine("\nWhat is Player3 name? "); // Ask Player3 name
  89.             Player3 = Console.ReadLine(); // Set Player1 to entered string
  90.             Console.WriteLine("\nWhat is Player4 name? "); // Ask Player4 name
  91.             Player4 = Console.ReadLine(); // Set Player1 to entered string
  92.  
  93.             Console.WriteLine("All 4 player names have been entered."); // State all names entered and received
  94.         }
  95.     }
  96. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement