ITP PROJECT
MEMBERS
M. AZAIN AKBAR
(BSE 233025)
M. AWAIS
(BSE 233047)
HUSNAIN ARFAQ
(BSE 233015)
M. KHAN
(BSE 233019)
HAMMAD MUSHTAQ
(BSE233041)
Date
11-
01-2024
Project title: RIDE BOOKING
Teacher’s name : QAZI SHUJA U
DIN
THE DETAIL
ITP PROJECT PAGE 2
1) Login Page:
Users are prompted to enter a username and password.
2) User Authentication:
If the credentials match, the user is successfully
authenticated and proceeds to the transportation booking
section.
ITP PROJECT PAGE 3
If the credentials do not match, the login fails.
ITP PROJECT PAGE 4
3) Transportation Booking:
After successful login, the user is welcomed to the
Transport App.
Users can choose the type of vehicle they want to book
(Car, Bike, Bus, Truck).
ITP PROJECT PAGE 5
4) Cancellation of Ride:
In this project we also added that user can cancel the
ride and can book other ride.
5) Project
Description:
The project is a console-based Transport App that allows
users to register, login, and book different types of vehicles
(Car, Bike, Bus, Truck) for travel. Users can choose the type of
vehicle and specify additional details for their journey.
ITP PROJECT PAGE 6
CODE
#include <iostream>
#include <cstring>
using namespace std;
struct User {
char username[50];
char password[50];
};
void registerUser(User users[], int& numUsers, int&
maxUsers) {
if (numUsers < maxUsers) {
cout << "Enter a username: ";
cin >> users[numUsers].username;
cout << "Enter a password: ";
cin >> users[numUsers].password;
numUsers++;
cout << "Registration successful. User added." << endl;
}
else {
cout << "Registration failed. Maximum number of users reached." << endl;
}
}
bool authenticate(User* users, int numUsers) {
char inputUsername[50], inputPassword[50];
cout << "Enter your username: ";
cin >> inputUsername;
cout << "Enter your password: ";
cin >> inputPassword;
for (int i = 0; i < numUsers; ++i) {
if (strcmp(inputUsername, users[i].username) == 0 && strcmp(inputPassword,
users[i].password) == 0) {
return true;
}
ITP PROJECT PAGE 7
}
return false;
}
int main() {
int maxUsers = 100;
int numUsers = 0;
char A;
char B;
User* users = new User[maxUsers];
int choice;
int* choiceptr;
choiceptr = &choice;
do {
cout << "1. Register" << endl;
cout << "2. Login" << endl;
cout << "Enter your choice: ";
cin >> *choiceptr;
switch (choice) {
case 1:
registerUser(users, numUsers, maxUsers);
break;
case 2:
if (authenticate(users, numUsers)) {
cout << "Login successful. Welcome, " << users[numUsers - 1].username << "!" << endl;
cout << " *****Welcome to Transport App**********" << endl;
cout << " " << endl;
do {
int select, type, km, price = 0;
int* typeptr, * selectptr, * kmptr, * priceptr;
typeptr = &type;
kmptr = &km;
selectptr = &select;
priceptr = &price;
cout << " Which Type Of Vehicle You Want To Select: " << endl;
cout << " 1. Car (Press 1) " << endl;
cout << " 2. Bike (Press 2) " << endl;
cout << " 3. Bus (Press 3) " << endl;
cout << " 4. Truck (Press 4) " << endl;
cin >> *selectptr;
if (select == 1) {
cout << " **Which Type Of CAR You Want: " << endl;
cout << " 1. AC Car (press 1)" << endl;
cout << " 2. Without AC Car (press 2)" << endl;
cin >> *typeptr;
ITP PROJECT PAGE 8
if (type == 1) {
price = 300;
cout << "Thanks For Booking AC car. We are reaching soon** " << endl;
cout << "Price for this ride is 300 Rs Per Kilometer." << endl;
cout << "Select How many kilometers you want to travel ?" << endl;
cin >> *kmptr;
}
else if (type == 2) {
price = 200;
cout << "Thanks For Booking car. We are reaching soon " << endl;
cout << "Price for this ride is 200 Rs Per Kilometer. Select How many kilometers
you want to travel?" << endl;
cin >> *kmptr;
}
}
else if (select == 2) {
price = 150;
cout << " Thanks For Booking a Bike. We are reaching soon** " << endl;
cout << " Price for this ride is 150 Rs Per Kilometer." << endl;
cout << " Select How many kilometers you want to travel ?" << endl;
cin >> *kmptr;
}
else if (select == 3) {
price = 1000;
cout << " Thanks For Booking a Bus. We are reaching soon** " << endl;
cout << " Price for this ride is 1000 Rs Per Kilometer." << endl;
cout << " Select How many kilometers you want to travel ?" << endl;
cin >> *kmptr;
}
else if (select == 4) {
price = 800;
cout << " Thanks For Booking a Truck. We are reaching soon** " << endl;
cout << " Price for this ride is 800 Rs Per Kilometer." << endl;
cout << " Select How many kilometers you want to travel ?" << endl;
cin >> *kmptr;
}
else {
cout << " Invalid selection!" << endl;
return 1;
}
int totalPrice = *priceptr * *kmptr;
ITP PROJECT PAGE 9
cout << " Your total Cost for Ride is: " << totalPrice << " Rs." << "We are Reaching in
few minutes" << endl;
cout << " " << endl;
cout << " " << endl;
cout << "\n\nIf you want to cancel the ride press (Y) otherwisw press (N). ";
cin >> B;
if (B == 'Y' || B == 'y')
{
cout << "You cancel the ride"<<endl;
cout << "\n\nIf you want to book another Ride? press (Y) other wise press (N) ";
cin >> A;
}
else
{
cout << "We will reach you soon.Please wait!";
}
} while (A == 'y' || A == 'Y');
for (int i = 1; i <= 10; i++) {
for (int j = 1; j <= i; j++) {
cout << " ";
}
for (int k = 1; k <= 10 - i; k++) {
cout << " *";
}
cout << endl;
}
}
else {
cout << "Invalid username or password. Login failed." << endl;
}
break;
default:
cout << "Invalid choice. Please try again." << endl;
}
while (choice != 2);
}
ITP PROJECT PAGE 10