CSP2151 Programming Fundamentals Assignment

Assignment Help Civil Engineering
Reference no: EM132672371

CSP2151 Programming Fundamentals - Edith Cowan University

Assignment: A mini-programming project

General Information:
This assignment is an extension of the Workshops you have been doing during the semester. Like all workshop assessments, this assessment component should be completed individually.

Where appropriate, the standards set out in previous workshops should be followed and the code must make good use of functions, structures and control flows, etc.

Assignment type: individual work (i.e., not a group assignment)

Tasks:

Design and implement the following tasks (in C) to manage the simulation of the Automated Crash Test system.

Your program should first load the information of up to 10 vehicles from a file named "Vehicle.txt" and load the information 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. Use two variables, say vehicle_count and obstacle_count, respectively, to keep track of the numbers of vehicles and obstacles stored in the array of vehicle array and obstacle array, respectively. The minimum requirement for the data structures representing a vehicle and an obstacle, respectively, can be found from Section (1).

The program then displays all available vehicle information, and all obstacle information stored in the relevant arrays of structures. It then displays a Menu that allows the user to navigate through and execute the following options:

1. Search a vehicle
2. Search an obstacle
3. Input/update vehicle information
4. Input/update obstacle information
5. Simulate a vehicle crash against an obstacle
6. Display simulation results
7. Save all results
8. Save vehicle/obstacle information
9. Exit

The "Search a vehicle" feature should allow the user to search for information of a vehicle by its Vehicle_Name. If found successfully, the information stored in the related entry/entries in the vehicle array will be displayed. Otherwise, an error message should be displayed.

As a special case, if the vehicle name entered is "all", it displays information for all vehicles.

The "Search an obstacle" feature is similar to that of "Search a vehicle", but it searches information of an obstacle instead.

The "Input/update vehicle information" feature allows the user to input or update information of a vehicle. It prompts the user input a Vehicle_Number. If the Vehicle_Number entered 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 should be created in the array of vehicles and information be stored there (and the total number of vehicles should be increased).

The "Input/update obstacle information" feature is similar to the above, however it inputs/updates an obstacle instead of a vehicle.

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. This feature can also be named "vehicle crash simulation" (or "vehicle test" for short). Detailed simulation task is described in the section "(2) Vehicle crash test simulation".

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 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 (e.g., they are with different vehicle numbers), all test results for vehicles with that name should be displayed.

As a special case, if the vehicle name entered is "all", the program should display the test results of all vehicles that have been tested. If none of vehicles have been tested, an error message should be displayed.

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 test results for all vehicles that have been tested to that file.

The "Save vehicle/obstacle information" feature should extract all vehicle information stored in the vehicle array and save them back to the "Vehicle.txt" file. It also extracts all obstacle information stored in the obstacle array and save them back to the "Obstacle.txt" file for possible future tests. For simplicity, only the first (up to) 10 pieces of information of vehicles/obstacles are required to save.

(1) Data structures for Vehicles and Obstacles

The structure of a vehicle:

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 needed.

The structure of an Obstacle:

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

The structure of vehicle simulation result:

To save the simulation result, you may create an array of structure for simulation results, and save all simulations results to the array. The Simulation structure may have the following fields (you may add extra fields as needed):
• Test ID
• Vehicle ID // or VehicleName?
• Obstacle ID // or Obstacle Name?
• Vehicle_age // Test condition 1
• Impact_velocity // Test condition 2
• Number_of_passengers // Test condition 3
• Number_of_seatbelt_wearing_passengers // Test condition 4
• Safety_rate //Test result 1 (calculated)
• Damage_rate //Test result 2 (calculated)
• Passenger's Survival_rate //Test result 3 (calculated)

(2) Vehicle crash test simulation

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

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
o Measured in years
o Must not be greater than the current date minus the Vehicle manufacture date or less than zero
• Impact_velocity
o Displayed/entered in km/h
o Use m/s in calculations
o Must not be greater than the Vehicle's top speed or less than zero
• Number_of_passengers
o Must not be greater than the number of seats of the Vehicle stored in the array of Vehicle_info[ ] or less than zero
• Number_of_seatbelt_wearing_passengers
o 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_rate 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.

Bonus Mark :

Additional work and effort to improve the program and make it more useful can be worth bonus marks. Bonus marks are not required and will not improve your grade above 100%. - Please do not attempt tasks for bonus mark before you've attempted all required tasks of the assignment.

Examples of features that may be worth bonus marks:

• Advanced search features (search for all simulation/test results above a threshold)
• Use multiple files effectively with appropriate use of header files and good separation of concerns.
• Graphical user interfaces, animations or colours.
• Ask your tutor if you have other ideas!

Design and coding requirements:
• The Design: For this assignment, you can use pseudocode or flowchart to complete the design. Your design file should contain separate designs for each of your functions.
• The C code: Your C code must be consistent with your design.
This is the major assignment of the unit, assessing your ability to solve problems and their knowledge/skills in designing and implementing a medium-sized program based on a given application scenario. You should use correct control structures (sequence, decisions, and loops, functions, etc.) and appropriate or required data structures (arrays, strings, pointers, files, etc.) to implement the program. The only Libraries to be used in this assignment are
<stdio.h>, <stdlib.h>, <time.h>, <math.h>, <string.h>, <errno.h>, and <IO.h>, together with the only head files you created as a part of this assignment work, if any. Other non-standard
or any third-party libraries/packages should not be included/used in the code/s!

Attachment:- Programming Fundamentals.rar

Reference no: EM132672371

Questions Cloud

Discuss affordable care act : Discuss the Affordable Care Act (Obamacare). What effect did its enactment have on federal state relations, in your opinion?
What is in recording the transaction : The machine was estimated to have a useful life of 5 years and a residual value of $0. Dunbar Echo uses straight-line depreciation. In recording transaction?
Modernization theory and dependency theory : An Introduction, Chapter 12 on "The Politics of Development," describe the differences between Modernization theory and Dependency theory.
Discussion of the four types of parenting styles : Preface your discussion of the four types of parenting styles with a presentation of the enormity of the responsibility of raising children.
CSP2151 Programming Fundamentals Assignment : CSP2151 Programming Fundamentals Assignment Help and Solution, Assessment Writing Service - Edith Cowan University - Design and implement the tasks
Find what depreciation expense for the year ended december : The estimated useful life is 8 years and the company uses the straight-line method. What is the depreciation expense for the year ended December 31?
Which would be classified as an operating activity : Which would be classified as an operating activity on the statement of cash flows using the direct method? Cash received from selling equipment.
Terminology-knowledge apply to career in criminal justice : To be proficient in research, one must know language and process. How will this new terminology and knowledge apply to a career in criminal justice?
What the eps is approximately for barbur inc : What the EPS is approximately? The price of a share of common stock at the end of the year was $5. There were 480,000 shares of preferred stock outstanding

Reviews

Write a Review

Civil Engineering Questions & Answers

  Determine the clearance between the tube and the cylinder

A 25-mm diameter steel cylinder 300-mm long falls, because of its own weight, at a uniform rate of 0.1 m/s inside a tube of slightly larger diameter. A castor-oil film of constant thickness is between the cylinder and the tube.

  Determine the magnitude of the resultant force

A four story office building ha interior columns that are spaced 30ft apart in two perpendicular directions. If the flat-roof loadingis estimated to be 30 lb/ft2 , determine the reducedlive load supported by a typical interior column at ground level.

  What are the obstacles in chain survey in brief

What are the obstacles in chain survey in brief

  What is sheer stress on triangle beam

What is sheer stress on triangle beam.

  Determine the probability that ball is white

Box I contains 3 red and 5 white balls, while Box II contains 4 red and 2 white balls. A ball is chosen at random from the first box and placed in the second box without observing it's color. Then a ball is drawn from the second box.

  What is smallest particle size that will be removed in grit

What is the smallest particle size (density 2.65 g/cm3) that will be removed in a horizontal grit chamber 10 m long and 1.0 m deep if the flow rate is 1000 m3/hr. Assume the temperature of the water is 25°C.

  Determine how many moles of hclo4 are in 1 l

The density of 70.5 wt% aqueous perchloric acid is 1.67 g/mL. a. How many grams of solution are in 1.000 L b. How many grams of HClO4 are in 1.000 L c. How many moles of HClO4 are in 1.000 L

  Determine the stresses in cables and deflections of points

The steel beam ABCD is simply supported at A (pin) and supported at B and D by steel cables each having a diameter of 12mm. A force of 20 kN is applied at point C. For steel, let E = 209 GPa.

  Compare and contrast the anticipated effects of grain size

load ratio on the fatigue life predicted on the basis of the following three approaches to fatigue:

  Calculate its elongation when a load of 100n is applied

consider a cylindrical copper wire 3.0mm in diameter and 3x10^4 mm long. calculate its elongation when a load of 100N is applied. Assume that the deformation is totally elastic and its Young Modulus is 110GPa.

  How siphon works and what is its drawing

Biofilter AND dry sludge bed are part of the sewage treatment plant. Please let me know whether we can cover these facilities or not and what is micro-biological process in these. If we can provide cover than what will be the effect on its biological..

  Apply the system to an issue of a magazine

Devise a simple coding system to do a content analysis of print advertisements in popular magazines. Begin by examining the ads to choose the content dimensions you wish to use (e.g., gender). Apply the system to an issue of a magazine and describ..

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