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