Complete the attached lab18.cpp file by implementing the functions that are called by the given main...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Complete the attached lab18.cpp file by implementing the functions that are called by the given main function. You are not allowed to change any code in the main function. Note: use the best function title lines. Sample Output: [[swu@venus cs111]$ ./a.out [Enter your name: Andy [Enter your age: 20 Hello Andy! 16 +93 +26 = 135 Last digit of 135 is 5 Last digit of 20 is 0 [[swu@venus cs111]$ ./a.out [Enter your name: Nina [Enter your age: -1 Hello Nina! Age can't be negative [[swu@venus cs111]$ ./a.out [Enter your name: Lisa [Enter your age: 19 Hello Lisa! 28 +43 + 86 = 157 Last digit of 157 is 7 Last digit of 19 is 9 lab 18.cpp #include<iostream> #include<cstdlib> #include<ctime> using namespace std; /* Implement the functions that are called in the following main function. Note: use the best function title lines. */ int main() { } string user; int age, x, y, z; cout << "Enter your name: cin >> user; cout << "Enter your age: cin >> age; printHello (user); //printHello prints Hello to the input // isNegative returns true if the input is negative; otherwise, returns false if (isNegative (age)) { cout << "Age can't be negative" << endl; exit(0); } srand(time (0)); x = twoDigitNum(); // twoDigitNum returns a random 2-digit positive integer y twoDigitNum(); z twoDigitNum(); int sum add3(x, y, z); // add3 returns the total of 3 input numbers cout << x <<"+ 38 + << z << " = << sum << endl; 55 return 0; 88 // lastDigit takes a number as the input and returns the last digit of the input cout << "Last digit of << sum << is << lastDigit (sum) << endl; cout << "Last digit of << age << is << lastDigit (age) << endl; 35 38 Complete the attached lab18.cpp file by implementing the functions that are called by the given main function. You are not allowed to change any code in the main function. Note: use the best function title lines. Sample Output: [[swu@venus cs111]$ ./a.out [Enter your name: Andy [Enter your age: 20 Hello Andy! 16 +93 +26 = 135 Last digit of 135 is 5 Last digit of 20 is 0 [[swu@venus cs111]$ ./a.out [Enter your name: Nina [Enter your age: -1 Hello Nina! Age can't be negative [[swu@venus cs111]$ ./a.out [Enter your name: Lisa [Enter your age: 19 Hello Lisa! 28 +43 + 86 = 157 Last digit of 157 is 7 Last digit of 19 is 9 lab 18.cpp #include<iostream> #include<cstdlib> #include<ctime> using namespace std; /* Implement the functions that are called in the following main function. Note: use the best function title lines. */ int main() { } string user; int age, x, y, z; cout << "Enter your name: cin >> user; cout << "Enter your age: cin >> age; printHello (user); //printHello prints Hello to the input // isNegative returns true if the input is negative; otherwise, returns false if (isNegative (age)) { cout << "Age can't be negative" << endl; exit(0); } srand(time (0)); x = twoDigitNum(); // twoDigitNum returns a random 2-digit positive integer y twoDigitNum(); z twoDigitNum(); int sum add3(x, y, z); // add3 returns the total of 3 input numbers cout << x <<"+ 38 + << z << " = << sum << endl; 55 return 0; 88 // lastDigit takes a number as the input and returns the last digit of the input cout << "Last digit of << sum << is << lastDigit (sum) << endl; cout << "Last digit of << age << is << lastDigit (age) << endl; 35 38
Expert Answer:
Answer rating: 100% (QA)
The C program that contains all the required functions is as follows include include include using n... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these finance questions
-
Last week your travel agent called to tell you that she had found a great fare, $667, for your trip to the United Kingdom later this month. This fare was almost $400 below the APEX (advance purchase...
-
Lisa and Marco are married and file a joint tax return. Lisa has $180,000 in salary and Marco has $190,000 in self-employment income in 2013. What must they pay for self-employment tax? What portion...
-
You and a partner are asked to complete a lab entitled "Oxides of Ruthenium" that is scheduled to extend over two lab periods. The first lab, which is to be completed by your partner, is devoted to...
-
When component Auditors are involved in the audit of group financial statements the group Auditors are required to a. consider the independence and professional reputation of the component Auditors...
-
Melcher Company reported earnings per share in 2010 and 2009 of $2.00 and $1.60, respectively. In 2011, there was a 2-for-1 stock split, and the earnings per share for 2011 were reported to be $1.40....
-
What is a hazard rate in the context of this study? Pulmonary Disease A study was performed among 169,871 Chinese men and women in 1991 ages 40 years and older [13]. Baseline data were collected in...
-
Locate questions that can be used during a debtors examination once a judgment is obtained. Try to find questions specific to California, as many states have limits on the types of questions that can...
-
Maria Cohen is employed as a salesperson in the men's department of Lee's Fashions. In addition to her weekly base salary of $400 (35-hour week), Cohen is paid a commission of 1% on her total net...
-
1. What is crisis communication? Please explain the role of public relations in crisis communication. 2. Please examine Exxon company's crisis management regarding the Exxon Valdez oil spill. 3. What...
-
Determine which of the following are not well-formed formulas. 1. (S T) (U W) 2. (K L) ( G H) 3. (E F) (W X) 4. (B T) (C U ) 5. (F Q) (A E T) 6. D [(P Q) (T R)] 7. [(D Q) (P ...
-
1. Explain the major differences between Financial and Managerial accounting? (3pts) 2. Is one type of accounting more important than the other? Explain. (3pts) 3. For each of the following costs in...
-
What is a secular term?
-
Explain the difference between subharmonic and superharmonic oscillations.
-
What is the difference between a hard spring and a soft spring?
-
What is the method of isoclines?
-
Define these terms: phase plane, trajectory, singular point, phase velocity.
-
The demand-and-supply model as below, we need to try and explain the story about the housing market contained in the following Extract below... (around 900) Extract 1 - UK house prices soar to record...
-
Refer to Example 9.15. Add the following functionality to this program: Allow the user to enter the cost of a gallon of gas on each trip and use a function, Cost() to calculate the cost of purchasing...
-
Walter, a single taxpayer, purchased a limited partnership interest in a tax shelter in 1985. He also acquired a rental house in 2012, which he actively manages. During 2012, Walter's share of the...
-
Cypress Corporation has regular taxable income of $170,000 (assume annual gross receipts are greater than $5 million) and regular tax liability of $49,550 for 2012. The corporation also has tax...
-
Marty is a sales consultant. Marty incurs the following expenses related to entertainment of his clients in 2012: Dues to a country club......................................................$4,500...
-
List the reports available for reporting cash flows.
-
What additional steps are necessary to create a statement of cash flows for a period other than the one ending on the computers current system date?
-
Identify three different periods of time that QuickBooks Accountant provides for a statement of cash flows.
Study smarter with the SolutionInn App