The AVCS project practice The next assessable task is to continue creation of the AVCS system. Design and implement (in
Posted: Sun May 15, 2022 1:34 pm
The AVCS project practice The next assessable task is to continue creation of the AVCS system. Design and implement (in C) the following: (1) Create a Vehicle structure and typedef it as new data type The struct Vehicle is used to hold a vehicle's information. It has the following fields: Vehilcle_Number //of int type Vehicle_Manufacturer // string, up to 20 chars Vehicle_Name //string, up to 10 chars Date_Manufactured //of int type, >1950 • Top Speed // of float type, >=0.0 Number_of_Seats //of int type, >0 Mass //of float type, >0.0 The table below shows a list of vehicles that could be used to do the Automated Crash Test Simulation. Table 1: A list of vehicle information Vehicle Vehicle Number Manufacturer Vehicle Name Date Manufactured No. of Seats Mass (kg) Top Speed (km/h) 200 415 140 5 1 2 3 Toyota Bugatti Alexander Dennis Mazda Ford 4 Camry Veyron Enviro400 Mazda2 Focus 1999 2015 2021 1100 1880 11000 90 4 2020 160 5 990 5 1996 218 5 1350 Typedef it as a new data type vehicle_t. (2) Extend your previous program in Workshop 2 to continue with the AVCS system using vehicle information stored in an array of vehicle_t. Your program should first declare an array of structs, Vehicle_info[] (of type vehicle_t), to store vehicle information. Your array should be able to store information for up to 50 vehicles. Initialize the Vehicle_info[ ] with appropriate vehicle information for at least 5 vehicles. The program then displays all available vehicle information (with a properly designed format, e.g., in a tabular style, like Table 1) on the screen.
To this point, the program displays a Menu similar to the one that you implemented in Workshop 2, allowing the user to navigate through and execute the following options: 1. Display information of all vehicles 2. Search vehicle information by vehicle number 3. Calculate and display force of impact for AVCS 4. Exit. Option 1 displays all available vehicle information stored in the array of Vehicle_info[ ]. Option 2: prompt the user to enter a vehicle number (e.g., 2). The program then searches the related field/s of the Vehicle_info[ ] array (e.g., to find the vehicle with vehicle number 2). If found, the program displays the vehicle information on the screen. Otherwise, an error message should be displayed. (Hint: you may implement a function search_vehicle (vehicle_t v[ ], int vehicle_No) and then call the function in this option) Option 3: prompt the user to enter 2 variables: velocity (in km/h) and stopping_distance (in m). If any of these variables are entered with 0 or less, an error massage will be displayed. Otherwise, the program loops to calculate and display the impact forces for all available vehicles (i.e., it takes mass value from the Mass field of Vehicle_info[ ] array but assumes the velocity and stopping_distance values just entered above). After calculation, it displays the resulted information on the screen (it's up to you to design the display format but it should contain information like): Vehicle Number, Vehicle name, Mass, Top speed, Test Velocity (km/h), Stopping distance, Force of Impact exposed (Note: Your program should display an error message if something goes wrong, for example, if the velocity entered is greater than the top speed of the participating vehicle) Option 4: quit the program. - The program should continue to loop, allowing user to navigate and execute menu option until the user chooses this option. Note: (i) Name your source code w3.C. (ii) Your design should include designs for functions (if any), and one design for the main() function, which calls other functions if applicable.
You are encouraged to further extend your program (to a new version of code): • Add a menu option/s to do some extra functions, such as (i) allowing users to create (or enter information for) more vehicles. Use an integer to keep track of number of vehicles that have been created so far. Be careful - Don't allow the user to create more than 50; 3 CSP2151 A1-Workshop 3 Sem1, 2022 (ii) displaying vehicle information for all available vehicles including those newly entered/updated; (iii) allowing searching vehicle information by Vehicle name, etc., instead of Vehicle Number only, etc. • Explain and extend to accommodate more error messages, etc.
To this point, the program displays a Menu similar to the one that you implemented in Workshop 2, allowing the user to navigate through and execute the following options: 1. Display information of all vehicles 2. Search vehicle information by vehicle number 3. Calculate and display force of impact for AVCS 4. Exit. Option 1 displays all available vehicle information stored in the array of Vehicle_info[ ]. Option 2: prompt the user to enter a vehicle number (e.g., 2). The program then searches the related field/s of the Vehicle_info[ ] array (e.g., to find the vehicle with vehicle number 2). If found, the program displays the vehicle information on the screen. Otherwise, an error message should be displayed. (Hint: you may implement a function search_vehicle (vehicle_t v[ ], int vehicle_No) and then call the function in this option) Option 3: prompt the user to enter 2 variables: velocity (in km/h) and stopping_distance (in m). If any of these variables are entered with 0 or less, an error massage will be displayed. Otherwise, the program loops to calculate and display the impact forces for all available vehicles (i.e., it takes mass value from the Mass field of Vehicle_info[ ] array but assumes the velocity and stopping_distance values just entered above). After calculation, it displays the resulted information on the screen (it's up to you to design the display format but it should contain information like): Vehicle Number, Vehicle name, Mass, Top speed, Test Velocity (km/h), Stopping distance, Force of Impact exposed (Note: Your program should display an error message if something goes wrong, for example, if the velocity entered is greater than the top speed of the participating vehicle) Option 4: quit the program. - The program should continue to loop, allowing user to navigate and execute menu option until the user chooses this option. Note: (i) Name your source code w3.C. (ii) Your design should include designs for functions (if any), and one design for the main() function, which calls other functions if applicable.
You are encouraged to further extend your program (to a new version of code): • Add a menu option/s to do some extra functions, such as (i) allowing users to create (or enter information for) more vehicles. Use an integer to keep track of number of vehicles that have been created so far. Be careful - Don't allow the user to create more than 50; 3 CSP2151 A1-Workshop 3 Sem1, 2022 (ii) displaying vehicle information for all available vehicles including those newly entered/updated; (iii) allowing searching vehicle information by Vehicle name, etc., instead of Vehicle Number only, etc. • Explain and extend to accommodate more error messages, etc.