コード例 #1
0
ファイル: Program.cs プロジェクト: Brettfodor/MasteryProject
        static void Main(string[] args)
        {
            Employee     employee     = new Employee("Don", "0005");
            Doctor       Doctor       = new Doctor("Don", "0001", "Gastroenterology");
            Nurse        Nurse        = new Nurse("Kathy", "0002", 1);
            Receptionist Receptionist = new Receptionist("Yolanda", "0003", false);
            Janitor      Janitor      = new Janitor("Dingus", "0004", false);
            Hospital     hospital     = new Hospital();
            Patient      patient      = new Patient();

            bool usingApp = true;

            while (usingApp)
            {
                employee = new Employee();
                Console.WriteLine("Hello!  What would you like to do?");
                Console.WriteLine("Type '1' to print out a list of employees");
                Console.WriteLine("Type '2' to pay all employees");
                Console.WriteLine("Type '3' to have a Doctor or Nurse draw blood or care for a patient");
                Console.WriteLine("Type '4' to create a new employee profile");
                string userInput = Console.ReadLine();
                switch (userInput)
                {
                case "1":
                    hospital.AllCheckInfo();
                    break;


                case "2":
                    hospital.AllPaySalary();
                    break;


                case "3":
                    Console.Clear();
                    Console.WriteLine("Type '1' to assign a Doctor to draw blood from a patient");
                    Console.WriteLine("Type '2' to assign a Nurse to draw blood from a patient");
                    Console.WriteLine("type '3' to assign a Doctor to care for a patient");
                    Console.WriteLine("Type '4' to assign a Nurse to care for a patient");

                    int userChoice = Convert.ToInt32(Console.ReadLine());

                    if (userChoice == 1)
                    {
                        Doctor.CheckPatientBloodLevel(patient);
                        Console.WriteLine($" A doctor drew blood and the patient's blood level is now {patient.BloodLevel}");
                        Console.WriteLine("Press 'Enter' to continue");
                        Console.ReadLine();
                        Console.Clear();
                    }
                    else if (userChoice == 2)
                    {
                        Nurse.CheckPatientBloodLevel(patient);
                        Console.WriteLine($"A nurse drew blood, and The patient's blood level is now {patient.BloodLevel}");
                        Console.WriteLine("Press 'Enter' to continue");
                        Console.ReadLine();
                        Console.Clear();
                    }
                    else if (userChoice == 3)
                    {
                        Doctor.CareForPatient(patient);
                        Console.WriteLine($"A doctor assisted the patient. The patient's health level is now {patient.HealthLevel}");
                        Console.WriteLine("Press 'Enter' to continue");
                        Console.ReadLine();
                        Console.Clear();
                    }
                    else if (userChoice == 4)
                    {
                        Nurse.CareForPatient(patient);
                        Console.WriteLine($"A nurse assisted the patient, and the patient's health level is now {patient.HealthLevel}");
                        Console.WriteLine("Press 'Enter' to continue");
                        Console.ReadLine();
                        Console.Clear();
                    }
                    break;

                case "4":
                    hospital.EmployeeCreation();
                    break;
                }

                Console.Clear();
            }
        }
