473,978 Members | 4,527 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adding to Code

4 New Member
Howdy...anyone able to assist me in adding the function to calculate the gross pay, and also the calculation and printing of the totals of hours and gross pay....thoughts ?

/* Purpose: This program calculates the gross pay for employees.
* It allows the user to enter employee numbers, hours worked,
* and rates of pay, and calculates the gross pay.
* User input terminates when employee number is 0.
* The program also displays the totals of the hours
* and gross pays for all employees.
*/

#include <iostream>
#include <iomanip>

/* Function Prototype */

/* Main Program */

int main(void)
{
int empNum;
double hours, rate, grosspay;

cout << setprecision(2) << setiosflags(ios ::fixed);

cout << "Please enter the employee number (0 to stop): ";
cin >> empNum;

while (empNum != 0)
{
cout << "Hours: ";
cin >> hours;
cout << "Rate: ";
cin >> rate;

grosspay = GrossPay(hours, rate);

cout << "\nGross Pay is " << grosspay;

cout << "\n\nPlease enter the employee number (0 to stop): ";
cin >> empNum;
}

cout << "\nThe total hours worked by all employees is " << endl;
cout << "\nThe total gross pay earned by employees is " << endl;

return (0);
}

/* Function: GrossPay
* Usage: grosspay = GrossPay(hours, rate);
* ----------------------------------------
* This function calculates the gross pay for an employee for the
* given number of hours worked (hours) and the rate of pay (rate).
* An employee is paid at the regular rate for the first 40 hours worked,
* at 1.5 times the rate for any hours over the first 40, and
* at 2 times the rate for any hours over the first 60.
*
* e.g. 62 hours at $10 per hour,
gives $400 for the first 40 hours,
* $300 for the next 20 hours, and
* $ 40 for the final 2 hours,
* ---- --
* thus $740 for the total 62 hours for a gross pay.
*/
Oct 30 '06 #1
0 1358

Sign in to post your reply or Sign up for a free account.

Similar topics

10
2725
by: sp0 | last post by:
Is there a reason why to make mix numbers improper when adding? It seems when subtracting and adding, adding a subtracting the whole numbers and fraction parts should be sufficient? what'ch think
5
2932
by: Tim | last post by:
I have block of code adding values to dropdown list under if (!Page.IsPostBack) { adding items } else { refreshing data }
4
5499
by: DotNetJunky | last post by:
I have built a control that runs an on-line help system. Depending on the category you selected via dropdownlist, it goes out and gets the child subcategories, and if there are any, adds a new dropdownlist to the screen for selection. This continues until there are no children, and then it checks for a help article list based on that last selection and displays actual articles for display. Adding the controls and getting everything...
3
4903
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that the best method? Do you have a sample of how to do this?
5
1703
by: Jeremy Ames | last post by:
I have run into a major road block with my page development projects. I am trying to add a literal control to my asp.net page and I got an error stating that the control could not be added because of code blocks (<% %>) on the page. Most of these blocks can be handled by adding a label control to the form so it is not that big of deal, but one of the things being posted is the page title. I am not sure how I can access that from the code...
1
2038
by: seanmayhew | last post by:
I have a form page that that while editing saves the data to an xml doc before submitting to db. On each page unload it saves the xmldoc as the user can add multiple items to the company like product types etc. So for instance Im adding a fruit company while adding a fruit company I allow the user to add types of fruit they carry and display it dynamically using an <asp:table> with image
26
2846
by: Simon Jefferies | last post by:
Hello, I am trying to add an item to a checked list box, like: clbList.Items.add("Hello",true) I get an error back: Run-time exception thrown: System.ArgumentOutOfRangeException - Specified argument was out of the range of valid values. Parameter name: '-1' is not a
6
4445
by: Rudy | last post by:
Hi all, I know this is easy, just can't seem to get it. I have a windows form, and a text box, with a value already in it. I need to add that value to a table. It's just one value, so the entire row doesn't get filled. I have a connection and all that stuff. Private Sub btnPlaceBet_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPlaceBet.Click ' Dim Myds As Footbet.DStable '...
0
1433
by: AndyL69 | last post by:
Hello I've got a very strange Problem. When im adding a new ACE entry to a UNC Direcotry the inherented ACL's will be lost. When I'm adding a new ACE to a directory / file in this UNC path the inherented ACE are still available. What's wrong ? I don't understand the difference between \\server\share and \\server\share\directory while adding a ACE AndyL Sample: \\myserver\myshare Inherited ACE: Administrators, Network Service
8
19952
by: Jason | last post by:
Hello, I am trying to utilitze the AJAX Control toolkit in my asp.net project. I have added a reference to AjaxControlToolkit.dll, and in my page, added these lines of code: <ajaxToolkit:ToolkitScriptManager runat="Server" EnableScriptGlobalization="true" EnableScriptLocalization="true" ID="ScriptManager1" />
0
10178
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11433
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11596
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10922
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6426
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6564
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
5163
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4747
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3775
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.