Professional Documents
Culture Documents
Project#01
Programming Fundamentals
Faculty of Computing & Informatics Multimedia University
2. Deadline
This Project#01 must be submitted by 31 July, 2013
3. Deliverables
The objective of this project is to test the skill of the students in problem solving and modular design using flowcharts and implementing them in the C++ programming language. The students are to design using flowcharts a program that will ask the user for a value of an angle and then display the sine, cosine and tangent of that angle. The users have a choice to enter the angle in degree or in radian. After the users have tried out a value, he/she can choose to try many other values until he/she chooses to stop using the program. Sample sessions of an actual such program are being provided in Figure 1(a) and Figure 1(b) for your reference. Take note that the program generates everything on the display except for those parts that required users response (after the => symbol) are to be typed by the users. Take note that this is only the minimal requirement; you should add as much features as possible to your program and to make it as user-friendly as possible in order to get better marks. You may want to also compute other functions using Taylor series. The program basically asks the users for an angle value and calculates the sine, cosine and tangent of the angle. The users have a choice to enter the angle either in degree or in radian. If the user enters it in degree, it will be converted into radian before the required values are computed.
Project#01
Given an angle value x in radian, the equations to compute sine, cosine and tangent are given by the Taylor Series as below:
sin( x) = x x3 x5 x7 x9 + + ... 3! 5! 7! 9!
tan( x) =
cos( x) = 1 x 2 x 4 x 6 x8 + + ... 2! 4! 6! 8!
sin( x ) cos( x)
Project#01
Project#01
6. Tips and Evaluation Criteria In order for you to get better marks, the following tips are given for your consideration. a. Efficiency To minimize the computation thus increase the efficiency of computation of cos( x) and sin(x), take note that each term in the equations can be calculated based on previous term. In another word, termi can be computed from termi-2 (assuming i is the power of x in that term) using the formula below:
termi = (termi 2 ) x2 i (i 1) where i = 3, 5, 7, 9, .... for sin( x)
b. Accuracy Take note that the more terms are used for each of the computation, the more accuracy would the answer be. The question is how do we guarantee the accuracy is accurate up to a certain number of decimal points? The tips here is that the summation of the term should stop only after the last term computed is smaller than a certain fraction number (such as 0.000001 etc.). Another aspect of accuracy is that if x is very large, then the computation errors would be very big, thus the result would not be accurate, you will understand this in the future, for now just accept this fact. So, the tips here is that given an angle, always convert the angle to an angle between 0 degree and 360 degree (or 0 radian and 2*Pi radian). You could choose other range as long as the values are small; another possible range is between -180 degree and 180 degree (or -Pi radian and Pi radian). How can you achieve this? Well, I leave it with you to figure it out in order for you to get extra marks. c. Robustness (Error-free) To make the program more usable, the program should handle special cases such as an accidental invalid input from the user. If the user enters the wrong things, you should allow the user to enter another input until it is a valid response. Also take note that if the angle is 90 degree or Pi/2 radian, then cos(x) would be 0 and tan(x) would be infinity. Your program should handle such special cases because division by zero will cause the program to terminate suddenly with a fatal (division-by-zero) error. d. Modularity of program (good and proper usage of functions) Each of your functions should NEVER be too long, always try to break down the problem into smaller functions. A rule of thumb is that if you cannot draw the flowchart of a function in one A4 paper, then it is probably too big and should be broken into smaller ones. e. Other Evaluation Criteria Please refer to the Project Mark Sheet on the detailed marks allocation.
Project#01
Programming Fundamentals
To be filled by Examiner. This is for your reference only.
Max Actual Marks
1. Report (15%) a. Formatting and Style b. Language (Spelling, Grammar) c. Presentation Clarity b. Screenshots e. User Guide / Instructions to Use the Program 2. Coding (50%) a. Error Checking Features b. Style Self Documentation c. Style Indentation d. Code Modularity (usage of functions) e. Code Efficiency and Strategy (each group member to explain his/her parts during Interview) 3. Program Execution (25%) (If the program cannot be run, even if it can be compiled, 0 mark will be given for this section) a. General Appearance of Program (display) b. Accuracy (program works and runs correctly) c. Usability (interaction with user, user-friendliness) d. Performs All Required Features e. Error-free During Runtime 4. Additional Features (10%) a. Additional special features or any other significant contributions TOTAL 10 100 10 3 2 15 20 3 3 3 3 3
5 5 5 5 5