27 lines
658 B
C#
Raw Permalink Normal View History

2021-09-14 12:31:36 +12:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Lab1
{
class CustomerParking : ParkingType
{
public override decimal Calculate(decimal hours)
{
hours = Math.Ceiling(hours);
if (hours < 0)
{
throw new ParkingException("Parked for no or negative hours");
}
else if (hours > 24)
{
throw new ParkingException("Vehicle was parked for too long");
}
decimal value = hours * ParkingRate;
return value;
}
}
}