Date: Mon, 11 Nov 1996 17:21:46 GMT Server: NCSA/1.5 Content-type: text/html Last-modified: Mon, 04 Nov 1996 18:14:56 GMT Content-length: 5768
Enter the following C++ program as it appears below, between the lines of asterisks. It will run as written, so you need not modify the program.
Please remember to put your name, login ID (not your password!) and your course section number in the program documentation (comments at the top of the program).
If you want to save yourself some typing, you can click here and then go to the "File" menu on Netscape and do a "Save as...". This will let you save the program listed below without having to type it in. You will still need edit the file to put in your name, etc.
******************************************************************************* /* Name: [your name here] Login: [your login ID here] Section: [your class section number here] This program computes the gross wages, income taxes, and net wages for an employee when given the pay rate and number of hours worked. */ #include <iostream.h> // This file must be included to do input & output. main() { int hours; // number of hours worked in the week float payRate; // rate of pay in dollars per hour float taxRate; // income tax rate float netWages; // net pay for the week (pre-tax) float taxes; // amount paid in income tax float grossWages; // gross pay for the week (post-tax) taxRate = .175; // set the tax rate to 17.5% cout << "Enter the number of hours worked: "; cin >> hours; cout << "Enter the hourly rate of pay: $"; cin >> payRate; // compute the taxes and gross and net wages netWages = hours * payRate; taxes = netWages * taxRate; grossWages = netWages - taxes; // print out the net wages, taxes, and gross wages cout << "Net wages: " << netWages << "\n"; cout << "Taxes: " << taxes << "\n"; cout << "Gross wages: " << grossWages << "\n"; } *******************************************************************************
Once you have the program typed into the file window, and you have saved the program in case something unsavory happens, then you just need to press the little lightening bolt button near the top of the screen. Your program will be compiled, linked, and run. If you mis-typed something, chances are you will get a syntax error. Go back to the program, check your typing, and when the mistake is found, change it and run the program again.
When the program runs, it will create a window, and prompt you to enter a number of hours worked and an hourly rate of pay. It will then compute the taxes and net and gross salaries using these numbers. You know that the program has run to completion by the appearance of the word INACTIVE at the top of the window.
To print a copy of the program, go back to the File menu, and choose Print. Click on OK in the little window that appears. The pages will automatically be printed in the printer room across the hall (room 1359). You can determine which printer will do the printing by checking out the Check Print Queues icon in the Administration folder. (It may take a few seconds to show your name).
To hand in an electronic copy of the program, you must use the File Manager program in the Main group. However, this time you will be dropping the program from your directory into a handin directory. You can locate the correct handin directory for you by first going to the r drive, opening the handin folder, finding another folder marked hummert and opening that, and then locating the final folder that contains your login name. You are to drop your program0.cpp file into the folder with your name.
Even though this program is not graded, it is important that you turn the electronic as well as a printed copy of the assignment in to me correctly (so I can make sure there are no problems).