Thursday, September 19, 2024 9:19:11 PM
> settings

Customize


Authenticate

> Util.cs
/*
 * Bryan
 * Parking Ticket Quackulator
 */

using System;
using System.Windows.Forms;

namespace bryan_parkingTickets
{
    public partial class Main_Form : Form
    {
        private float CaclulateTotalPrice()
        {
            float totalPrice = 0f;

            switch (cb_Violator.SelectedIndex)
            {
                // Visitors
                case 1:
                    totalPrice = 35f;
                    break;

                // Students
                case 2:
                    // Just the "normal" student
                    totalPrice = VIOLATION_PRICE + (STUD_SPEEDING_FEE * ((float)Math.Floor((currentSpeed - MIN_SPEED) / 5f)));

                    // The student is a senior
                    if (chk_IsSenior.Checked)
                    {
                        // If they are speeding more than 20 over, charge them speeding, else regular fee
                        totalPrice += ((currentSpeed - MIN_SPEED) > 20) ? SENIOR_SPEEDING_FEE : SENIOR_FEE;
                    }

                    break;
                // Facility/Staff
                case 3:
                    totalPrice = VIOLATION_PRICE + (FAC_SPEEDING_FEE * ((float)Math.Floor((currentSpeed - MIN_SPEED) / 5f)));
                    break;
            }

            // Add 40 if it's nighttime
            if (chk_IsEvening.Checked)
            {
                totalPrice += EVENING_FEE;
            }

            return totalPrice;
        }

        /// <summary>
        /// Updates the daily counter with some information
        /// </summary>
        private void UpdateDailyCounter()
        {
            tb_TodayStats.Text = $"Today's Tickets:{Environment.NewLine}Total Tickets: {totalDailyTickets}{Environment.NewLine}Total Price: {totalDailyFees:c}";
        }
    }
}
All opinions represented herein are my own
- © 2024 itsthedevman
- build 3c15a1b