6.2.3: Print functions.C++ ONLY Define a function PrintEmployeeIncome() that takes one string parameter and one integer

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

6.2.3: Print functions.C++ ONLY Define a function PrintEmployeeIncome() that takes one string parameter and one integer

Post by answerhappygod »

6.2.3: Print functions.C++ ONLY
Define a function PrintEmployeeIncome() that takes one stringparameter and one integer parameter and outputs as follows, endingwith a newline. The function should not return any value.
Ex: If the input is Arturo 65000, then the output is:
CODE:
#include <iostream>using namespace std;
void PrintEmployeeIncome(string s, int n){ // Displaying the string and the integer cout <<"**"<<s<<"**\n"; cout << s << " earns " << n<< " dollars per year.\n";}
int main() { string employeeName; int employeeIncome;
cin >> employeeName; cin >> employeeIncome;
PrintEmployeeIncome(employeeName,employeeIncome);
return 0;}
Error:
6 2 3 Print Functions C Only Define A Function Printemployeeincome That Takes One String Parameter And One Integer 1
6 2 3 Print Functions C Only Define A Function Printemployeeincome That Takes One String Parameter And One Integer 1 (28.18 KiB) Viewed 35 times
X 1: Compare output Output differs. See highlights below. Special character legend Input Your output Expected output X 2: Compare output Input Your output Output differs. See highlights below. Special character legend Expected output X 3: Compare output Input Your output Expected output X 4: Compare output Output differs. See highlights below. Special character legend Input Your output Expected output X 5: Compare output Arturo 65000 **Arturo ** Arturo earns 65000 dollars per year. Input ** Arturo ** earns 65000 dollars per year. Your output Expected output Kjerstin 17600 Output differs. See highlights below. Special character legend **Kjerstin ** Kjerstin earns 17600 dollars per year. ** Kjerstin ** earns 17600 dollars per year. Mateo 74900 **Mateo** Mateo earns 74900 dollars per year. ** Mateo ** earns 74900 dollars per year. Ximena 53000 Output differs. See highlights below. Special character legend **Ximena ** Ximena earns 53000 dollars per year. ** Ximena ** earns 53000 dollars per year. Kai 8000 **Kai** Kai earns 8000 dollars per year. ** Kai ** earns 8000 dollars per year.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply