Manage the simulation of an Automated Crash Test System

Assignment Help Programming Languages
Reference no: EM132309686

Programming Fundamentals Assignment - A mini-programming project

Tasks: Design and implement the following tasks to manage the simulation of an Automated Crash Test System.

Your program should first load the names of up to 10 vehicles from a file named "Vehicle.txt" and load the names of up to 10 obstacles from a file named "Obstacle.txt" and store them in two arrays of structures, one for vehicles and the other for obstacles. The minimum requirement for the data structures representing a vehicle and an obstacle can be found from Section (1).

Next, the program should display a Menu that allows the user to navigate through and execute the following options:

  • Search a vehicle
  • Search an obstacle
  • Input/update vehicle information
  • Input/update obstacle information
  • Simulate a vehicle crash against an obstacle
  • Display simulation results
  • Display all results
  • Save all results
  • Save vehicle/obstacle information
  • Exit

The "Search a vehicle" feature should allow the user to search for information of a vehicle by its Vehicle_Name. Information stored in the related entry/entries in the vehicle array will be displayed. If the vehicle is not found, an error message should be displayed. The "Search an obstacle" feature is similar, but it searches information of an obstacle instead.

The "Input/update vehicle information" feature allows the user to input information of a vehicle. If the input Vehicle_Number matches an existing vehicle, the information entered is used to update the information of the vehicle stored in the array of vehicles. Otherwise a new entry is created in the array of vehicles and information is stored there. The "Input/update obstacle information" feature is similar, but it inputs/updates information of an obstacle instead.

The "Simulate a vehicle crash against an obstacle" feature should allow the user to select a vehicle and an obstacle (from the respective arrays), and then simulate a vehicle crash scenario. Detailed simulation task is described in "Vehicle crash test simulation" section.

The "Display simulation results" feature should allow the user to choose a vehicle (e.g., by its vehicle name) and display all test simulation results against some or all obstacles. If the vehicle has not yet been tested (i.e., no simulation was recorded), the program should inform the user that they must test that vehicle before displaying any results of the vehicle/s. If multiple vehicles have the same name, all vehicles' test results with that name should be displayed.

The "Display all results" feature should display an error message if no vehicle has been tested. Otherwise it displays the results of all vehicles that have been tested.

The "Save vehicle/obstacle information" feature should extract all vehicle names from the vehicle array and save them back to "Vehicle.txt" file. It also extracts all obstacle names from the obstacle array and saves them back to "Obstacle.txt" file for possible future use/test. For simplicity, only up to 10 (vehicle/obstacles) names are required to save.

The "Save all results" feature should display an error message if no vehicle has been tested. Otherwise it creates a file, named "results.txt", and save the names and test results for all vehicles that have been tested, to the file.

Menu design/implementation requirement: Create one function for each menu item (i.e., to implement its feature/s). If any of these functions was not completed as required in the final submission, use a dummy function that prints the following statement only: "<menu item name> feature has not been completed yet."

For example, if the "Display all results" feature was not completed at submission, the function should print the following statement only: "Display all results feature has not been completed yet."

(1) Data structures for Vehicles and Obstacles

Referencing the Vehicle structure defined in your Workshop 3, define a new structure to represent a vehicle for the crash simulation purpose. Your Vehicle structure should include at least 6 fields, including Vehicle_number, Vehicle_name, Manufactur_date, Top_speed, Mass, Number_of_seats. You may add any extra field/s as you need.

The Obstacle structure should include at least 3 fields, Obstacle_number, Obstacle_Name, Stopping_distance. You may add any extra field/s as you need.

(2) Vehicle crash test simulation

This task simulates a vehicle crash scenario, completing calculations on various data items, and displaying test simulation result.

Vehicle crash test simulation can be done under random conditions (i.e., conditions are randomly generated automatically within a reasonable value range) or by manually entering a set of test conditions. - Due to time and workload constraints, we only perform the latter case in this assignment (that is, all test conditions are to be entered manually under prompt).

At the start, the function/program prompts the user to choose one vehicle from the available vehicles and one obstacle from the available obstacles. It then prompts user to enter a variety of test conditions (including the velocity, or alternatively named impact_velocity, of the vehicle) for the crash test simulation.

The test conditions are set as follows and must comply with the listed restrictions:

Vehicle_age

  • Measured in years.
  • Must not be greater than the current date minus the Vehicle manufacture date or less than zero.

Impact_velocity

  • Display/entered in kmph.
  • Use m/s in calculations.
  • Must not be greater than the Vehicle's top speed or less than zero.

Number_of_passengers

  • Must not be greater than the number of seats of the Vehicle or less than zero.

Number_of_seatbelt_wearing_passengers

  • Must not be greater than the number of passengers or less than zero.

