Exercise#2: Pre-defined and User-defined functions Write the following functions: Function #1: 1) Name: Inputx 2) Parameters:...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Exercise#2: Pre-defined and User-defined functions Write the following functions: Function #1: 1) Name: Inputx 2) Parameters: no parameters 3) Job: Input a double variable and return its value Function #2: 1) Name: GetY 2) Parameters: double x 3) Job: calculate y using the formula below and return y. Function #3: 1) Name: OutputXY() 2) Parameters: double x, double y 3) Job: Output x and y as shown in the sample output. Limit the output of y to 5 decimal places. int main() ( Use the following main() to test your function. You only need to implement the three functions. If the function are Implemented correctly then you will get the correct output. double X, Y: y= X = InputX(): Y = GetY (X): -2x+cos (x) 5sin (2x) Output XX (X, Y); return 0; Sample input/output: Enter the value of x: 3.1 For 3.1 the value of y is 17.32865 Enter the value of x: 0.921 For 0.921 the value of y is -0.25678 Exercise#2: Pre-defined and User-defined functions Write the following functions: Function #1: 1) Name: Inputx 2) Parameters: no parameters 3) Job: Input a double variable and return its value Function #2: 1) Name: GetY 2) Parameters: double x 3) Job: calculate y using the formula below and return y. Function #3: 1) Name: OutputXY() 2) Parameters: double x, double y 3) Job: Output x and y as shown in the sample output. Limit the output of y to 5 decimal places. int main() ( Use the following main() to test your function. You only need to implement the three functions. If the function are Implemented correctly then you will get the correct output. double X, Y: y= X = InputX(): Y = GetY (X): -2x+cos (x) 5sin (2x) Output XX (X, Y); return 0; Sample input/output: Enter the value of x: 3.1 For 3.1 the value of y is 17.32865 Enter the value of x: 0.921 For 0.921 the value of y is -0.25678
Expert Answer:
Answer rating: 100% (QA)
code include include include using namespace std double InputX double x cout Enter the value o... View the full answer
Related Book For
Financial Reporting Financial Statement Analysis and Valuation a strategic perspective
ISBN: 978-1337614689
9th edition
Authors: James M. Wahlen, Stephen P. Baginski, Mark Bradshaw
Posted Date:
Students also viewed these computer network questions
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Read the case study and answer the question below with a one page response. What does a SWOT analysis reveal about the overall attractiveness of Under Armours situation? Founded in 1996 by former...
-
Use normal job-order costing to calculate the balance in the ending Work-in-Process account and the Cost of Goods Sold account on 31 December 20X3 after any necessary adjustment(s). Sweet Memories...
-
The Reuth Company is evaluating the proposed acquisition of a new machine. The machine's base price is $600,000 plus shipping costs of $20,000. The machine falls into the MACRS 3-year class (use...
-
Lighthouse Enterprises decided to issue $1,400,000 of 10-year bonds. The interest rate on the bonds is stated at 10%, payable semiannually. At the time the bonds were sold, the market rate had...
-
List some qualities of a productive board meeting.
-
Identify the order in which the following budgets are prepared. Use the letter to indicate the first budget to be prepared, b for the second, and so on. 1. Production budget 2. Direct labor budget...
-
A company manufactures TVs and DVDs. Each TV requires 5 lbs of metal and 8 lbs of plastic. Each DVD requires 8 lbs of metal and 10 lbs of plastic. The company sources 10,600 lbs of metal and 8,000...
-
Alan and Angel Young are both 36 years old. Mr. Young recently accepted a new job making $93,000 a year and Mrs. Young is currently unemployed. The Youngs have two children (ages 4 and 2), a dog, and...
-
Download VMware Player, Virtual Box, or use Hyper-V to build a Windows 10 virtual machine. These free applications can be placed on your personal computer: Oracle Virtual Box (free) VMware Player...
-
There are all types of business leaders today, can you name a few leaders who have acted ethically in their business practices?
-
a.According to the latest annual report, Getafix Plc has total assets of 1.2 billion and total liabilities of 400 million. The company has 100 million shares outstanding. i.Determine the net asset...
-
When the stock price decreases, it can have negative effects on the company's market capitalization, liquidity, and overall financial health. Additionally, it can also make the company more...
-
Below are two made up and abbreviated examples of the 'CEO letter to the shareholders' from the 2020 annual reports of imaginary US sports goods company Haihai Sports Inc and imaginary German sports...
-
Explain the difference between a car allowance and an automobile benefit and the difference in the taxation differences. Explain and identify the various group benefits and which are taxable in which...
-
Your task is to search for a palindrome string of length (n) in a two dimensional matrix of random single characters between a-z, the idea of the solution is to parallelize the search between all...
-
Modify the counter from Exercise 5.44 such that the counter will either increment by 4 or load a new 32-bit value, D, on each clock edge, depending on a control signal Load. When Load = 1, the...
-
A firm had the following values for the four debt ratios discussed in the chapter: Liabilities to Assets Ratio: less than 1.0 Liabilities to Shareholders Equity Ratio: equal to 1.0 Long-Term Debt to...
-
Identify the types of firm-specific factors that increase a firms nondiversifiable risk (systematic risk). Identify the types of firm-specific factors that increase a firms diversifiable risk...
-
Rock of Ages, Inc., a large North American integrated granite quarrier, manufacturer, and retailer of finished granite memorials, reported a net loss for 2004 of $3.2 million. In 2004, the firm...
-
Modify the spread sheet to handle development costs.
-
What is a What if analysis?
-
You developed an overhead budget for a construction company. Historically, the companys construction costs are 89% of revenues. What volume of work does the construction company need to achieve in...
Study smarter with the SolutionInn App