-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.cpp
82 lines (78 loc) · 1.82 KB
/
models.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include <string>
#include <iostream>
using namespace std;
class User
{
public:
bool isAuthorised = false;
int id;
string record;
string username;
string password;
string role;
int fine;
User(string username, string password, string role)
{
this->username = username;
this->password = password;
this->role = role;
}
void setId(int id)
{
this->id = id;
}
void authorise()
{
isAuthorised = true;
}
void setFine(int i){
this->fine = i;
}
void setRecord(string rec){
this->record = rec;
}
};
class Car
{
public:
string model;
int id;
string health;
string availability;
int price;
string due_date;
Car(string model, string health, int price)
{
this->model = model;
this->health = health;
this->price = price;
}
void setId(int id)
{
this->id = id;
}
void setDate(string due_date)
{
this->due_date = due_date;
}
void setAvailability(string availability)
{
this->availability = availability;
}
};
void PrintCarDetails(Car currCarr)
{
cout << "Car ID: " << currCarr.id << endl;
cout << "Model: " << currCarr.model << endl;
cout << "Health: " << currCarr.health << endl;
cout << "Availability: " << (currCarr.availability == "admin" ? "Available For Renting" : currCarr.availability) << endl;
cout << "Price: " << currCarr.price << endl;
cout << "Due Date: " << (currCarr.due_date == "" ? "Not Rented" : currCarr.due_date) << endl;
}
void PrintUsers(User currUser){
cout<<"User ID: "<<currUser.id<<endl;
cout<<"Username: "<<currUser.username<<endl;
cout<<"Record: "<<currUser.record<<endl;
cout<<"Role: "<<currUser.role<<endl;
cout<<"Fine: "<<currUser.fine<<endl;
}