If the user enters an invalid value for any test condition, the program should print an error message, together with the data entered, and continue to prompt user again until a valid value is entered.

Based on the above information, the simulation calculates various data items, including Safety_rate and Damage to the vehicle participating the simulation, and Survival_rate of passengers involved in the crash. It then displays (and optionally saves) these data items as the simulation results.

Calculation of Safety-rate

Each test condition confers a bonus or penalty to the overall percentage Safety_rate of the test.

The Safety_rate is calculated using the following steps/algorithm:

a) Safety_rate = 1; // initialized as a percentage value of 100%

b) Decrease Safety_rate by a percentage factor of the vehicle's age using: ¼ * (Vehicle_rge - 2)2

c) Decrease Safety_rate by F /10000.0, which is the approximate impact force F on the vehicle, where F = ½mv2/s, m is the vehicle's mass, v the impact_velocity (in m/s) of the vehicle, and s the stopping distance of the obstacle.

d) If Safety_rate is below zero, set Safety_rate to 0; if Safety_rate is above 100% (or Safety_rate = 1), set Safety_rate to 100%.

Once the details of the test have been finalized, the user should be shown all condition information and the Safety_rate. The user will have an opportunity to accept the information and start the test or discard (and regenerate) all conditions.

Calculation of Damage-rate

In a crash, the damage to a vehicle depends on its Safety_rate of the vehicle in that crash. This is set as a random value within 25% * (1- Safety_rate).

Calculation of Passenger's Survival-rate

In a crash, the Survival-rate of a passenger involved in the crash depends on two factors, the Safety_rate of the vehicle, and whether or not he/she is wearing a seatbelt.

Each passenger will have, initially, a Safety_rate (percent) chance of survival. However, if any passengers are not wearing a seatbelt, all passengers are 4 times less likely to survive. Furthermore, those who are not wearing a seatbelt are 9 times less likely to survive.

Finally, display simulation result (together with test conditions) in a properly designed table.

Attachment:- Assignment File.rar

Reference no: EM132309686

Questions Cloud

How does race or ethnicity play a role in the stratification : What is social stratification? Examine four common ways or systems in which groups have become stratified. How does race or ethnicity play a role.
Identify five methods of critical analysis : Identify five methods of critical analysis that may be used for the evaluation of trends.
What are reasons for their popularity : What are reasons for their popularity? What do you think of some attractions that are popular today more than ever? What are the reasons for their popularity.
What categories would be best to reveal the segments : Determine and describe what ethnic, racial, and/or gender categories, if any, would be best, in your view, for the 2020 Census or the 2030 Census.
Manage the simulation of an Automated Crash Test System : CSP2151 Programming Fundamentals Assignment - A mini-programming project, Edith Cowan University, Australia. Manage the simulation
Apply the principles stated in working today : Apply the principles stated in "Working Today" pp. 2-7 to describe why Vancity has achieved this distinction.
Briefly discuss the theorist who created the theory : The purpose of this assignment is for you to understand how theoretical frameworks relate to and support nursing research and ultimately shape clinical practice
What are the state infant and maternal mortality rates : Investigate the FL state policies on access to contraception and abortion for women with insurance and those without. What are the state's infant and maternal.
Conducting individual performance evaluations : Identify four rules that should be followed when conducting individual performance evaluations.

Reviews

len2309686

5/21/2019 10:42:53 PM

General Information: This assignment is an extension of the Workshops you have been doing during the semester. Similar to all workshop assessments, this assessment component should be completed individually (i.e., it is not a group assignment). Where appropriate, the standards set out in previous workshops should be followed and the code must make good use of functions, structures and logical control flow.

len2309686

5/21/2019 10:42:46 PM

Assignment Submission Requirement: You are required to submit, through Blackboard, one single compressed file (in either .zip or .rar format), which contains at least three documents including (i) the design document (in Word or PDF format); (ii) C source code/s (in .c or .txt format); (iii) executable code (in .exe format only); plus any other supportive documents, if any.

len2309686

5/21/2019 10:42:40 PM

Assignment Submission Requirement: You are required to submit, through Blackboard, one single compressed file (in either .zip or .rar format), which contains at least three documents including (i) the design document (in Word or PDF format); (ii) C source code/s (in .c or .txt format); (iii) executable code (in .exe format only); plus any other supportive documents, if any.

len2309686

5/21/2019 10:42:33 PM

Rubric - Design meets all requirements. All Menu/functions fully implemented and work. Simulation calculation are present and work as intended. Functions are present and work as intended. Code is well written and highly readable. Program is well structured. Code compiles with no warnings.

Write a Review

Programming Languages Questions & Answers

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd