Car Rental System Summary

Source: Internet
Author: User
Tags car license plate number

Car rental system has a bit of function

function one (car rental):

Description: displays all available cars in the system, selects the car to be rented, and the output renter has rented out the car

Function two (also car):

Description: Select the car information in the car list, enter the rental days, calculate the rent

Function three (new car storage):

Description: need to enter the car license plate number, model, color, use time and daily rent, if the truck or to enter the truck load capacity

This car rental system should have three classes, there is a parent class (Vehicle), sub-class is (Truck) and (car)

The key code for the parent class is as follows:

The truck subclass code is as follows:

The car subclass code is as follows:

To initialize your car rental information:

Then bind the data to the ListView

The code is as follows:

private void Btncar_click (object sender, EventArgs e)
{
if (textname.text== "")
{
MessageBox.Show ("Please enter the name of the lessor");
Return
}

if (ListView1.SelectedItems.Count > 0)
{
String number = Listview1.selecteditems[0]. Text;
Vehicle ve = Vehicles[number];
Rentvehicles.remove (number);
Myrefresh (Rentvehicles, listView1);
Rentvehicles.add (number, ve);
MessageBox.Show ("Car Rental success! ");
}
}

Also car information:

The code is as follows:

private void Btnmoney_click (object sender, EventArgs e)
{
if (textday.text== "")
{
MessageBox.Show ("Please enter your rental time");
Return
}
String number = Listview2.selecteditems[0]. Text;
Vehicle ve = Vehicles[number];
Vehicles. Remove (number);
Myrefresh (vehicles, listView2);
Vehicles. ADD (number, ve);
Ve. Rentdate = Convert.ToInt32 (Textday.text);
Double money = ve. Dailyrent;
MessageBox.Show ("Your need to spend" + Money + "Yuan");

}

New Car Storage module:

The code is as follows:

private void Radiobutton1_checkedchanged (object sender, EventArgs e)
{
this.textDun.Enabled = false;

}

private void Radiobutton2_checkedchanged (object sender, EventArgs e)
{
This.textDun.Enabled = true;
}

Car Rental System Summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.