Skip to content

Instantly share code, notes, and snippets.

@Retterath
Created September 23, 2018 13:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Retterath/31736c9aaa50467fda01cf6033a666f7 to your computer and use it in GitHub Desktop.
Save Retterath/31736c9aaa50467fda01cf6033a666f7 to your computer and use it in GitHub Desktop.
03. Vacation (Intro and Basic Syntax - Exercise)
using System;
namespace Vacation
{
class Program
{
static void Main()
{
double AmountOfPeople = double.Parse(Console.ReadLine());
string Group = Console.ReadLine();
string Day = Console.ReadLine();
if (Group == "Students")
{
double price = 0;
if (Day == "Friday")
{
price = 8.45;
}
else if (Day == "Saturday")
{
price = 9.80;
}
else if (Day == "Sunday")
{
price = 10.46;
}
if (AmountOfPeople >= 30)
{
double fee = price * 30;
double discount = fee * 0.15;
double finalPrice = fee - discount;
Console.WriteLine($"Total price: {finalPrice:F2}");
}
else
{
double PriceWithoutDiscount = price * AmountOfPeople;
Console.WriteLine($"Total price: {PriceWithoutDiscount:F2}");
}
}
else if (Group == "Business")
{
double price = 0;
if (Day == "Friday")
{
price = 10.90;
}
else if (Day == "Saturday")
{
price = 15.60;
}
else if (Day == "Sunday")
{
price = 16;
}
if (AmountOfPeople >= 100)
{
double fee = price * 90;
Console.WriteLine($"Total price: {fee:F2}");
}
else
{
double PriceWithoutDiscount = price * AmountOfPeople;
Console.WriteLine($"Total price: {PriceWithoutDiscount:F2}");
}
}
else if (Group == "Regular")
{
double price = 0;
if (Day == "Friday")
{
price = 15;
}
else if (Day == "Saturday")
{
price = 20;
}
else if (Day == "Sunday")
{
price = 22.50;
}
if (AmountOfPeople >= 10 && AmountOfPeople <= 20)
{
double fee = price * AmountOfPeople;
double discount = fee * 0.05;
double finalPrice = fee - discount;
Console.WriteLine($"Total price: {finalPrice:F2}");
}
else
{
double PriceWithoutDiscount = price * AmountOfPeople;
Console.WriteLine($"Total price: {PriceWithoutDiscount:F2}");
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment