Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Text.RegularExpressions;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace StudioRentingSystem
- {
- public partial class Renting_System : Form
- {
- public Renting_System()
- {
- InitializeComponent();
- }
- private void btnCalculate_Click(object sender, EventArgs e)
- {
- //Variables
- double totalCustomerOwe = 0;
- double noMinUsed = 0;
- double charged = 0;
- const int RATE_PER_HOUR = 350;
- //Covert string to number
- noMinUsed = Convert.ToInt32(noMinUsedField.Text);
- //Calculation
- charged = RATE_PER_HOUR / 60;
- double minRate = Math.Round(charged);
- totalCustomerOwe = minRate * noMinUsed;
- //Result Display
- //Side Summary display
- lblStudioNameResult.Text = studioNameField.Text;
- lblStudioNameResult.Text = studioNameField.Text;
- lblFixRatePerHour.Text = lblFixRatePerHour.Text + RATE_PER_HOUR.ToString("N2");
- lblRatePerMinutes.Text = lblRatePerMinutes.Text + minRate.ToString("N2");
- //Total Summary Display
- lblStudioName.Text = lblStudioName.Text + studioNameField.Text;
- lblNoMinUsed.Text = lblNoMinUsed.Text + noMinUsed.ToString();
- lblRatePerHour.Text = lblRatePerHour.Text + "PHP " + RATE_PER_HOUR.ToString("N2");
- lblRatePerMin.Text = lblRatePerMin.Text + "PHP " + minRate.ToString("N2");
- lblTotalCustomerOwe.Text = lblTotalCustomerOwe.Text + "PHP " + totalCustomerOwe.ToString("N2");
- }
- private void btnClear_Click(object sender, EventArgs e)
- {
- studioNameField.Text = "";
- noMinUsedField.Text = "";
- lblStudioName.Text = "STUDIO NAME: ";
- lblNoMinUsed.Text = "NO. MINUTES USED: ";
- lblRatePerHour.Text = "RATE PER HOUR: ";
- lblRatePerMin.Text = "RATE PER MIN: ";
- lblTotalCustomerOwe.Text = "TOTAL CUSTOMER OWE: ";
- lblStudioNameResult.Text = "STUDIO NAME";
- lblFixRatePerHour.Text = "FIXED RATE/HOUR: ";
- lblRatePerMinutes.Text = "RATE/MIN: ";
- }
- private void btnExit_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- private void noMinUsedField_KeyPress(object sender, KeyPressEventArgs e)
- {
- // allows only numbers
- if (!char.IsNumber(e.KeyChar) & (Keys)e.KeyChar != Keys.Back & e.KeyChar != '.')
- {
- e.Handled = true;
- MessageBox.Show("Input should not be letters/characters!");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement