In: Computer Science
Design and code a detailed Car Rental Transaction Structure. Ideally, the design work is about %90 of the task, with about 10% effort in coding. The code needs to be compile-able, but does not need to execute. A main() method with no code is appropriate.
Think about what a car rental transaction requires. At minimum, you need the following items below. You are free to add more if it makes sense to you.
A renter. A vehicle to rent. A pickup location
A drop off location A booking start data and time
A reservation start date and time
A planned return date and time.
An actual return date and time.
Alternate Driver list
Payment
Your grade will be based on how detailed the design is. There are opportunities for structures within structures within structures, etc, etc. Add as many variables to a structure as you believe it needs. Your design should avoid redundancy.
The deliverable is the CPP program and a design flow chart. The design flow chart does not need to be fancy, just showing what structures connects to. Ideally, a data structure diagram would be appropriate but I just want to see some thought into where the structures are placed. A picture of a hand-written design is allowed.
Sample Design Link: https://drive.google.com/file/d/1BQ9_kX0c0h_FpsCk1pmSJyN8vUdwr5vQ/view?usp=sharing
Your design does not need as verbose as the sample, but think about any entities that are logically related ( I.E - Components of a name, components of an address) and reusability.
Expanding Items for creating structers: A renter - renter name - renter address A vehicle to rent -vechicle name - vechicle id - vechicle licence A pickup location
- pickup location address
A drop off location - dropp off location address A booking start data and time
- start date
- time
A reservation start date and time
- start date
- time
A planned return date and time
- date
- time
An actual return date and time
- date
- time
Alternate Driver list
- driver name
- total drivers
- driver id
- driver licence
Payment
- rent amount
- due date
- fine amount
- return amount
- balance
Adding more structers that requried for the above declarations:
Licence
- licence id
- issue date
- expiry date
address
- house number
- street name
- place
- pin code
date
- day
- year
- month
time
-hours
-minutes
-seconds
Compile-able CPP code:
#include <stdio.h>
struct date
{
int day;
int month;
int year;
};
struct time_slot
{
int hours;
int mintues;
int seconds;
};
struct address
{
int house_number;
char street_name[60];
char city[50];
int pin;
};
struct licence
{
int licence_id;
struct date issue_date;
struct date expiry_date;
};
struct renter
{
char renter_name[50];
struct address renter_address;
};
struct vechicle_to_rent
{
char vechicle_name[40];
int vechicle_id;
struct licence vechicle_licence;
};
struct alternate_driver_list
{
char driver_name[40];
int total_drivers;
int driver_id;
struct licence driver_licence;
};
struct payment
{
int rent_amount;
struct date due_date;
int fine_amount;
int return_amount;
int balance;
};
struct CarRentalTransaction
{
struct renter car_renter;
struct vechicle_to_rent vechicle;
struct address picup_location;
struct address drop_off_location;
struct date booking_date;
struct time_slot booking_time;
struct date reserved_date;
struct time_slot reserved_time;
struct date planned_date;
struct time_slot planned_time;
struct date actual_date;
struct time_slot actual_time;
struct alternate_driver_list driver;
struct payment transaction;
}car_renting;
int main()
{
return 0;
}
Design flow chart: