Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

needs to be in c++ coding Sample run: Calculating the Special Differences: Enter the numbers: 1234 57 982 603 -2 The Sum is 4095 Calculating

image text in transcribedneeds to be in c++ coding

Sample run:

Calculating the Special Differences:

Enter the numbers:

1234

57

982

603

-2

The Sum is 4095

Calculating e^x through Taylors Series Expansion:

Enter the value of x: 5

Enter the number of terms: 20

e^x is 148.413

image text in transcribed

2 Program 1 - Writing Functions - 75 points Squilliam Fancyson has heard of the fancy calculator that Squidward (supposedly) made for the Krusty Krab's Cash Register. Determined to prove that he is the best programmer in town, he has challenged Squidward to a series of programming challenges. If Squilliam wins, Squidward has to hand over his clarinet and never paint again. If Squidward wins, Squilliam will work Squidward's shift at the Krusty Krab's cash register for a week. Squidward is determined to win, except he is not really a programmer. He has left no stone (pioneer transport or otherwise) unturned. He has even tried asking Karen, who was unable to help. He realizes that instead of working off Mr Krabs' old computer (the one Patrick smashed while painting the house), he could just pay you off to do the challenges for him. Your task today is to help Squidward retain his sanity and dignity (whatever is left of it) The first challenge is to write a few mathematical functions. For this program, we define a new term called Special Difference. The Special Difference of a number is the difference between the number and the one you obtain by reversing its digits. For example, the Special Difference of 1234 is 3087 (| 1234 4321 |) We also find the value of e using the Taylor's series expansion. The Taylor's Scries expansion of e is defined as inf n=0 Please mak e sure your program conforms to the following requirements. 1. Write a function called reverse that takes a number as a parameter and returns the reversed number. (20 points) 2. Write a function called difference that accepts a number as a parameter, calculates the special difference of the number and returns it. (15 points) 3. Write a function called factorial that returns the factorial of a number. You can use the code from the class examples. 4, write a function called sum that takes 'x' and a number 'n' as a parameter and calculates ez accurate to the 'nth' term. (20 points) 5. You can use the pow function to calculate x" 6. In the main function, accept a series of numbers from the user. Stop if the number entered is negative. Use the difference method to find the sum of the special differences and print it. (10 points) 7. Next, still in the main function, accept the values of 'x' and 'n' from the user and use the sum function to calculate the required value and print it. (5 points) 8. Make sure you add comments to explain your logic. (5 points) 2 Program 1 - Writing Functions - 75 points Squilliam Fancyson has heard of the fancy calculator that Squidward (supposedly) made for the Krusty Krab's Cash Register. Determined to prove that he is the best programmer in town, he has challenged Squidward to a series of programming challenges. If Squilliam wins, Squidward has to hand over his clarinet and never paint again. If Squidward wins, Squilliam will work Squidward's shift at the Krusty Krab's cash register for a week. Squidward is determined to win, except he is not really a programmer. He has left no stone (pioneer transport or otherwise) unturned. He has even tried asking Karen, who was unable to help. He realizes that instead of working off Mr Krabs' old computer (the one Patrick smashed while painting the house), he could just pay you off to do the challenges for him. Your task today is to help Squidward retain his sanity and dignity (whatever is left of it) The first challenge is to write a few mathematical functions. For this program, we define a new term called Special Difference. The Special Difference of a number is the difference between the number and the one you obtain by reversing its digits. For example, the Special Difference of 1234 is 3087 (| 1234 4321 |) We also find the value of e using the Taylor's series expansion. The Taylor's Scries expansion of e is defined as inf n=0 Please mak e sure your program conforms to the following requirements. 1. Write a function called reverse that takes a number as a parameter and returns the reversed number. (20 points) 2. Write a function called difference that accepts a number as a parameter, calculates the special difference of the number and returns it. (15 points) 3. Write a function called factorial that returns the factorial of a number. You can use the code from the class examples. 4, write a function called sum that takes 'x' and a number 'n' as a parameter and calculates ez accurate to the 'nth' term. (20 points) 5. You can use the pow function to calculate x" 6. In the main function, accept a series of numbers from the user. Stop if the number entered is negative. Use the difference method to find the sum of the special differences and print it. (10 points) 7. Next, still in the main function, accept the values of 'x' and 'n' from the user and use the sum function to calculate the required value and print it. (5 points) 8. Make sure you add comments to explain your logic. (5 points)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle9i Database Administrator Implementation And Administration

Authors: Carol McCullough-Dieter

1st Edition

0619159006, 978-0619159009

More Books

Students also viewed these Databases questions

Question

Differentiate between hard and soft measures of service quality.

Answered: 1 week ago

Question

Be familiar with the different perspectives of service quality.

Answered: 1 week ago