Example #1
0
    public static void Main(String[] args)
    {
        Console.WriteLine("Enter a game");
        string game_name = Console.ReadLine();

        Console.WriteLine("Enter the maximum number of players");
        int max1 = Convert.ToInt32(Console.ReadLine());

        Console.WriteLine("Enter a game that has time limit");
        string game1 = Console.ReadLine();

        Console.WriteLine("Enter the maximum number of players");
        int max_player = Convert.ToInt32(Console.ReadLine());

        Console.WriteLine("Enter the time limit in minutes");
        int  time_limit = Convert.ToInt32(Console.ReadLine());
        Game obj;

        obj               = new Game();
        obj.Name          = game_name;
        obj.MaxNumPlayers = max1;
        string first = obj.ToString();

        Console.WriteLine(first);

        GameWithTimeLimit obj1 = new GameWithTimeLimit();

        obj1.Name          = game1;
        obj1.MaxNumPlayers = max_player;
        obj1.Minutes       = time_limit;
        string lst = obj1.ToString();

        Console.WriteLine(lst);
    }
    public static void Main(string[] args)
    {
        Game g = new Game();
        GameWithTimeLimit gt = new GameWithTimeLimit();

        Console.WriteLine("Enter a game");
        g.Name = Console.ReadLine();

        Console.WriteLine("Enter the maximum number of players");
        g.MaxNumPlayers = int.Parse(Console.ReadLine());

        Console.WriteLine("Enter a game that has time limit");
        gt.Name = Console.ReadLine();

        Console.WriteLine("Enter the maximum number of players");
        gt.MaxNumPlayers = int.Parse(Console.ReadLine());

        Console.WriteLine("Enter the time limit in minutes");
        gt.TimeLimit = int.Parse(Console.ReadLine());

        Console.WriteLine(g.ToString());
        Console.WriteLine(gt.ToString());
    }