Esempio n. 1
0
        public decimal RollingStopMod(Risk risk)
        {
            decimal rollingStopMod = 1m;

            switch (risk.RollingStopsPerMonth)
            {
            case 0:
                rollingStopMod = 0.95m;
                return(rollingStopMod);

            case 1:
                rollingStopMod += 0.05m;
                return(rollingStopMod);

            case 2:
                rollingStopMod += 0.1m;
                return(rollingStopMod);

            case 3:
                rollingStopMod += 0.15m;
                return(rollingStopMod);

            case 4:
                rollingStopMod += 0.2m;
                return(rollingStopMod);

            default:
                rollingStopMod += 0.25m;
                return(rollingStopMod);
            }
        }
Esempio n. 2
0
        public decimal TailgatingMod(Risk risk)
        {
            decimal tailgateMod = 1m;

            switch (risk.TailgatesPerMonth)
            {
            case 0:
                tailgateMod = 0.95m;
                return(tailgateMod);

            case 1:
                tailgateMod += 0.05m;
                return(tailgateMod);

            case 2:
                tailgateMod += 0.1m;
                return(tailgateMod);

            case 3:
                tailgateMod += 0.15m;
                return(tailgateMod);

            case 4:
                tailgateMod += 0.2m;
                return(tailgateMod);

            default:
                tailgateMod += 0.25m;
                return(tailgateMod);
            }
        }
Esempio n. 3
0
        public decimal SwervingMod(Risk risk)
        {
            decimal swerveMod = 1m;

            switch (risk.SwervesPerMonth)
            {
            case 0:
                swerveMod = 0.95m;
                return(swerveMod);

            case 1:
                swerveMod += 0.05m;
                return(swerveMod);

            case 2:
                swerveMod += 0.1m;
                return(swerveMod);

            case 3:
                swerveMod += 0.15m;
                return(swerveMod);

            case 4:
                swerveMod += 0.2m;
                return(swerveMod);

            default:
                swerveMod += 0.25m;
                return(swerveMod);
            }
        }
Esempio n. 4
0
        public decimal SpeedingMod(Risk risk)
        {
            decimal speedMod = 1m;

            switch (risk.SpeedingInfractionsPerYear)
            {
            case 0:
                speedMod = 0.95m;
                return(speedMod);

            case 1:
                speedMod += 0.05m;
                return(speedMod);

            case 2:
                speedMod += 0.1m;
                return(speedMod);

            case 3:
                speedMod += 0.15m;
                return(speedMod);

            case 4:
                speedMod += 0.2m;
                return(speedMod);

            default:
                speedMod += 0.25m;
                return(speedMod);
            }
        }
Esempio n. 5
0
        public void AddRisk()
        {
            Risk Risk = new Risk();

            Console.WriteLine("How many speeding violations have they had this year?");
            Risk.SpeedingInfractionsPerYear = int.Parse(Console.ReadLine());
            Console.WriteLine("How many times per month do they swerve outside the lines?");
            Risk.SwervesPerMonth = int.Parse(Console.ReadLine());
            Console.WriteLine("How many rolling stops do they perform per month?");
            Risk.RollingStopsPerMonth = int.Parse(Console.ReadLine());
            Console.WriteLine("How often do they tailgate per month?");
            Risk.TailgatesPerMonth = int.Parse(Console.ReadLine());

            decimal speedMod       = _repo.SpeedingMod(Risk);
            decimal swerveMod      = _repo.SwervingMod(Risk);
            decimal rollingStopMod = _repo.RollingStopMod(Risk);
            decimal tailgaitingMod = _repo.TailgatingMod(Risk);

            decimal totalCost = _repo.InsurancePremium(speedMod, swerveMod, tailgaitingMod, rollingStopMod);

            Console.WriteLine("Your insurance premium will be $" + Decimal.Round(totalCost, 2) + " per month.");
            Console.ReadKey();
        }