![]() | Physics and Astronomy |
Back to top
Assessment 1This assessment forms 13% of your module mark. The objective is to test your ability to do simple arithmetic and do simple sanity-checking of users' input. Remember: you will make the best progress by doing the tasks in stages, making sure each stage works correctly before starting the next one. Be sure to ask me for help if you get stuck. Be sure to read the expectations document. 1. A grand day out35% of the assessment mark. Write a program to solve the following problems connected to the cost of a coach trip. As always, remember not to have numbers such as "159" scattered through the code but to use variables with sensible names. NB: the numbers below are indicative; you must write a program that gives the correct results whatever the number of students and instructors. Tip: To print a floating-point number to two decimal places write: printf("%.2f\n", x);(Note: there is a decimal point after the percent sign, ie it is "percent point two f") A computing class has 159 students and eight instructors. They wish to take a trip to the National Museum of Computing at Bletchley Park. They can hire 16-seater minbuses for £81 each plus VAT at 20% (i.e. you must add 20% to £81 to get the total cost).
Output requiredJust the output from the program, for example: We require 6 vans which will cost 13212.87 The diesel will cost 123.56 The total cost is 13336.43 etc 2. The sine rule65% of the assessment mark. This assessment requires some basic checking of user input. To do this you may either edit the program to manually change the values of the variables or use scanf() to read them in from the keyboard. Reminder Revise the sine rule.
Output requiredThe output from your program runs should show some warnings from each class of non-valid input and one working case. To hand inFor all assessments We require one ".c" text file for each task, uploaded to ELE. Do not upload a PDF, word-processor file etc. For each task you should hand in the program and some output pasted output into a comment at the end of your program: #include<stdio.h> int main() { // Your code here } /* OUTPUT Some output here */ The output should be fairly brief but enough to show that your code works. Basically we are looking for the minimum amount necessary to show your program worked for each separate class of the problem, including error checking where appropriate, rather than several similar runs. To copy and paste from the output terminalThe Windows output console has an "unusual" copy and paste mechanism:
You can now paste into Code::Blocks using Control-V |