コード例 #2
0
        public void EmployeeCreation()
        {
            Console.Clear();
            // Get employee type from user
            Console.WriteLine("What type of Employee? (type 'd' doctor, 'n' for nurse, 'r' for receptionist, or 'j' for Janitor)");
            string type = Console.ReadLine();

            //Get name from user
            Console.WriteLine("What is the name of the Employee?");

            string name = Console.ReadLine();

            Console.Clear();
            // Get emp ID from user

            Console.WriteLine("What is the Employee's Employee Identification Number?");

            string employeeNumber = Console.ReadLine();

            Console.Clear();
            // Create employee

            Employee newEmployee;

            if (type == "d")
            {
                Console.WriteLine("What is the doctor's Specialty?");
                string specialty = Console.ReadLine();
                newEmployee = new Doctor(name, employeeNumber, specialty);
                employeesInHospital.Add(newEmployee);
                Console.WriteLine("Press 'Enter' to continue");
                Console.ReadLine();
                Console.Clear();
            }
            else if (type == "n")
            {
                Console.WriteLine("How many patients does the Nurse Have?");
                int numberOfPatients = Convert.ToInt32(Console.ReadLine());
                newEmployee = new Nurse(name, employeeNumber, numberOfPatients);
                employeesInHospital.Add(newEmployee);
                Console.WriteLine("Press 'Enter' to continue");
                Console.ReadLine();
                Console.Clear();
            }
            else if (type == "r")
            {
                Console.WriteLine("How many patients does the Nurse Have?");
                bool onThePhone = false;
                newEmployee = new Receptionist(name, employeeNumber, onThePhone);
                employeesInHospital.Add(newEmployee);
                Console.WriteLine("Press 'Enter' to continue");
                Console.ReadLine();
                Console.Clear();
            }
            else if (type == "j")
            {
                Console.WriteLine("How many patients does the Nurse Have?");
                bool isSweeping = false;
                newEmployee = new Janitor(name, employeeNumber, isSweeping);
                employeesInHospital.Add(newEmployee);
                Console.WriteLine("Press 'Enter' to continue");
                Console.ReadLine();
                Console.Clear();
            }



            Console.WriteLine(name + " has been added to the Hospital Database");
            Console.WriteLine("Press 'Enter' to continue");
            Console.ReadLine();
            Console.Clear();
        }
コード例 #3
0
        static void Main(string[] args)
        {
            Hospital     hospital     = new Hospital();
            Employee     employee     = new Employee();
            Doctor       doctor       = new Doctor();
            Nurse        nurse        = new Nurse();
            Receptionist receptionist = new Receptionist();
            Janitor      janitor      = new Janitor();
            Patient      patient      = new Patient();

            hospital.AddEmployees();
            hospital.AddPatients();
            hospital.MainMenu();

            bool inHospitalMenu = true;

            while (inHospitalMenu)
            {
                string userInput = Console.ReadLine().ToLower();


                switch (userInput)
                {
                case "a":
                    Console.Clear();
                    Console.WriteLine("The hospital employees are:");
                    Console.WriteLine();     //<-- Here to add some space btwn heading and list
                    hospital.ShowAllEmployees();
                    hospital.TasksOnEmployees();
                    break;

                case "r":
                    receptionist.CheckPhoneStatus();
                    break;

                case "j":
                    janitor.CheckSweepingStatus();
                    break;

                case "p":
                    employee.PayEmployee();
                    break;

                case "m":
                    Console.Clear();
                    hospital.MainMenu();
                    break;


                case "b":
                    Console.Clear();
                    Console.WriteLine("The hospital patients are:");
                    Console.WriteLine();     //<-- Here to add some space btwn heading and list
                    hospital.ShowAllPatients();
                    hospital.TasksOnPatients();
                    break;

                case "db":
                    Console.Clear();
                    hospital.ShowAllPatients();
                    hospital.DoctorDrawBloodforIndividualPatient();
                    Console.WriteLine("Your patients' new stats are:");
                    hospital.ShowAllPatients();
                    patient.ReturnToPatientList();
                    break;


                case "dc":
                    Console.Clear();
                    hospital.ShowAllPatients();
                    hospital.DoctorCareforIndividualPatient();
                    Console.WriteLine("Your patients' new stats are:");
                    hospital.ShowAllPatients();
                    patient.ReturnToPatientList();
                    break;

                case "nb":
                    Console.Clear();
                    hospital.ShowAllPatients();
                    hospital.NurseDrawBloodforIndividualPatient();
                    Console.WriteLine("Your patients' new stats are:");
                    hospital.ShowAllPatients();
                    patient.ReturnToPatientList();
                    break;


                case "nc":
                    Console.Clear();
                    hospital.ShowAllPatients();
                    hospital.NurseCareforIndividualPatient();
                    Console.WriteLine("Your patients' new stats are:");
                    hospital.ShowAllPatients();
                    patient.ReturnToPatientList();
                    break;


                case "c":
                    inHospitalMenu = false;
                    Console.WriteLine("GoodBye! Thanks for Visiting!");
                    break;

                default:
                    Console.WriteLine("Invalid Entry. Please Try Again!");
                    break;
                }
            }
        }