Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a Windows Form Application project. Create a Form for a car rental compan

ID: 3790168 • Letter: C

Question

Create a Windows Form Application project.

Create a Form for a car rental company and set the form text property to Car Rental and the form backcolor to GradientInactiveCaption.
Allow the user to select from a list of car styles: Compact, Standard, or Luxury.
Use a calendar that defaults to the current day and allows the user to select a future date when the car will be returned.
Add a Selection Complete button.
After these two selections are made, the user will click the Selection Complete button that will compute the total price of rental.
The number of days that the customer will have the car will be determined by the difference between the current date and the future date selected on the calendar.
The total price will be the number of computed rental days times the cost for the model of car selected ($19.95/day for Compact, $24.95/day for Standard and $39/day for Luxury).
Display the Number of Rental Days: and Total Price is: values on the form in two separate non-updateable controls.
Add an Exit button that will close the application.
Each button will have a Light Cyan backcolor property.
Internal documentation.

I need it to use monthly calendar and daytimepicker.

this is what i have figured out this method is only using the date picked i need it to range more then 30 day like if a customer wanted to rent the car for 3 months. that compile i have problems with.

public partial class Form1 : Form
{

//intialize the array declaration for car and carprices
string[] cars = { "Compact", "Standard", "Luxury" };
double[] carprices = { 19.95, 24.95, 39.0 };

private void Form1_Load(object sender, EventArgs e)
{
  
CarStyles.Items.AddRange(cars);
}

public Form1()
{
InitializeComponent();
}

private void completeBtn_Click(object sender, EventArgs e)
{
  
int selectedCar = CarStyles.SelectedIndex;
double rate = 0;
if (selectedCar == -1)
{
MessageBox.Show("Please select a valid car style");
return;
}
else
rate = carprices[selectedCar];

  
DateTime dt = DateTime.Now;
int startDay = dt.Day;
int lastDay = dateTimePicker.Value.Day;


int rentedDays = lastDay - startDay;

daystextBox.Text = rentedDays.ToString();
totaltextBox.Text = (rentedDays * rate).ToString("c");
}

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

Explanation / Answer

In your program, to range it to more 30 days you have to change your array initialization part and you have to add a calender to pick a date. I have written following code using JXDatePicker.

This will create a callender pannel, where user can pick the date