-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain_Vehicle.cpp
More file actions
31 lines (24 loc) · 963 Bytes
/
Copy pathmain_Vehicle.cpp
File metadata and controls
31 lines (24 loc) · 963 Bytes
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
#include <iostream>
#include "Bike.h"
#include "Car.h"
using namespace std;
int main() {
// Fixed comment syntax and updated IDs to match your 3-letter + 4-digit validation rule
Car car1("XYZ1234", "John Doe", "Red");
car1.displayInfo();
Bike bike1("MTB5678", "Jane Smith", "Mountain");
bike1.displayInfo();
// Invalid IDs (will print error logs correctly now)
cout << "\n--- Testing Invalid Entires ---" << endl;
Car car2("ABC123", "Mike Johnson", "Blue"); // Missing a digit
car2.displayInfo();
Car car3("ABC12345", "Sarah Lee", "Green"); // Too long
car3.displayInfo();
Car car4("AB11234", "Tom Brown", "Yellow"); // Missing a letter
car4.displayInfo();
// Fixed: Using correct variable names (car1 and bike1) for polymorphism demonstration
cout << "\n--- Polymorphic Output ---" << endl;
bike1.displayInfo();
car1.displayInfo();
return 0;
}