Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 5

var HourStart = int.Parse(Console.

ReadLine());
var MinuteStart = int.Parse(Console.ReadLine());
var HourArrival = int.Parse(Console.ReadLine());
var MinuteArrival = int.Parse(Console.ReadLine());
string late = "Late";
string ontime = "On time";
string early = "Early";
int Start = HourStart * 60 + MinuteStart;
int Arrival = HourArrival * 60 + MinuteArrival;
int Difference = Arrival - Start;
int DifferenceHours = Math.Abs(Difference / 60);
int DifferenceMinutes = Math.Abs(Difference % 60);

string Student = late;


if (Difference < -30)
{
Student = early;
}
else if (Difference <= 30)
{
Student = ontime;
}
string Result = string.Empty;
if (Difference != 0)
{
if (DifferenceHours > 0)
{
Result = string.Format("{0}:{1:00} hours", DifferenceHours,
DifferenceMinutes);
}
else
{
Result = ($"{DifferenceMinutes} minutes");
}
if (DifferenceMinutes < 0)
{
Result += " before the start";
}
else
{
Result += " after the start";
}
}
Console.WriteLine(Student);
if (!string.IsNullOrEmpty(Result))
{
Console.WriteLine(Result);
}

decimal Budget = decimal.Parse(Console.ReadLine());


string Season = Console.ReadLine();
string Location = string.Empty;
string Residence = string.Empty;
decimal Expense = 0.00M;
if (Budget <= 100.00M)
{
Location = "Somewhere in Bulgaria";
if (Season.Equals("summer"))
{
Expense = 0.30M * Budget;
Residence = string.Format("Camp - {0:F2}", Expense);
}
else
{
Expense = 0.70M * Budget;
Residence = string.Format("Hotel - {0:F2}", Expense);
}

}
else if (Budget <= 1000)
{
Location = "Somewhere in the Balkans";
if (Season.Equals("summer"))
{
Expense = 0.40M * Budget;
Residence = string.Format("Camp - {0:F2}", Expense);
}
else
{
Expense = 0.80M * Budget;
Residence = string.Format("Hotel - {0:F2}", Expense);
}
}
else if (Budget > 1000)
{
Location = "Somewhere in Europe";
Expense = 0.90M * Budget;
Residence = string.Format("Hotel - {0:F2}", Expense);
}
Console.WriteLine(Location);
Console.WriteLine(Residence);

int Number1 = int.Parse(Console.ReadLine());


int Number2 = int.Parse(Console.ReadLine());
string Operator = Console.ReadLine();
string Output = string.Empty;
decimal Result = 0.00M;
if (Number2 == 0 && Operator.Equals("/") || Operator.Equals("%"))
{
Output = string.Format($"Cannot divide {Number1} by zero");
}
else if (Operator.Equals("/"))
{
Result = Number1 / Number2;
Output = string.Format("{0} {1} {2} = {3:F2}", Number1, Operator, Number2,
Result);
}
else if (Operator.Equals("%"))
{
Result = Number1 % Number2;
Output = string.Format("{0} {1} {2} = {3}", Number1, Operator, Number2,
Result);
}
else
{
if (Operator.Equals("*"))
{
Result = Number1 * Number2;
}
if (Operator.Equals("-"))
{
Result = Number1 - Number2;
}
if (Operator.Equals("+"))
{
Result = Number1 + Number2;
}
Output = string.Format("{0} {1} {2} = {3} - {4}", Number1, Operator, Number2,
Result, Result % 2 == 0 ? "even" : "odd");
}
Console.WriteLine(Output);

decimal Budget = decimal.Parse(Console.ReadLine());


string Type = Console.ReadLine();
int People = int.Parse(Console.ReadLine());
string Result = String.Empty;
decimal MoneyForTickets = 0.00M;
decimal MoneyLeft = 0.00M;
if (People <= 4)
{
MoneyLeft = 0.25M * Budget;
}
else if (People <= 9)
{
MoneyLeft = 0.40M * Budget;
}
else if (People <= 24)
{
MoneyLeft = 0.50M * Budget;
}
else if (People <= 49)
{
MoneyLeft = 0.60M * Budget;
}
else if (People >= 50)
{
MoneyLeft = 0.75M * Budget;
}
if (Type.Equals("Normal"))
{
MoneyForTickets = People * 249.99M;
}
else if (Type.Equals("VIP"))
{
MoneyForTickets = People * 499.99M;
}
decimal MoneyDifference = MoneyLeft - MoneyForTickets;
if (MoneyForTickets < MoneyLeft)
{
Result = string.Format("Yes! You have {0:F2} leva left.",
Math.Round(MoneyDifference, 2));
}
else if (MoneyForTickets > MoneyLeft)
{
Result = string.Format("Not enough money! You need {0:F2} leva.",
Math.Abs(Math.Round(MoneyDifference, 2)));
}
Console.WriteLine(Result);

string Month = Console.ReadLine();


int Nights = int.Parse(Console.ReadLine());
decimal StudioPrice = 0.00M;
decimal ApartmentPrice = 0.00M;
decimal StudioAllNights = 0.00M;
decimal ApartmentAllNights = 0.00M;
if (Month == "May" || Month == "October")
{
StudioPrice = 50.00M;
ApartmentPrice = 65.00M;
if (Nights > 14)
{
StudioAllNights = StudioPrice * Nights * 0.70M;
}
else if (Nights > 7)
{
StudioAllNights = StudioPrice * Nights * 0.95M;
}
else
{
StudioAllNights = StudioPrice * Nights;
}
if (Nights > 14)
{
ApartmentAllNights = ApartmentPrice * Nights * 0.90M;
}
else
{
ApartmentAllNights = ApartmentPrice * Nights;
}
}

else if (Month == "June" || Month == "September")


{
StudioPrice = 75.20M;
ApartmentPrice = 68.70M;
if (Nights > 14)
{
StudioAllNights = StudioPrice * Nights * 0.80M;
}
else
{
StudioAllNights = StudioPrice * Nights;
}
if (Nights > 14)
{
ApartmentAllNights = ApartmentPrice * Nights * 0.90M;
}
else
{
ApartmentAllNights = ApartmentPrice * Nights;
}
}
else if (Month == "July" || Month == "August")
{
StudioPrice = 76.00M;
ApartmentPrice = 77.00M;
StudioAllNights = StudioPrice * Nights;
if (Nights > 14)
{
ApartmentAllNights = ApartmentPrice * Nights * 0.90M;
}
else
{
ApartmentAllNights = ApartmentPrice * Nights;
}
}
Console.WriteLine("Apartment: {0:F2} lv. " +
"Studio: {1:F2} lv.", ApartmentAllNights, StudioAllNights);

You might also like