This action might not be possible to undo. Are you sure you want to continue?

BooksAudiobooksComicsSheet Music### Categories

### Categories

### Categories

### Publishers

Scribd Selects Books

Hand-picked favorites from

our editors

our editors

Scribd Selects Audiobooks

Hand-picked favorites from

our editors

our editors

Scribd Selects Comics

Hand-picked favorites from

our editors

our editors

Scribd Selects Sheet Music

Hand-picked favorites from

our editors

our editors

Top Books

What's trending, bestsellers,

award-winners & more

award-winners & more

Top Audiobooks

What's trending, bestsellers,

award-winners & more

award-winners & more

Top Comics

What's trending, bestsellers,

award-winners & more

award-winners & more

Top Sheet Music

What's trending, bestsellers,

award-winners & more

award-winners & more

P. 1

PF_13_14_T1_Project1_030713|Views: 65|Likes: 0

Published by 120shal

C++ Assignment.

C++ Assignment.

See more

See less

https://www.scribd.com/doc/154018419/PF-13-14-T1-Project1-030713

09/25/2013

text

original

Project#01

Programming Fundamentals

Faculty of Computing & Informatics Multimedia University

**Help! Prof. Taylor!
**

1. Introduction

You may have learned how to estimate the trigonometric functions such as sine, cosine and tangent of an angle in school by drawing lines on paper and plotting out a triangle etc. How do the computers and your calculators compute such values when there are no little guys with pencils and rulers inside them? Very often, in most programming languages such as C++, such functions already provided for you in the built-in libraries to compute such values. However, how were those libraries implemented in the first place? What do you do if you do not have such libraries? To answer that, we need helps from Prof. Taylor because Prof. Taylor has invented what we now called Taylor Series to compute such values. The purpose of this Project#01 is for you to implement those trigonometric functions using the given Taylor Series. See details below.

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.

TCP1101 Programming Fundamentals

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)

TCP1101 Programming Fundamentals

Project#01

**Figure 1 (a) : Sample Session 1
**

***** Trigonometry Program ******** Please enter an angle value => 35 Is the angle in Degree or Radian? Type D if it is in Degree Type R if it is in Radian Your response => D 35.0000000 Degree = 0.6108652 Radian RESULTS ================================= x = 0.6108652 Radian sin(x) = 0.5735764 cos(x) = 0.8191520 tan(x) = 0.7002075 ================================= Do you want to continue? Type Y to continue Type any other key to stop Your response => Y ***** Trigonometry Program ******** Please enter an angle value => 1.5708 Is the angle in Degree or Radian? Type D if it is in Degree Type R if it is in Radian Your response => R RESULTS ================================= x = 1.5708000 Radian sin(x) = 1.0000000 cos(x) = -0.0000037 tan(x) = infinity ================================= Do you want to continue? Type Y to continue Type any other key to stop Your response => y ***** Trigonometry Program ******** Please enter an angle value => 90 Is the angle in Degree or Radian? Type D if it is in Degree Type R if it is in Radian Your response => ZZ Invalid response, try again ! Type D if it is in Degree Type R if it is in Radian Your response => d 90.0000000 Degree = 1.5707963 Radian RESULTS ================================= x = 1.5707963 Radian sin(x) = 1.0000000 cos(x) = 0.0000000 tan(x) = infinity ================================= Do you want to continue? Type Y to continue Type any other key to stop Your response => n Thank you, good bye!!

**Figure 1 (b) : Sample Session 2
**

***** Trigonometry Program ******** Please enter an angle value => 0 Is the angle in Degree or Radian? Type D if it is in Degree Type R if it is in Radian Your response => r RESULTS ================================= x = 0.0000000 Radian sin(x) = 0.0000000 cos(x) = 1.0000000 tan(x) = 0.0000000 ================================= Do you want to continue? Type Y to continue Type any other key to stop Your response => y ***** Trigonometry Program ******** Please enter an angle value => 2.3145 Is the angle in Degree or Radian? Type D if it is in Degree Type R if it is in Radian Your response => R RESULTS ================================= x = 2.3145000 Radian sin(x) = 0.7359662 cos(x) = -0.6770183 tan(x) = -1.0870698 ================================= Do you want to continue? Type Y to continue Type any other key to stop Your response => Y ***** Trigonometry Program ******** Please enter an angle value => 780 Is the angle in Degree or Radian? Type D if it is in Degree Type R if it is in Radian Your response => d 780.0000000 Degree = 13.6135682 Radian RESULTS ================================= x = 13.6135682 Radian sin(x) = 0.8660254 cos(x) = 0.5000000 tan(x) = 1.7320508 ================================= Do you want to continue? Type Y to continue Type any other key to stop Your response => x Thank you, good bye!!

TCP1101 Programming Fundamentals

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)

i = 2, 4, 6, 8, .... for cos( 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.

TCP1101 Programming Fundamentals

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

அழகு குறிப்புகள்

Photoshop - Toolbox

186848451-Mayanginaen-docx

101 Shortcuts in Math

Nagarathar Kovilgal

Nagarathar Kula Deivangal

Ilamai Enum Poongatru - Part 1

Ilamai Enum Poongatru - INTRO

Higher Studies and Career

Borrowed Love - Tamil Short Story

Attributes of a Software Engineer

Queen Elizabeth II

Fat Burning Foods List

List of Fat Burning Foods

Big C++ _ 2nd Edition

Perception - the story

Nagarathar Pillayar Nonbu - Detailed Version

Nagarathar Pillayar Nonbu – Part 2 – Recipes

Earth Science Puzzle

Nagarathar Pillayar Nonbu – Part 2 – Recipes

Nagarathar Pillayar Nonbu

English-Tamil Computer Technical Dictionary

Tamil Nadu Pincodes

A Collection of Marriage Songs in Tamil

- Read and print without ads
- Download to keep your version
- Edit, email or read offline

Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

CANCEL

OK

You've been reading!

NO, THANKS

OK

scribd

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->