Vehicle management system in c++
Question:
This exercise assesses the skills required to develop user-defined functions, and pointers.
* Bonus Task:
Develop the program with Graphics properties to give a better look to your program. You need to explore the GRAPHICS LIBRARIES AVAILABLE IN C++ e.g.<Graphic>*
* I need to solve this Q with #include <iostream> and #include <straing> Not other libary. *
The cod must Run in DEV C++.
Please do not use std:: or getliner for cod.
Exercise 2
Develop a C++ program to develop a Vehicle Fine Management System for Police. The program will have the following features.
- A user-defined function called “Student Registration”. This function prompts a user to enter a student’s personal data i.e., Student Number, Student Name, Age, and City and stores them.
- A user-defined function called “Module Enrolment”. This function takes student numbers from the main function as an argument and prompts a user to enter student two modules details i.e. Module name, Module Code, and Module Credits Hours (15 or 30), and stores them. The programs should display an error message if a user enters a credit hour other than 15 or 30.
- A user-defined function called “Student Assessment”. This function takes student numbers from the main function as an argument and prompts a user to enter Module 1 and Module 2 marks and stores them.
- A user-defined function which takes a Student ID and search option (1 for Personal data search, 2 for Module Search, and 3 for Assessment Search) from the main function and Searches Student data according to the option (1,2 or 3)
You are also required to Design a Menu in the main function which displays all the above options to a user. Upon selection of an option from the menu, the program will call the relevant function and will pass the arguments. The program will also have an option to exit the menu that will end the program.
Sample Output:
*****
* Welcome to Student Management System *
* ****
1- Student Registration
2- Module Enrollment
3- Student Assessment
4- Search Student
5- Exit
Enter your choice (1-5): 2
enter Student ID: 11111111.
Enter Module 1 Name: PDI.
enter Module 1 Code: UFCEXX-30-1
Modules Enrolled
Similarly, you will have an output for all the above options.
Summary:
In this program, firstly we need to get the personal details of the students and then the details of the modules that the students have taken. And then marks scored in the modules by the respective students. Finally, we need to search for a particular student. And also display that student’s details.
Explanation:
Algorithm for vehicle management systems in c++ :
- Initially, include header files
- And then create a class student, module and declare the details like name, city, age, number, and the module details for the respective classes.
- After that, declare functions like studreg, modenroll, studassessment, and define the methods.
- Finally, create the menu in the main function followed by a switch case, to conclude the program.
Source code for vehicle management system in c++:
#include <iostream> using namespace std; /* personal details of a student */ class student { public: string name, cty; int age, no; }; /* to have the module details of a student */ class module { public: string mName, code; int hrs; int m1,m2; student s; /* to display the entire student details */ void disp() { cout<<"*********************************************"<<endl; cout<<"Student Details"<<endl; cout<<"*********************************************"<<endl; cout<<"Student Name: "<<s.name<<endl; cout<<"Student ID: "<<s.no<<endl; cout<<"Student Age: "<<s.age<<endl; cout<<"Student City: "<<s.cty<<endl; cout<<"Module name: "<<mName<<endl; cout<<"Module code: "<<code<<endl; cout<<"Module marks: "<<m1<<" and "<<m2<<endl; } }; /* to register */ void StudReg(module &m) { cout<<"Enter Student Number: "; cin>>m.s.no; cout<<"Enter Student name: "; cin>>m.s.name; cout<<"Enter Student age: "; cin>>m.s.age; cout<<"Enter Student city: "; cin>>m.s.cty; } /* to enroll for a module */ void ModEnroll(int num, module m[], int n) { for(int i=0;i<n;i++) { if(m[i].s.no==num) { cout<<"Enter the Module Name: "; cin>>m[i].mName; cout<<"Enter the Module Code: "; cin>>m[i].code; while(true) { cout<<"Enter the Module credit Hours: "; cin>>m[i].hrs; if(m[i].hrs==15 || m[i].hrs==30) break; cout<<"Invalid hours. try again!"<<endl; } break; } } } /* to do the assessment */ void StudAssessment(int num, module m[], int n){ for(int i=0;i<n;i++) { if(m[i].s.no==num) { cout<<"Enter Module 1 marks: "; cin>>m[i].m1; cout<<"Enter Module 2 marks: "; cin>>m[i].m2; } } } /* driver code */ int main() { cout<<"*************************************"<<endl; cout<<"Welcome to Student Management System"<<endl; cout<<"*************************************"<<endl; cout<<"1) Student Registration"<<endl; cout<<"2) Module Enrollment"<<endl; cout<<"3) Student Assessment"<<endl; cout<<"4) Search Student"<<endl; cout<<"5) Exit"<<endl<<endl; module m[20]; int cc=0; while(true){ int ch; cout<<"Enter your choice: "; cin>>ch; if(ch==1) { StudReg(m[cc]); cout<<"Student registered successfully!!"<<endl<<endl; cc++; } else if(ch==2) { int num; cout<<"Enter student number to enroll for a module: "; cin>>num; ModEnroll(num,m,cc); cout<<"Module Enrolled Successfully"<<endl<<endl; } else if(ch==3) { int num; cout<<"Enter student number to enter student module marks: "; cin>>num; StudAssessment(num,m,cc); cout<<"Student Assessment marks entered successfully!!"<<endl<<endl; } else if(ch==4) { int num; cout<<"Enter student number to search for the student details: "; cin>>num; for(int i=0;i<cc;i++) if(m[i].s.no==num) m[i].disp(); } else if(ch==5) break; } }
Output: