static void Main(string[] args) { Console.WriteLine("Enter rental data"); Console.Write("Car model: "); string model = Console.ReadLine(); Console.Write("Pickup (dd/MM/yyyy hh/mm: "); DateTime start = DateTime.ParseExact(Console.ReadLine(), "dd/MM/yyyy HH:mm", CultureInfo.InvariantCulture); Console.Write("Return (dd/MM/yyyy hh/mm: "); DateTime finish = DateTime.ParseExact(Console.ReadLine(), "dd/MM/yyyy HH:mm", CultureInfo.InvariantCulture); Console.Write("Enter price per hour: "); double hour = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture); Console.Write("Enter price per day: "); double day = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture); CarRental carRental = new CarRental(start, finish, new Veiculo(model)); RentalServices rentalService = new RentalServices(hour, day, new BrazilTaxService()); rentalService.ProcessInvoice(carRental); Console.WriteLine("INVOICE: "); Console.WriteLine(carRental.Invoice); }
static void Main(string[] args) { Console.WriteLine("Enter rental data"); Console.Write("Car model: "); string model = Console.ReadLine(); Console.Write("Pickup (dd/MM/yyyy hh:mm): "); DateTime start = DateTime.ParseExact(Console.ReadLine(), "dd/MM/yyyy HH:mm", CultureInfo.InvariantCulture); Console.Write("Return (dd/MM/yyyy hh:mm): "); DateTime finish = DateTime.ParseExact(Console.ReadLine(), "dd/MM/yyyy HH:mm", CultureInfo.InvariantCulture); Console.Write("Enter price per hour: "); double pHour = double.Parse(Console.ReadLine(), CultureInfo.CurrentCulture); Console.Write("Enter price per day: "); double pDay = double.Parse(Console.ReadLine(), CultureInfo.CurrentCulture); CarRental carRental = new CarRental(start, finish, new Vehicle(model)); //Injection of dependency with BrazilTaxService and TaxService RentalServices rentalServices = new RentalServices(pHour, pDay, new BrazilTaxServices()); rentalServices.ProcessInvoice(carRental); Console.WriteLine(carRental.Invoice); }
static void Main(string[] args) { Console.WriteLine("Entre com os dados do aluguel: "); Console.Write("Modelo do carro: "); string model = Console.ReadLine(); Console.Write("Saida (dd/mm/yyyy: "); DateTime inicio = DateTime.ParseExact(Console.ReadLine(), "dd/MM/yyyy HH:mm", CultureInfo.InvariantCulture); Console.Write("Entrada (dd/mm/yyyy: "); DateTime fim = DateTime.ParseExact(Console.ReadLine(), "dd/MM/yyyy HH:mm", CultureInfo.InvariantCulture); AluguelCarro aluguel = new AluguelCarro(inicio, fim, new Veiculo(model)); Console.Write("Entre com preço por hora: "); double hora = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture); Console.WriteLine("Entre com o preço por dia: "); double dia = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture); AluguelCarro carRental = new AluguelCarro(inicio, fim, new Veiculo(model)); RentalServices rental = new RentalServices(hora, dia, new BrazilTax()); rental.ProcessInvoice(carRental); Console.WriteLine("Invoice:"); Console.WriteLine(carRental.Invoice); }
static void Main(string[] args) { Console.WriteLine("Entre com os dados do aluguel: "); Console.Write("Modelo do carro: "); string modelo = Console.ReadLine(); Console.Write("Data de retirada: "); DateTime retirada = DateTime.ParseExact(Console.ReadLine(), "dd/MM/yyyy HH:mm", CultureInfo.InvariantCulture); Console.Write("Data de devolução: "); DateTime devolucao = DateTime.ParseExact(Console.ReadLine(), "dd/MM/yyyy HH:mm", CultureInfo.InvariantCulture); Console.Write("Preço por hora: R$"); double valorPorHora = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture); Console.Write("Valor por dia: R$"); double valorPorDia = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture); CarRental cr = new CarRental(retirada, devolucao, new Vehicle(modelo)); RentalServices rs = new RentalServices(valorPorHora, valorPorDia, new BrasilTaxService()); rs.ProcessInvoice(cr); Console.WriteLine("INVOICE:"); Console.WriteLine(cr.Invoice); }
static void Main(string[] args) { Console.WriteLine("Enetre com o dados do aluguel"); Console.WriteLine("Car model: "); String model = Console.ReadLine(); Console.WriteLine("data de Retirada :"); DateTime DataRetirada = DateTime.ParseExact(Console.ReadLine(), "dd/MM/yyyy HH:mm", CultureInfo.InvariantCulture); Console.WriteLine("data de entrega :"); DateTime DataEntrega = DateTime.ParseExact(Console.ReadLine(), "dd/MM/yyyy HH:mm", CultureInfo.InvariantCulture); Console.WriteLine("preço por hora: "); double Phora = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture); Console.WriteLine("preço por dia: "); double Pday = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture); CarRental carRental = new CarRental(DataRetirada, DataEntrega, new veiculo(model)); RentalServices rentalService = new RentalServices(Phora, Pday, new BrasulTaxservices()); rentalService.ProcessInvoice(carRental); Console.WriteLine("Invoice:"); Console.WriteLine(carRental.Invoice); }