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

Create a program in java for a car rental system. When the program starts it pro

ID: 3643251 • Letter: C

Question

Create a program in java for a car rental system.

When the program starts it prompts the user to do one of the following:

1. Create Account (First Name, Last Name, Username, password)
2. Make reservation (Assume user can only rent from 06/01/2012 - 06/31/2012)
3. Cancel reservation (Cancel an existing reservation)

The system should also keep a log of all transactions completed. To view this log, setup a default account/password of username - admin2 password - admin2. When user select option 3, cancel reservation and inputs username admin2 password admin2, the system should display the log of all transactions.

Remember that all account usernames must be unique and the system should display username already exist if exist. Also, if users select dates outside of 06/01/2012 - 06/31/2012 it should display select another date.






Explanation / Answer

Solution:

conditions:

//Create Account (First Name, Last Name, Username, password)
// Make reservation (Assume user can only rent from 06/01/2012 - 06/31/2012)
Cancel reservation (Cancel an existing reservation)

import java.util.*;

class Car {
private int deposit;
private int rate;

public Car(
int newDeposit, int newRate) {

deposit = newDeposit;
rate = newRate;
}

public int getDeposit() {
return deposit;
}

public int getRate() {
return rate;
}
}

public class TestProject {
public static void main(String args[]) {
List carlist = new ArrayList();
Scanner input = new Scanner(System.in);
for (Car s : carlist) {
System.out.print("Enter number of days: ");

if (days>=1 ^ days<=31)) {


int days = input.nextInt();
System.out.println("***************Details*****************");
int cost = (days * s.getRate()) + s.getDeposit();
System.out.println("Deposit DailyRate Duration TotalCost");
System.out.println(s.getDeposit() + " " + s.getRate()+ " " + days + " " + cost);
System.out.print("Proceed to rent?( y/n ): ");
String dec = input.next();
if (dec.equals("y")) {
System.out.println("Enter Customer Name: ");
String name = input.next();
System.out.println("Enter IC Number: ");
int num = input.nextInt();
System.out.println("************Receipt*************");
System.out.println("Name ICNo Car RegNo Duration TCost");
System.out.println(name + " " + num + " " + model
+ " " + s.getRegNo() + " " + days + " "+cost);
System.out.println("Serving Next Customer ");
} else if (dec.equals("n")) {
System.out.println("Serving Next Customer: ");
}
}
}
}
}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote