CSP2151 Programming Fundamentals

{`Edith Cowan University
CSP2151 Programming Fundamentals       
`}

CSP2151: Workshop 1

General information about assessments of the unit

In this semester, we have two assignments and one final exam. The first assignment consists of three (assessable) workshops therefore requires three submissions. The second assignment is the major assignment of the unit. 

Each workshop has two types of tasks: Assessable tasks and Non-assessable tasks. The Assessable tasks not only test your knowledge and understanding of the key concepts/content covered in this unit, but also assess your ability to apply the programming skills learnt from the unit to solve problems. After completing the relevant Lab practice, students should be able to complete the assessable part of the workshops by themselves and submit their work for assessment. On the other hand, the non-assessable tasks are for practice only, allowing students to practice necessary programming skills needed to complete their assessable tasks. Students should be able to do the non-assessable part of the workshop after they participated and completed relevant lab practice. The non-assessable tasks of all workshops will not be assessed therefore do not need to be submitted.

Information about the assessment topic

Throughout of this semester, we will be focusing on one assessment topic: a simulation of an Automated Crash Test system. This theme will run through Assignment 1 (consisting of 3 * workshops) and Assignment 2. The workshops are relatively simple at first, and then gradually become more complicated as we learn more complex concepts and programming skills. Each workshop will cover a part of the simulation, and Assignment 2 will be the complete implementation of the simulation. Some basic information of the simulation is as follows: 

LS Dyna crash simulation

The Automated Crash Test system simulates a car/vehicle crash scenario/situation, where the vehicle hits to an obstacle, causing damage to the vehicle and possible passenger casualties. Under various conditions, the simulation will calculate various data items, such as the impact force, the overall safety_rate of the test condition/s, the degree of damage to the vehicle involved in the simulation, the survival_rate of passengers in the collision, and so on. As a result of the simulation, the calculated data items are displayed on the screen and saved in a file.

Non-assessable tasks:

Design and Implement the following:

  • Write a program to print "Hello World!" on the screen.
  • Write a Program that declares the variable speed_kmph and speed_mps. Ask the user to input a value in kilometers per hour (km/h), convert the value to meters per second (m/s) and output the result to the screen. The formula for converting from km/h to m/s is as follows:

𝑀=1000/3600 × 𝐾

where M is in m/s and K is in km/h.

Assessable tasks:

Your first assessable task is to begin creating an Automated Crash Test Simulation.

The first requirement of the simulation is to be able to calculate the force of an impact. 

In physics, the force of an impact is determined by the amount of work done to counteract the kinetic energy of a moving object. The mass of the moving object, its velocity (or speed) and the distance over which the rapid change in velocity occurs are used to find/calculate the overall force acting on the object.

Design and implement the following program (in C programming language) to calculate the impact force a vehicle would be exposed to during a collision.

  • Prompt the user to enter 3 variables: mass (in kg), velocity (in km/h) and stopping_distance (in m).
  • Convert the velocity from km/h to m/s and store it to a new variable velocity_mps (m/s) (see the conversion formula in the next page).
  • Calculate the resulting force, F, using the formula:

In a real vehicle collision, there are many more factors involved that can affect the outcome. This simplified formula can be used to get an estimate of the forces involved. We’ll get more involved as the semester continues.

F = 1/2𝑚𝑣2/𝑑

where

F = Force (Newtons) m = Mass (kg) v = Velocity of the moving object (m/s) d = Stopping distance (m).

  • Display on screen the following message:

“During a collision, if the vehicle is of <mass> kg, moving at a speed of <velocity> km/h, and is stopped in <stopping_distance> m after hitting the obstacle, the overall impact of force acting on the vehicle would be <force>

Newtons.”

where <variable> is replaced by value of the variable, e.g., 

During a collision, if the vehicle is of 1000 kg, moving at a speed of 36 km/h, and is stopped in 4 m after hitting the obstacle, the overall impact of force acting on the vehicle would be 12500 Newtons.

