MIT Guru-lk

MIT Guru-lk

Thursday, May 24, 2012

Simple Car Rental program in C#

Posted by Mit Guru  |  at  2:08 AM 6 comments

mitguru-lk

This program show how to calculate Car Rental using type of car, Km and Number of rental days. Insert that details and click Process Button then calculate total rental and Click Clear Button Clear all details for new One. When you click Exit button exit this program.

C#.net Code for Simple Car Rental Program


Download Source Project


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CarRental
{
 public partial class Form1 : Form

 {
 public Form1()
 {
 InitializeComponent();
 }
 private void processButton_Click(object sender, EventArgs e)

 {
  decimal day, total,km;

  day = decimal.Parse(daytextBox.Text);

  km = decimal.Parse(kmtextBox.Text);

  total = 0;

  if (HondarButton.Checked)

  {
   total = (1500 + (20 * km)) - (80 * day);
  }
  else if (nissanrButton.Checked)
  {
  total = (2000 + (30 * km)) - (60 * day);
  }
  else if(civicrButton.Checked)
  {
  total = (2500 + (40 * km)) - (50 * day);
  }
  else
  {
  MessageBox.Show("Invalid Info");
  }
  totaltextBox.Text = total.ToString("c");
  }
 }

 private void clear()
 {
  daytextBox.Clear();

  kmtextBox.Clear();

  totaltextBox.Clear();

  HondarButton.Checked = true;

  daytextBox.Focus();
 }

 private void exitButton_Click(object sender, EventArgs e)
 {
  this.Close();
 }

 private void clearButton_Click(object sender, EventArgs e)
 {
  clear();
 }

 }

}

About the Author

Write admin description here..

Get Updates

Subscribe to our e-mail newsletter to receive updates.

Share This Post

Related posts

6 comments:

  1. Intriguing post. I Have Been pondering about this issue, so a debt of gratitude is in order for posting. Entirely cool post.It 's extremely exceptionally decent and Useful post.Thanks Elia And Ponto

    ReplyDelete
  2. I love this blog!! The flash up the top is awesome!! Newmarket Wedding Limo

    ReplyDelete
  3. This is a truly good site post. Not too many people would actually, the way you just did. I am really impressed that there is so much information about this subject that have been uncovered and you’ve done your best, with so much class. If wanted to know more about green smoke reviews, than by all means come in and check our stuff. auto car rental

    ReplyDelete
  4. Backseatcabs|Car rental in Darbhanga
    No:536Deuri Rd, Raham Khan, Donar, Darbhanga, Bihar 846004
    07061806038
    https://www.carrentalindarbhanga.in/

    https://g.page/carrentalindarbhanga?share


    car rental in darbhanga

    ReplyDelete

© 2013 MIT Tutorials. WP Theme-junkie converted by BloggerTheme9
back to top