-
Notifications
You must be signed in to change notification settings - Fork 0
/
busType.h
88 lines (73 loc) · 3.39 KB
/
busType.h
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
83
84
85
86
87
//#pragma once
class busType
{
public:
void setBusID(int busNum);
//Function to set the bus' ID number
//The busIDNumber is set according to the parameter
//PostCondition: busIDNumber = busNum;
// The function checks whether the value of busNum is valid,
// the default value of 0 is assigned
void setNumOfSeats(int seatNum);
//Function to set the number of seats on the bus
//The numberOfSeats is set according to the parameter
//PostCondition: numberOfSeats = seatNum;
// The function checks whether the value of seatNum is valid,
// the default value of 0 is assigned
void setDriverID(int driverNumber);
//Function to set the bus driver's ID number
//Parameters passed: The nameOfDriver is set according to the parameter
//PostCondition: driverNumber = driverID;
// The function checks whether the value of driverIDNum is valid,
// the default value of 0 is assigned
int getBusID() const;
//Function: to return the bus ID number
//Parameters passed: none
//PostCondition: The value of busIDNumber is returned
//
int getNumOfSeats() const;
//Function: to return the number of seats for the bus
//Parameters passed: none
//PostCondition: The value of numberOfSeats is returned
//
int getDriverID() const;
//Function: to return the bus driver's ID number
//Parameters passed: none
//PostCondition: The value of driverID is returned
//
int getCurrentSpeed() const;
//Function: to return the current speed of the bus
//Parameters passed: none
//PostCondition: The value of busSpeed is returned
//
void Accelerate();
//Function: To increase the speed of the bus by 5(mph) - not to exceed 50 mph
//Parameters passed: none
//PostCondition: busSpeed += 5 unless value goes greater than 50
//
void Brake();
//Function: To decrease the speed of the bus by 5(mph) - not to exceed 0 mph (fully stopped)
//Parameters passed: none
//PostCondition: busSpeed -= 5 unless to go below 0 mph
//
void busInformation() const;
//Function: To display the bus information
//Parameters passed: none
//PostCondition: data for the bus info is displayed
//
busType();
//Function: To be the 'base' default constructor to initialize all member variables to 0
//Parameters passed: none
//PostCondition: busIDNumber = 0; numberOfSeats = 0; driverID = 0;
// busSpeed = 0;
busType(int busIDNum, int numbOfSeats, int driverIDNum);
//Function: To be the a constructor that initializes member variables to passed in parameters
//Parameters passed: busIDNumber, numberOfSeats, and driverID are set according to the parameters
//PostCondition: busIDNumber = budIDNum; numberOfSeats = numbOfSeats;
// driverID = driverIDNum; busSpeed = 0
private:
int busIDNumber; // variable to store the bus ID number
int numberOfSeats; // variable to store number of seats
int driverID; // variable to store the bus driver's ID number
int busSpeed; // variable to store speed of the bus
};