Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Threading;
- using System.IO;
- namespace Batham_Gate_Manor_Application_Unit_16_Assignment
- {
- class Program
- {
- static string name = "";
- static string address = "";
- static string telephone_number = "";
- static string check_in_date = "";
- static string accom_type = "";
- static string disabled = "";
- static string smoking = "";
- static int nights = 0;
- static string adults = "";
- static string children = "";
- static int room_Price = 0;
- static string username = "admin";
- static string password = "password";
- public static void dimensions()
- {
- Console.WindowHeight = 25;
- Console.WindowWidth = 165;
- }
- static void Main(string[] args)
- {
- Console.Title = "Batham Gate Manor Hotel Application Unit 16 Assignment";
- login();
- //TextWriter dan = new StreamWriter(@"U:\Batham_Gate_Manor_Reservations.txt", true);
- //TextReader nad = new StreamReader(@"U:\Batham_Gate_Manor_Reservations.txt", true);
- }
- static void login()
- {
- Console.WriteLine("Please enter Username: ");
- username = Console.ReadLine();
- Console.WriteLine("Please enter Password: ");
- password = Console.ReadLine();
- while (true)
- {
- try
- {
- if (username.Equals("admin") || password.Equals("password"))
- {
- first();
- }
- else
- {
- Console.WriteLine("Please enter valid username and password.");
- }
- }
- catch
- {
- Console.WriteLine("Please enter something valid!");
- }
- }
- }
- static void first()
- {
- Console.Clear();
- string Word = "<Batham Gate Manor Hotel>\n";
- int count = 0;
- for (int i = 0; i < Word.Length; i++)
- {
- if (count < 1)
- {
- Console.ForegroundColor = ConsoleColor.White;
- count++;
- }
- Console.Write(Word[i]);
- Thread.Sleep(50);
- }
- Console.WriteLine("Please choose one of the following options.");
- Console.WriteLine("1) Create reservation");
- Console.WriteLine("2) View existing reservations");
- ConsoleKeyInfo selection = Console.ReadKey();
- while (true)
- {
- try
- {
- if (selection.Key == ConsoleKey.D1)
- {
- create_Res_Name();
- }
- else if (selection.Key == ConsoleKey.D2)
- {
- view_Res();
- }
- }
- catch
- {
- Console.WriteLine("Please enter something valid!");
- }
- }
- }
- static void create_Res_Name()
- {
- Console.Clear();
- Console.WriteLine("Enter customer full name");
- name = Console.ReadLine();
- create_Res_Address();
- }
- static void create_Res_Address()
- {
- Console.Clear();
- Console.WriteLine("Enter customer address");
- address = Console.ReadLine();
- create_Res_Number();
- }
- static void create_Res_Number()
- {
- Console.Clear();
- Console.WriteLine("Enter customer telephone number");
- telephone_number = Console.ReadLine();
- create_Res_Date();
- }
- static void create_Res_Date()
- {
- Console.Clear();
- Console.WriteLine("Enter customer check in date");
- check_in_date = Console.ReadLine();
- create_Res_Disabled();
- }
- static void create_Res_Disabled()
- {
- Console.Clear();
- Console.WriteLine("Enter customer disability preferences");
- Console.WriteLine("Required or none");
- disabled = Console.ReadLine();
- create_Res_Smoker();
- }
- static void create_Res_Smoker()
- {
- Console.Clear();
- Console.WriteLine("Enter customer smoking preferences");
- Console.WriteLine("Smoker or none smoker");
- smoking = Console.ReadLine();
- create_Res_Nights();
- }
- static void create_Res_Nights()
- {
- Console.Clear();
- Console.WriteLine("Enter number of nights staying");
- nights = int.Parse(Console.ReadLine());
- create_Res_Adults();
- }
- static void create_Res_Adults()
- {
- Console.Clear();
- Console.WriteLine("Enter number of adults");
- adults = Console.ReadLine();
- create_Res_Children();
- }
- static void create_Res_Children()
- {
- Console.Clear();
- Console.WriteLine("Enter number of children");
- children = Console.ReadLine();
- create_Res_AccomType();
- textWrite();
- }
- static void create_Res_AccomType()
- {
- Console.Clear();
- Console.WriteLine("Enter customer accomadation type");
- Console.WriteLine("Please enter customer Accommodation Type.");
- Console.WriteLine("1) Cosy Double");
- Console.WriteLine("2) Double");
- Console.WriteLine("3) Twin");
- Console.WriteLine("4) Large Double");
- Console.WriteLine("5) Large Twin");
- Console.WriteLine("6) Family Room");
- int choice = 0;
- choice = int.Parse(Console.ReadLine());
- if (choice == 1)
- {
- accom_type = "cosy double";
- if (accom_type.Equals("cosy double") || adults.Equals("1"))
- {
- room_Price = 75 * nights;
- }
- else if (accom_type.Equals("cosy double") || adults.Equals("2"))
- {
- room_Price = 2 * 75 * nights;
- }
- }
- else if (choice == 2)
- {
- accom_type = "double";
- if (accom_type.Equals("double") || adults.Equals("1"))
- {
- room_Price = 110 * nights;
- }
- else if (accom_type.Equals("double") || adults.Equals("2"))
- {
- room_Price = 2 * 110 * nights;
- }
- }
- else if (choice == 3)
- {
- accom_type = "twin";
- if (accom_type.Equals("twin") || adults.Equals("1"))
- {
- room_Price = 110 * nights;
- }
- else if (accom_type.Equals("twin") || adults.Equals("2"))
- {
- room_Price = 2 * 110 * nights;
- }
- }
- else if (choice == 4)
- {
- accom_type = "large double";
- if (accom_type.Equals("large double") || adults.Equals("1"))
- {
- room_Price = 155 * nights;
- }
- else if (accom_type.Equals("large double") || adults.Equals("2"))
- {
- room_Price = 2 * 155 * nights;
- }
- }
- else if (choice == 5)
- {
- accom_type = "large twin";
- if (accom_type.Equals("large twin") || adults.Equals("1"))
- {
- room_Price = 155 * nights;
- }
- else if (accom_type.Equals("large twin") || adults.Equals("2"))
- {
- room_Price = 2 * 155 * nights;
- }
- else if (accom_type.Equals("large twin") || adults.Equals("1") || children.Equals("1"))
- {
- room_Price = 2 * 155 * nights;
- }
- else if (accom_type.Equals("large twin") || adults.Equals("2") || children.Equals("1"))
- {
- room_Price = 3 * 155 * nights;
- }
- }
- else if (choice == 6)
- {
- accom_type = "family room";
- if (accom_type.Equals("family foom") || adults.Equals("1"))
- {
- room_Price = 225 * nights;
- }
- else if (accom_type.Equals("family room") || adults.Equals("2"))
- {
- room_Price = 2 * 225 * nights;
- }
- else if (accom_type.Equals("family room") || adults.Equals("1") || children.Equals("1"))
- {
- room_Price = 2 * 225 * nights;
- }
- else if (accom_type.Equals("family room") || adults.Equals("2") || children.Equals("1"))
- {
- room_Price = 3 * 225 * nights;
- }
- }
- create_Res_Second();
- textWrite();
- }
- static void textWrite()
- {
- TextWriter dan = new StreamWriter("Batham_Gate_Manor_Reservations.txt");
- dan.WriteLine(name);
- dan.WriteLine(address);
- dan.WriteLine(telephone_number);
- dan.WriteLine(check_in_date);
- dan.WriteLine(accom_type);
- dan.WriteLine(disabled);
- dan.WriteLine(smoking);
- dan.WriteLine(nights);
- dan.WriteLine(adults);
- dan.WriteLine(children);
- dan.WriteLine(room_Price);
- dan.Close();
- }
- static void create_Res_Second()
- {
- Console.WriteLine("Would you like to make another reservation?");
- string choice = Console.ReadLine();
- choice.ToUpper();
- if (choice.Equals("yes"))
- {
- create_Res_Name();
- }
- else if (choice.Equals("no"))
- {
- first();
- }
- }
- static void view_Res()
- {
- Console.Clear();
- string line;
- TextReader nad = new StreamReader("Batham_Gate_Manor_Reservations.txt");
- while ((line = nad.ReadLine()) != null)
- {
- Console.WriteLine(line);
- //nad.Close();
- //Console.ReadLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement