Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            //starting point of the application
            //we will load the menu of the application
            //here
            rooms = new List<Classroom>();

            Computer PC1 = new Computer("L113-", "OK", 5);
            Computer PC2 = new Computer("L11", "OK", 2);
            Computer PC3 = new Computer("L1", "NOT OK", 3);
            Computer PC4 = new Computer("L113-8", "NOT OK", 3);
            Laptop PC5 = new Laptop("L113-9", "NOT OK", 3);

            List<Computer> computers = new List<Computer>();

            computers.Add(PC1);
            computers.Add(PC2);
            computers.Add(PC3);
            computers.Add(PC4);
            computers.Add(PC5);

            //myClassroom = L113
            Classroom myClassroom = new Classroom("L113", true,computers);

            List<Computer> computers2 = new List<Computer>();

            computers2.Add(new Computer("L114-1", "OK", 1));
            computers2.Add(new Computer("L114-2", "OK", 5));

            //myClassroom2 = L114
            Classroom myClassroom2 = new Classroom("L114", true, computers2);

            //max classrooms = 4

            //first 2 classrooms
               rooms.Add(myClassroom);
            rooms.Add(myClassroom2);

            String menu =
                "1.) List all classrooms in system \t\n" +
                "2.) Add new classroom \t\n" +
                "3.) Add new computer to classroom \t\n" +
                "4.) List all computers in classroom \t\n" +
                "5.) Update computer status by computer name \t\n" +
                "6.) List all computers ordered by fault \t\n" +
                "7.) GUI \t\n" +
                "8.) Quit \t\n";

            Menu(menu);

            Console.ReadLine();
        }
Ejemplo n.º 2
0
 static void updateStatusAndFaults(Computer pctoupdate)
 {
     Console.WriteLine("Enter computer status:");
     string status = Console.ReadLine();
     Console.WriteLine("Enter number of faults:");
     int numberOfFaults = Convert.ToInt32(Console.ReadLine());
     pctoupdate.Computerstatus = status;
     pctoupdate.Numberoffaults = numberOfFaults;
 }
Ejemplo n.º 3
0
 static Computer newComputer()
 {
     Console.WriteLine("Enter computer name:");
     string computer = Console.ReadLine();
     Console.WriteLine("Enter computer status:");
     string status = Console.ReadLine();
     Console.WriteLine("Enter number of faults:");
     int numberOfFaults = Convert.ToInt32(Console.ReadLine());
     Computer pc = new Computer(computer, status, numberOfFaults);
     return pc;
 }