A clever person solves a problem. A wise person avoids it.
- Einstein
News
Site News
Latest Comments
Affiliates
Proxies
Contribute!
Chat
Tutorials
Newest Articles
Most Popular
Highest Rated
Latest Comments
Code Samples
Newest Code
Most Popular
Highest Rated
Latest Comments
Blogs
Admins Blog
Newest Blogs
Most Popular
Highest Rated
Latest Comments
Forums
Latest Posts
Latest Topics
Memberlist
[login]
|
[Register]
Gross Pay
by: bs0d
Description:
Visual C++ program uses functions to calculate an employee's gross pay by values provided by the user.
Code:
//Displays Employee name and gross pay #include
#include
using namespace std; //function prototypes string getName(); float getHoursWorked(); float getPayRate(); float calcGross(float,float); int main() { //declare variables string the_name = ""; float the_hours = 0.00; float the_payRate = 0.00; float the_gross = 0.00; //call functions for returning values. the_name = getName(); the_hours = getHoursWorked(); the_payRate = getPayRate(); the_gross = calcGross(the_hours,the_payRate); //display output final results. cout << "Employee: " << the_name << endl; cout << "Gross Pay: $" << the_gross << endl; return 0; } // end of main function. //***program defined functions*** string getName() { string name =""; cout << "Enter Employee name: "; getline(cin, name); return name; } float getHoursWorked() { float hours = 0.00; cout << "Enter the hours worked: "; cin >> hours; return hours; } float getPayRate() { float pay = 0.00; cout << "Enter pay rate: $"; cin >> pay; return pay; } float calcGross(float a,float b) { float gross = 0.00; gross = a * b; return gross; }
No Comments for this page.
You Must be
signed in
or a
member
to comment.
Code Stats
12,325
Views
0
Total Comments
0
Rating of 5 (
Votes)
Code Options
·
Login to Rate This Code
·
Login to Post a Comment
·
Read more by this author
Related
·
Open and Write System Call
·
Bit Multiplication
·
Hello World
·
Fat Percentage
·
Commission
"AllSyntax.com" Copyright © 2002-2021; All rights lefted, all lefts righted.
Privacy Policy