If any of the mass, velocity, and stopping_distance is entered a value of 0 or less, an Error message should be displayed on the screen, instead of the above output. The error message may look like

“Error: invalid data entered!”

--------The end of the Workshop description ---

Design and coding requirements:

• The Design: For this workshop, you are required to use flowchart (not pseudocode) to complete the design. Correct notation/symbols must be used in your design (e.g., flowchart symbols such as symbol shapes, flow lines and labels, etc.). Please use Word or any other diagramming software to create your flowchart.

Please use the notation/symbols used in the unit materials as much as possible. If you can’t do this for some reason, make sure that whatever notation/symbols you use is consistently applied and clearly represents the meaning of what you are depicting, and add keys or legendd if necessary.

• The C code: Your C code must be consistent with your design

This workshop is to test your understanding of basic programming concepts and assess your ability to write simple C code using sequential statements, simple I/O and decision-making statements. Therefore please limit yourself to using sequential statements (e.g., calculations, etc.), simple I/O (such as scanf(…) and printf(…)), and basic control sequences (such as sequential and decision-making, like if-then-else and switch/case statement/s). In this workshop, no loop control sequence should be used. The Library to be used/included can only be <stdio.h>. 

Academic Integrity and Misconduct  

• This workshop is an individual work (not a teamwork). Your entire assignment must be your own work (unless quoted otherwise) and produced for the current instance of the unit. Any use of uncited content that was not created by you yourself constitutes plagiarism and is regarded as Academic Misconduct. All assignments will be submitted to plagiarism checking software, which compares your submission version with previous copies of the assignment, and the work submitted by all other students in the unit (in the current semester or previous years/semesters). 

Never give any part of your assignment to someone else, even after the due date or the results are released. Do not work on individual assignment with other students. – You can help someone by explaining concepts, demonstrating skills, or directing them to the relevant resources. But doing any part of the assignment for them or with them, or showing them your work is inappropriate. An unacceptable level of cooperation between students on an assignment is collusion and is deemed an act of Academic Misconduct. If you are not sure about plagiarism, collusion or referencing, simply contact your lecturer or unit coordinator. 

• You may be asked to explain and demonstrate your understandingof the work you have submitted. Your submission should accurately reflect your understanding and ability to apply the unit content and the skills learnt from this unit.

Watch this video before submitting your assignment

Workshop 1 Marking Guide

(See Rubric in the next page)

Marking criteria

Marks allocated

Design

5

Calculations

3

Code legibility (comments, formatting/indentation, etc.)

4

Compilation

3

Output

3

Overall (e.g., code functioning, submission as per submission requirement and design/coding requirements, etc.) 

2

Total:

20

Rubric

 

Not proficient  

Low Proficiency  

Developing  Proficiency  

Moderate  Proficiency  

High Proficiency  

Mark  

Allocation  

Design  

Design not present or does not meet requirements 

Design has logical flaws or does not meet all requirements 

Design meets some requirements but not all 

Design meets most requirements but has some issues 

Design meets all requirements

5

Calculations  

Calculations do not work 

 

1-2 

Calculations work but produce inaccurate results 

 

Calculations work to produce expected results 

3

Code

Legibility  

Code is very difficult to

read 

Code has many readability issues such as poor naming conventions or lack of indenting 

Code has some readability issues such as poor naming conventions or lack of indenting 

Code has one or two small readability issues such as poor naming conventions or lack of indenting 

Code is well written and highly readable 

4

Compiling  

Code does not compile 

Code compiles with many warnings that indicate serious errors 

Code compiles with many

warnings 

 

Code compiles with no warnings 

3

Output  

Output is incorrect or not formatted as indicated 

Output is mostly correct but could be formatted better

Output is correct but could be formatted better 

 

Output is correct and formatted as indicated 

3

Overall

0

Code doesn’t function. Submission, design/coding didn’t meet requirements 

 

1

Code has functioning issues, design/coding and submission partially followed requirements

 

2

Code function well; design/coding and submission followed requirements

2