The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 398 Weeks Ago, 6 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
1. Let x and y be double variables that have been defined. Write a statement that displays "x^y = " on the output window followed by the return value from calling the pow() function and passing x and y as the parameters. For example, if x is 3 and y is 4 the output would be "x^y = 81".
2. Let x and y be defined as double variables. Write an expression that will calculate the square root of x^y. Hint: make the return value from pow() the input parameter to sqrt()
3. sqrAndAdd() is a function that has two double parameters and returns the sum of the squares of the parameters (as a double). For example, callingsqrAndAdd(2, 4) would return 2^2 + 4^2 = 20. Let x and y be defined as double variables. Write an expression that will calculate (x^2 + y^2) raised to the fifth power. Hint: make the return value from calling sqrAndAdd() the first input parameter to the pow() function.
4. Write a function definition for a function named  ouch() that has no parameters and returns nothing. When ouch() is called it displays the string literal "Ouch!" on the output window.
Instructor Notes: Remember the syntax for a function definition is:
data-type-return-value name-of-function ( optional-param-list)
{
one-or-more-statements
}
A function that does not return a value is called a void function and in place of the return value data type, we write the reserved word void there.'
5. Write fhe function definition for a function named  outputDottedLine() which has no parameters and returns nothing. When called,outputDottedLine() shall display five consecutive periods ..... on the outupt window followed by a newline.
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll