-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
47 lines (43 loc) · 1.62 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System;
using Curso.Entities;
using Curso.Entities.Exceptions;
namespace Curso
{
class Program
{
static void Main(string[] args)
{
try
{
Console.Write("Room number: ");
int number = int.Parse(Console.ReadLine());
Console.Write("Check-in date(dd/MM/yyyy): ");
DateTime checkIn = DateTime.Parse(Console.ReadLine());
Console.Write("Check-out date(dd/MM/yyyy): ");
DateTime checkOut = DateTime.Parse(Console.ReadLine());
Reservation reservation = new Reservation(number, checkIn, checkOut);
Console.WriteLine("Reservation: " + reservation);
Console.WriteLine();
Console.WriteLine("Enter data to update the reservation: ");
Console.Write("Check-in date(dd/MM/yyyy): ");
checkIn = DateTime.Parse(Console.ReadLine());
Console.Write("Check-out date(dd/MM/yyyy): ");
checkOut = DateTime.Parse(Console.ReadLine());
reservation.UpdateDates(checkIn, checkOut);
Console.WriteLine("Reservation: " + reservation);
}
catch (DomainException e)
{
Console.WriteLine("Error in Reservation: " + e.Message);
}
catch (FormatException e)
{
Console.WriteLine("Format error: " + e.Message);
}
catch (Exception e)
{
Console.WriteLine("Unexpected error :" + e.Message);
}
}
}
}