static void Main(string[] args) { Statements s = new Statements(); while (true) { Console.WriteLine("This is our study model. Press escape to see our degrees, space to see courses, enter to add new application."); ConsoleKeyInfo key = Console.ReadKey(true); while ((key.Key != ConsoleKey.Escape) && (key.Key != ConsoleKey.Spacebar) && (key.Key != ConsoleKey.Enter)) { key = Console.ReadKey(true); } if (key.Key == ConsoleKey.Escape) { s.WriteDegrees(); Console.WriteLine("Press escape to return in menu, enter to add new degree."); key = Console.ReadKey(true); while (key.Key != ConsoleKey.Escape && key.Key != ConsoleKey.Enter) { key = Console.ReadKey(true); } if (key.Key == ConsoleKey.Enter) { s.AddNewDegree(); } } else if (key.Key == ConsoleKey.Spacebar) { s.WriteCources(); Console.WriteLine("Press escape to return in menu, enter to add new course."); key = Console.ReadKey(true); while (key.Key != ConsoleKey.Escape && key.Key != ConsoleKey.Enter) { key = Console.ReadKey(true); } if (key.Key == ConsoleKey.Enter) { s.AddNewCourse(); } } else { break; } Console.Clear(); } Application app = new Application(); app.CreateNewStatement(); app.WriteApplication(); Console.ReadKey(); }
public void ChooseCourses(Statements s1) { double sum; while (true) { Console.Clear(); Console.WriteLine("This is courses you chosed:"); WriteCources(); int k; sum = 0; for (int i = 0; i < chosencourses.Count; i++) { sum += chosencourses[i].Credits; } if (chosendegree.CreditsRequired <= sum) { sum = 0; for (int i = 0; i < chosencourses.Count; i++) { if (chosencourses[i].IsSpecial) { sum++; } } if (chosendegree.SpecialCoursesRequired <= sum) { Console.WriteLine("Your program is suitable."); Console.WriteLine("Press escape to delete course, space to add course, enter to continue."); ConsoleKeyInfo key = Console.ReadKey(); while (key.Key != ConsoleKey.Escape && key.Key != ConsoleKey.Spacebar && key.Key != ConsoleKey.Enter) { key = Console.ReadKey(); } if (key.Key == ConsoleKey.Escape) { WriteCources(); Console.WriteLine("Choose the one:"); k = Convert.ToInt32(Console.ReadLine()); chosencourses.RemoveAt(k - 1); } else if (key.Key == ConsoleKey.Spacebar) { Console.WriteLine("This is our courses. You can choose some of them."); Console.WriteLine("Code: Title: Is special: Lecture hours: Practise hours: \r\nHas exam: Has course paper: Credits: \r\nPrerequisities: "); s1.WriteCources(); k = Convert.ToInt32(Console.ReadLine()); chosencourses.Add(s1.GetCourse(k)); } else { break; } } else { Console.WriteLine("There is not enough special courses in your program."); Console.WriteLine("Press escape to delete course, space to add course."); ConsoleKeyInfo key = Console.ReadKey(); while (key.Key != ConsoleKey.Escape && key.Key != ConsoleKey.Spacebar) { key = Console.ReadKey(); } if (key.Key == ConsoleKey.Escape) { WriteCources(); Console.WriteLine("Choose the one:"); k = Convert.ToInt32(Console.ReadLine()); chosencourses.RemoveAt(k - 1); } else { Console.WriteLine("This is our courses. You can choose some of them."); Console.WriteLine("Code: Title: Is special: Lecture hours: Practise hours: \r\nHas exam: Has course paper: Credits: \r\nPrerequisities: "); s1.WriteCources(); k = Convert.ToInt32(Console.ReadLine()); chosencourses.Add(s1.GetCourse(k)); } } } else { Console.WriteLine("There is not enougn course credits in your program."); Console.WriteLine("Press escape to delete course, space to add course."); ConsoleKeyInfo key = Console.ReadKey(); while (key.Key != ConsoleKey.Escape && key.Key != ConsoleKey.Spacebar) { key = Console.ReadKey(); } if (key.Key == ConsoleKey.Escape) { WriteCources(); Console.WriteLine("Choose the one:"); k = Convert.ToInt32(Console.ReadLine()); chosencourses.RemoveAt(k - 1); } else { Console.WriteLine("This is our courses. You can choose some of them."); Console.WriteLine("Code: Title: Is special: Lecture hours: Practise hours: \r\nHas exam: Has course paper: Credits: \r\nPrerequisities: "); s1.WriteCources(); k = Convert.ToInt32(Console.ReadLine()); chosencourses.Add(s1.GetCourse(k)); } } } }