CSE1PES: PROGRAMMING FOR ENGINEERS AND SCIENTISTS ASSIGNMENT 1 (5%) LECTURES COVERED • Lecture 1 • Lecture 2 • Lecture 3 TOOLS • Unix server through Putty for compiling and testing • Notepad...

Please check the pdf for referencing style


CSE1PES: PROGRAMMING FOR ENGINEERS AND SCIENTISTS ASSIGNMENT 1 (5%) LECTURES COVERED • Lecture 1 • Lecture 2 • Lecture 3 TOOLS • Unix server through Putty for compiling and testing • Notepad ++ for writing solutions • LMS for submission SUBMISSION The task requires one submissions: • The code o Submitted as a .c file in the normal assignment submission portal. (Do not submit the executable.) There are NO late submissions for this assignment. No assignment will be accepted after the due date, without a legitimate extension granted by the lecturer before the due date. ACADEMIC INTEGRITY Plagiarism is the submission of somebody else’s work in a manner that gives the impression that the work is your own. For individual assignments, plagiarism includes the case where two or more students work collaboratively on the assignment. The School of Engineering and Mathematics treats plagiarism very seriously. When it is detected, penalties are strictly imposed. http://www.latrobe.edu.au/students/academic-integrity Assignment developed by Matthew Felicetti 2016, updated 2017(MF), updated 2018(MF) http://www.latrobe.edu.au/students/academic-integrity DEGREES TO RADIANS AND RADIAN TO DEGREES TABLE BACKGROUND Degrees are a measurement of an angle such that a full rotation of a circle is 360 degrees. Whereas a radian is defined as the angle of an arc with a length equal to the radius of a circle, a full rotation in radians is 2??. This is represented on the circle below: To convert from radians to degrees we use: ?????????????? = ?????????????? ∙ 180° ?? And to convert from degrees to radians we use: ?????????????? = ?????????????? ∙ ?? 180° ?? ≈ 3.141593 PROBLEM You are to create a program that allows the user to either create a table of degrees to radians, or radians to degrees. The format and steps are described in ‘Program’. PROGRAM 1. The program prints to the screen the student number, student name and the assignment number. This is enclosed by double asterisks. Ensure you follow the below format. 2. The program asks the user which table they would like to create, as follows. 3. The program accepts an integer value, entered by the user: Comment on how the program accepts an integer (You can assume here that the user will always enter an integer value.) a. If the user does not enter a valid value (ie. 1 or 2) the program should print the following and re-print step 2. Comment on how this is implemented 4. If the user enters a 1 then the program should ask the user for a value between 1 and 359. (else go to step 5) a. The program accepts an integer value between 1 to 359 (You can assume here that the user will always enter a valid value and an integer.) The program prints a table where the first column is degrees. The values start at 0 and increment by the step value while the value is less than 360. (hint. for loop) Comment on how this is implemented The second column is radians and is calculated by converting the degrees value in each row into radians. i. The formatting is as follows: • There is an empty line after the users input • Degrees are to be printed as integers and be of width 3 • A single space, then a line (|), then a single space • Radians are to be printed as floats, with a precision of 2 and width of 4 • There is an empty line after the table Comment on the concepts used to achieve the desired formatting The formatting must be exactly as above 5. If the user enters a 2 then the program should ask the user for a value between 0.01 and 6.26. a. The program prints a table where the first column is radians. The values start from 0, and increment by the step value while the value is less than 2??. Comment on how this is implemented The second column is degrees and is calculated by converting the radian value in each row into degrees. i. The formatting is as follows: • There is a new line after the users input • Radians are to be printed as floats, with a precision of 2 and width of 4 • A single space, then a line (|), then a single space • Degrees are to be printed as floats, with a precision of 2 and width of 6 Comment on the concepts used to achieve the desired formatting The formatting must be exactly as above 6. End the program CONSTRAINTS • Pi needs to be specified to exactly 6 decimal places in your program. • The user can select the resolution of the table by specifying the step size. • Formatting needs to be as specified. (Your program will be tested against automated test cases) • Text to user needs to be easily understandable. • The program must print your student number, name and the assignment number as specified. • Types should be used appropriately. • You do not need to use functions (You will not lose marks if you don’t or do). • You must use comments to explain significant lines of code. BONUS • Handle the case that a user enters something other than an integer in 3, appropriately, using what has been learnt so far. • Handle the case that a user enters a value that is not valid in 4 and 5, appropriately. HINTS • The code should be around 30 - 70 lines of code without the bonus. If your code is significantly larger/smaller you may want to reconsider your approach. SUBMISSION Part 1. Solve the problem individually by implementing a program using C code. The code must be documented using comments. RUBRIC Part 1 – 74 points Is the student’s number, student name and assignment number printed? ACADEMIC INTEGRITY If the names are different 0 0 Incorrectly formatted 4 Correctly formatted Does the program compile? 0 Does not compile. 4 Compiles with warnings. 8 Compiles with many warnings. 16 Compiles appropriately. Is the logic of the code appropriate? 0 The code logic does not match the problem. 2 Some large errors in interpreting the problem. 4 Some small errors in interpreting the problem. 8 The logic is suitable for the problem. Are the inputs and outputs understandable? 0 Does not accept inputs correctly or does not output data appropriately. 2 Many errors in outputs/inputs. 4 One error in outputs/inputs. 6 Inputs and outputs are handled appropriately. Suitable comments are used to explain particular blocks or lines of code. 0 No comments 5 Poor comments 10 Reasonable comments used throughout. 20 Excellent descriptions and commenting. Is the formatting of the table correct? 0 The tables are not printed 2 The tables are printed without formatting 8 The tables are formatted but incorrectly. 12 Correct format specifiers, spacing and new lines are used Are the values produced correct? 0 The values for both degrees to radians and radians to degrees are incorrect. 0 4 The values for either degrees to radians or radians to degrees are incorrect. 10 The values for both degrees to radians and radians to degrees are correct. Is the step size implemented correctly? (starts, steps and stops) 0 The steps for both degrees to radians and radians to degrees are incorrect. 0 4 The steps for either degrees to radians or radians to degrees are incorrect. 8 The steps for both degrees to radians and radians to degrees are correct. Is the code correctly indented? 0 The code is not indented. 0 2 Some errors in indenting. 4 Code is indented appropriately. Are variables named appropriately? 0 Variables are named poorly. 0 2 Variables are named suitably for the code. 4 Variables are named suitably for the code and the domain. Are appropriate variable types used where appropriate? 0 All variables are declared as the largest types 0 4 Some types are not suitable. 8 All variable types are suitable. CSE1PES: Programming for Engineers and Scientists ASSIGNMENT 1 (5%) Lectures covered Tools SUBMISSION Academic INTEGRITY DeGREES TO RADIANS AND RADIAN TO DEGREES TABLE BACKGROUND PROBLEM PROGRAM CONSTRAINTS BONUS HINTS SUBMISSION RUBRIC
Mar 14, 2020CSE1PESLa Trobe University
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here