Difference: Lab1 (1 vs. 19)

Revision 192018-01-16 - JimSkon

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Lab 1-1

Changed:
<
<

Due Sept 7, 11:59pm

>
>

Due Feb 1, 11:59pm

 
Changed:
<
<
Moodle Link
>
>
Moodle Link
 
payroll-calculation1.jpg

Revision 182017-09-10 - JimSkon

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Lab 1-1

Line: 50 to 50
 

Regular hours: 3.00 (at $16.68 an hour)
Overtime hours: 0.00 (at $25.02 an hour)
Total hours: 3.00

Gross pay is $50.04

Social Security tax: $3.00
Federal taxes: $7.01
State taxes: $2.50
Union Dues: $10.00
Family Health Insurance: $35.00 (additional insurance premiums for your family)
Total Deductions: $57.51

Changed:
<
<

Your dues ad insurance obligations outstripped your pay by $-7.47.

>
>

Your dues and insurance obligations outstripped your pay by $-7.47.

 

Would you like to calculate another week's pay? (y or n) n


Thank you for using this program.

 

Revision 172017-09-07 - JimSkon

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Lab 1-1

Line: 19 to 19
 
  • Turn in the code (a cpp file or ideone.com link), and the run outputs as requested below.
  • Remember to format the code as described and the book and text, and to include comments including complete comment at the beginning of the program.

Coding Requirements:

Changed:
<
<
  1. Starting with this lab, you must follow the guidelines on Program Style described in section 2.5 of the textbook. ( See guidelines here). In particular, follow the style given in Display 2.16 (page 95) of the textbook. You will lose points if you don't. You must follow these guidelines in all future labs.
>
>
  1. Starting with this lab, you must follow the guidelines on Program Style described here ( See guidelines here).You will lose points if you don't. You must follow these guidelines in all future labs.
 
  1. For this lab all decimal point numbers must be printed with 2 digits after the decimal point. (e.g. 2.50 instead of 2.5). See pages 55-57 of the textbook for this.

Trial Data

Revision 162017-08-24 - JimSkon

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Lab 1-1

Changed:
<
<

Due Jnauary 31, 11:59pm

>
>

Due Sept 7, 11:59pm

 
Changed:
<
<
Moodle Link
>
>
Moodle Link
 
payroll-calculation1.jpg

Revision 152017-02-01 - JimSkon

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Lab 1-1

Line: 31 to 31
 
3 53 3
4 2 5
Deleted:
<
<

Grading

Feature %
Program correctness and completeness with respect to definition 70%
Code Format (Indenting, variable names) 10%
Code Comments 10%
A document showing the run outputs for the test cases given. 10%
 

Example Run

This program will ask you how many hours you worked, and calculate your
taxes, dues, gross pay, and net pay.

Revision 142017-01-17 - JimSkon

Line: 1 to 1
 
META TOPICPARENT name="WebHome"
Added:
>
>
 

Lab 1-1

Changed:
<
<

Due Sept 8, 11:59pm

>
>

Due Jnauary 31, 11:59pm

 
Changed:
<
<
Moodle Link
>
>
Moodle Link
 
Changed:
<
<
An employee is paid at a rate of $16.68 per hour for the first 40 hours worked in a week. Any hours over that are paid at the overtime rate of one and one half times that. From the worker’s gross pay, 6% is withheld for social security tax, 14% is withheld for federal income tax, 5% is withheld for state income tax, and $10 per week is withheld for union dues. If the worker has three or more dependents, then an additional $35 is withheld to cover the extra cost of health insurance beyond what the employer pays.
>
>
payroll-calculation1.jpg

An employee is paid at a rate of $16.68 per hour for the first 40 hours worked in a week. Any hours over that are paid at the overtime rate of one and one half times that. From the worker’s gross pay, 6% is withheld for social security tax, 14% is withheld for federal income tax, 5% is withheld for state income tax, and $10 per week is withheld for union dues. If the worker has three or more dependents, then an additional $35 is withheld to cover the extra cost of health insurance beyond what the employer pays.

  Write a program that will prompt the user for the following information:
  1. the number of hours worked in a week
Line: 69 to 73
 
Document wth trial runs included   10  
Total   100  
Solution \ No newline at end of file
Added:
>
>
  • payroll-calculation1.jpg:

META FILEATTACHMENT attachment="payroll-calculation1.jpg" attr="" comment="" date="1484621773" name="payroll-calculation1.jpg" path="payroll-calculation1.jpg" size="53797" user="JimSkon" version="1"

Revision 132016-09-12 - JimSkon

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Lab 1-1

Due Sept 8, 11:59pm

Revision 122016-09-08 - JimSkon

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Lab 1-1

Due Sept 8, 11:59pm

Moodle Link

Changed:
<
<
An employee is paid at a rate of $16.78 per hour for the first 40 hours worked in a week. Any hours over that are paid at the overtime rate of one and one half times that. From the worker’s gross pay, 6% is withheld for social security tax, 14% is withheld for federal income tax, 5% is withheld for state income tax, and $10 per week is withheld for union dues. If the worker has three or more dependents, then an additional $35 is withheld to cover the extra cost of health insurance beyond what the employer pays.
>
>
An employee is paid at a rate of $16.68 per hour for the first 40 hours worked in a week. Any hours over that are paid at the overtime rate of one and one half times that. From the worker’s gross pay, 6% is withheld for social security tax, 14% is withheld for federal income tax, 5% is withheld for state income tax, and $10 per week is withheld for union dues. If the worker has three or more dependents, then an additional $35 is withheld to cover the extra cost of health insurance beyond what the employer pays.
  Write a program that will prompt the user for the following information:
  1. the number of hours worked in a week

Revision 112016-09-07 - JimSkon

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Lab 1-1

Due Sept 8, 11:59pm

Line: 33 to 33
 
Program correctness and completeness with respect to definition 70%
Code Format (Indenting, variable names) 10%
Code Comments 10%
Changed:
<
<
A document showing three complete run outputs for the test cases given. 10%
>
>
A document showing the run outputs for the test cases given. 10%
 

Example Run

This program will ask you how many hours you worked, and calculate your
taxes, dues, gross pay, and net pay.

Line: 63 to 63
 
Correct output on required trial data   60  
Dollar amount with 2 places after decmail point.   10  
Appropriate code formatting   5  
Changed:
<
<
Well NamedVariables   5  
>
>
Meaningful identifier names (variables)   5  
 
Description Comments on top   5  
Section comments throughout   5  
Document wth trial runs included   10  

Revision 102016-09-06 - JimSkon

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Lab 1-1

Due Sept 8, 11:59pm

Line: 62 to 62
 
Requirement Grading Comments Points Score
Correct output on required trial data   60  
Dollar amount with 2 places after decmail point.   10  
Changed:
<
<
Appropriate code formatting   10  
>
>
Appropriate code formatting   5  
Well NamedVariables   5  
 
Description Comments on top   5  
Section comments throughout   5  
Document wth trial runs included   10  

Revision 92016-09-05 - JimSkon

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Lab 1-1

Due Sept 8, 11:59pm

Line: 67 to 67
 
Section comments throughout   5  
Document wth trial runs included   10  
Total   100  
Added:
>
>
Solution

Revision 82016-09-05 - JimSkon

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Lab 1-1

Due Sept 8, 11:59pm

Line: 58 to 58
 


Thank you for using this program.

 

Added:
>
>

Grading Table

Requirement Grading Comments Points Score
Correct output on required trial data   60  
Dollar amount with 2 places after decmail point.   10  
Appropriate code formatting   10  
Description Comments on top   5  
Section comments throughout   5  
Document wth trial runs included   10  
Total   100  

Revision 72016-09-05 - JimSkon

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Lab 1-1

Changed:
<
<

Due Sept 10, 11:59pm

>
>

Due Sept 8, 11:59pm

Moodle Link

  An employee is paid at a rate of $16.78 per hour for the first 40 hours worked in a week. Any hours over that are paid at the overtime rate of one and one half times that. From the worker’s gross pay, 6% is withheld for social security tax, 14% is withheld for federal income tax, 5% is withheld for state income tax, and $10 per week is withheld for union dues. If the worker has three or more dependents, then an additional $35 is withheld to cover the extra cost of health insurance beyond what the employer pays.
Line: 13 to 15
 
  • Turn in the code (a cpp file or ideone.com link), and the run outputs as requested below.
  • Remember to format the code as described and the book and text, and to include comments including complete comment at the beginning of the program.

Coding Requirements:

Changed:
<
<
  1. Starting with this lab, you must follow the guidelines on Program Style described in section 2.5 of the textbook. In particular, follow the style given in Display 2.16 (page 95) of the textbook. You will lose points if you don't. You must follow these guidelines in all future labs.
>
>
  1. Starting with this lab, you must follow the guidelines on Program Style described in section 2.5 of the textbook. (See guidelines here). In particular, follow the style given in Display 2.16 (page 95) of the textbook. You will lose points if you don't. You must follow these guidelines in all future labs.
 
  1. For this lab all decimal point numbers must be printed with 2 digits after the decimal point. (e.g. 2.50 instead of 2.5). See pages 55-57 of the textbook for this.

Trial Data

Revision 62016-09-04 - JimSkon

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Lab 1-1

Due Sept 10, 11:59pm

Deleted:
<
<

Requirements:

 
Changed:
<
<
  1. Starting with this lab, you must follow the guidelines on Program Style described in section 2.5 of the textbook. In particular, follow the style given in Display 2.16 (page 95) of the textbook. You will lose points if you don't. You must follow these guidelines in all future labs.
  2. For this lab all decimal point numbers must be printed with 2 digits after the decimal point. (e.g. 2.50 instead of 2.5). See pages 55-57 of the textbook for this.
An employee is paid at a rate of $16.78 per hour for the first 40 hours worked in a week. Any hours over that are paid at the overtime rate of one and one half times that. From the worker’s gross pay, 6% is withheld for social security tax, 14% is withheld for federal income tax, 5% is withheld for state income tax, and $10 per week is withheld for union dues. If the worker has three or more dependents, then an additional $35 is withheld to cover the extra cost of health insurance beyond what the employer pays. Write a program that will read in the number of hours worked in a week and the number of dependents as input, and will then output the worker’s gross pay, each withholding amount, and the net take-home pay for the week. Write your program so that it allows the calculation to be repeated as often as the user wishes.
>
>
An employee is paid at a rate of $16.78 per hour for the first 40 hours worked in a week. Any hours over that are paid at the overtime rate of one and one half times that. From the worker’s gross pay, 6% is withheld for social security tax, 14% is withheld for federal income tax, 5% is withheld for state income tax, and $10 per week is withheld for union dues. If the worker has three or more dependents, then an additional $35 is withheld to cover the extra cost of health insurance beyond what the employer pays.

Write a program that will prompt the user for the following information:

  1. the number of hours worked in a week
  2. the number of dependents
The program will then output the worker’s gross pay, each deduction amount, and the net take-home pay for the week. Write your program so that it allows the calculation to be repeated as often as the user wishes.

Turn in

  • Turn in the code (a cpp file or ideone.com link), and the run outputs as requested below.
  • Remember to format the code as described and the book and text, and to include comments including complete comment at the beginning of the program.

Coding Requirements:

  1. Starting with this lab, you must follow the guidelines on Program Style described in section 2.5 of the textbook. In particular, follow the style given in Display 2.16 (page 95) of the textbook. You will lose points if you don't. You must follow these guidelines in all future labs.
  2. For this lab all decimal point numbers must be printed with 2 digits after the decimal point. (e.g. 2.50 instead of 2.5). See pages 55-57 of the textbook for this.

Trial Data

Run the program for the following data, turning in a document will all run data (as a Word, text or pdf document)

Trial Hours Dependents
1 15 1
2 40 4
3 53 3
4 2 5

Grading

Feature %
Program correctness and completeness with respect to definition 70%
Code Format (Indenting, variable names) 10%
Code Comments 10%
A document showing three complete run outputs for the test cases given. 10%

Example Run

This program will ask you how many hours you worked, and calculate your
taxes, dues, gross pay, and net pay.

How many hours did you work? 20
How many dependents do you have? 1

Regular hours: 20.00 (at $16.68 an hour)
Overtime hours: 0.00 (at $25.02 an hour)
Total hours: 20.00

Gross pay is $333.60

Social Security tax: $20.02
Federal taxes: $46.70
State taxes: $16.68
Union Dues: $10.00
Total Deductions: $93.40

Net Pay: $240.20.

Would you like to calculate another week's pay? (y or n) y

How many hours did you work? 48
How many dependents do you have? 4

Regular hours: 40.00 (at $16.68 an hour)
Overtime hours: 8.00 (at $25.02 an hour)
Total hours: 48.00

Gross pay is $867.36

Social Security tax: $52.04
Federal taxes: $121.43
State taxes: $43.37
Union Dues: $10.00
Family Health Insurance: $35.00 (additional insurance premiums for your family)
Total Deductions: $261.84

Net Pay: $605.52.

Would you like to calculate another week's pay? (y or n) y

How many hours did you work? 3
How many dependents do you have? 4

Regular hours: 3.00 (at $16.68 an hour)
Overtime hours: 0.00 (at $25.02 an hour)
Total hours: 3.00

Gross pay is $50.04

Social Security tax: $3.00
Federal taxes: $7.01
State taxes: $2.50
Union Dues: $10.00
Family Health Insurance: $35.00 (additional insurance premiums for your family)
Total Deductions: $57.51

Your dues ad insurance obligations outstripped your pay by $-7.47.

Would you like to calculate another week's pay? (y or n) n


Thank you for using this program.

 

Revision 52015-09-08 - JimSkon

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Lab 1-1

Due Sept 10, 11:59pm

Requirements:

Changed:
<
<
  1. Starting with this lab, you must follow the guidelines on Program Style described in section 2.5 of the textbook. In particular, follow the style given in Display 2.16 (page 95) of the textbook. You will lose points if you don't. You must follow these guidelines in all future labs (including Lab1).
  2. For Project 7, all decimal point numbers must be printed with 2 digits after the decimal point. (e.g. 2.50 instead of 2.5). See pages 55-57 of the textbook for this.
>
>
  1. Starting with this lab, you must follow the guidelines on Program Style described in section 2.5 of the textbook. In particular, follow the style given in Display 2.16 (page 95) of the textbook. You will lose points if you don't. You must follow these guidelines in all future labs.
  2. For this lab all decimal point numbers must be printed with 2 digits after the decimal point. (e.g. 2.50 instead of 2.5). See pages 55-57 of the textbook for this.
 An employee is paid at a rate of $16.78 per hour for the first 40 hours worked in a week. Any hours over that are paid at the overtime rate of one and one half times that. From the worker’s gross pay, 6% is withheld for social security tax, 14% is withheld for federal income tax, 5% is withheld for state income tax, and $10 per week is withheld for union dues. If the worker has three or more dependents, then an additional $35 is withheld to cover the extra cost of health insurance beyond what the employer pays. Write a program that will read in the number of hours worked in a week and the number of dependents as input, and will then output the worker’s gross pay, each withholding amount, and the net take-home pay for the week. Write your program so that it allows the calculation to be repeated as often as the user wishes. \ No newline at end of file

Revision 42015-09-07 - JimSkon

Line: 1 to 1
 
META TOPICPARENT name="WebHome"
Changed:
<
<

Lab 1

>
>

Lab 1-1

 

Due Sept 10, 11:59pm

Requirements:

  1. Starting with this lab, you must follow the guidelines on Program Style described in section 2.5 of the textbook. In particular, follow the style given in Display 2.16 (page 95) of the textbook. You will lose points if you don't. You must follow these guidelines in all future labs (including Lab1).
  2. For Project 7, all decimal point numbers must be printed with 2 digits after the decimal point. (e.g. 2.50 instead of 2.5). See pages 55-57 of the textbook for this.
Deleted:
<
<

Part I (40 pts)

  An employee is paid at a rate of $16.78 per hour for the first 40 hours worked in a week. Any hours over that are paid at the overtime rate of one and one half times that. From the worker’s gross pay, 6% is withheld for social security tax, 14% is withheld for federal income tax, 5% is withheld for state income tax, and $10 per week is withheld for union dues. If the worker has three or more dependents, then an additional $35 is withheld to cover the extra cost of health insurance beyond what the employer pays. Write a program that will read in the number of hours worked in a week and the number of dependents as input, and will then output the worker’s gross pay, each withholding amount, and the net take-home pay for the week. Write your program so that it allows the calculation to be repeated as often as the user wishes.
Deleted:
<
<

Part II (60 pts)

Write a C++ program which takes a 4-digit number (integer) as input from the user and prints the number in reverse order. For example, if the number entered is 5678 then the output should be 8765. The program should repeat this until the user decides to quit.

You need to pay attention to the following:

  1. Provide appropriate comments in your code
  2. Use meaningful identifiers
  3. Don't take the input as a sequence of characters. Take it as a single integer. Also, construct the output as a single integer, as opposed to printing it digit by digit.
  4. Your program should give a warning message if the number (value) is not a 4-digit number. For example, 0345 is not considered to be a 4-digit number.
  5. Your program should not be case-sensitive for the user choice i.e. both Q and q are should be acceptable quit.
  6. You may assume that when asked to enter a 4-digit number, the user enters a positive integer (as opposed to other kind of data, such as a character)
  7. When the last digit (units) of the input is 0, the reverse is not a 4-digit number. So it is Ok to report the reverse as a 3-digit number in that case.
Here is a typical dialogue for this program:
Enter a 4-digit number
134 
This is not a 4-digit number: Enter a 4-digit number 
1234 
The reverse number is 4321 
Enter Q to quit, enter any letter to continue  C 
Enter a 4-digit number 
9001 
The reverse number is 1009 
Enter Q to quit, enter any letter to continue 
Q 
Thanks for using this program, bye !...

Important hint

  • The integer % operator gives the remainder of a division of two values. For example: x = 11 % 3; results in x = 2;
  • When integers are divided, the result of the / operator is the algebraic quotient with any fractional part discarded. For example: x = 11 / 3; results in x = 3.
  • If the number entered is n, what does n%10 give you? How about n/10?

Revision 32015-09-06 - JimSkon

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Lab 1

Due Sept 10, 11:59pm

Line: 6 to 6
 
  1. Starting with this lab, you must follow the guidelines on Program Style described in section 2.5 of the textbook. In particular, follow the style given in Display 2.16 (page 95) of the textbook. You will lose points if you don't. You must follow these guidelines in all future labs (including Lab1).
  2. For Project 7, all decimal point numbers must be printed with 2 digits after the decimal point. (e.g. 2.50 instead of 2.5). See pages 55-57 of the textbook for this.
Changed:
<
<

Part I (20 pts)

>
>

Part I (40 pts)

 
Changed:
<
<
Do Programming Project 7 (harder version) at the end of Chapter 2 (page 106)

Part II (20 pts)

>
>
An employee is paid at a rate of $16.78 per hour for the first 40 hours worked in a week. Any hours over that are paid at the overtime rate of one and one half times that. From the worker’s gross pay, 6% is withheld for social security tax, 14% is withheld for federal income tax, 5% is withheld for state income tax, and $10 per week is withheld for union dues. If the worker has three or more dependents, then an additional $35 is withheld to cover the extra cost of health insurance beyond what the employer pays. Write a program that will read in the number of hours worked in a week and the number of dependents as input, and will then output the worker’s gross pay, each withholding amount, and the net take-home pay for the week. Write your program so that it allows the calculation to be repeated as often as the user wishes.

Part II (60 pts)

  Write a C++ program which takes a 4-digit number (integer) as input from the user and prints the number in reverse order. For example, if the number entered is 5678 then the output should be 8765. The program should repeat this until the user decides to quit.

Revision 22015-08-28 - JimSkon

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Lab 1

Changed:
<
<

Due Sept 8, 11:59pm

>
>

Due Sept 10, 11:59pm

 

Requirements:

  1. Starting with this lab, you must follow the guidelines on Program Style described in section 2.5 of the textbook. In particular, follow the style given in Display 2.16 (page 95) of the textbook. You will lose points if you don't. You must follow these guidelines in all future labs (including Lab1).

Revision 12015-08-26 - JimSkon

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="WebHome"

Lab 1

Due Sept 8, 11:59pm

Requirements:

  1. Starting with this lab, you must follow the guidelines on Program Style described in section 2.5 of the textbook. In particular, follow the style given in Display 2.16 (page 95) of the textbook. You will lose points if you don't. You must follow these guidelines in all future labs (including Lab1).
  2. For Project 7, all decimal point numbers must be printed with 2 digits after the decimal point. (e.g. 2.50 instead of 2.5). See pages 55-57 of the textbook for this.

Part I (20 pts)

Do Programming Project 7 (harder version) at the end of Chapter 2 (page 106)

Part II (20 pts)

Write a C++ program which takes a 4-digit number (integer) as input from the user and prints the number in reverse order. For example, if the number entered is 5678 then the output should be 8765. The program should repeat this until the user decides to quit.

You need to pay attention to the following:

  1. Provide appropriate comments in your code
  2. Use meaningful identifiers
  3. Don't take the input as a sequence of characters. Take it as a single integer. Also, construct the output as a single integer, as opposed to printing it digit by digit.
  4. Your program should give a warning message if the number (value) is not a 4-digit number. For example, 0345 is not considered to be a 4-digit number.
  5. Your program should not be case-sensitive for the user choice i.e. both Q and q are should be acceptable quit.
  6. You may assume that when asked to enter a 4-digit number, the user enters a positive integer (as opposed to other kind of data, such as a character)
  7. When the last digit (units) of the input is 0, the reverse is not a 4-digit number. So it is Ok to report the reverse as a 3-digit number in that case.
Here is a typical dialogue for this program:
Enter a 4-digit number
134 
This is not a 4-digit number: Enter a 4-digit number 
1234 
The reverse number is 4321 
Enter Q to quit, enter any letter to continue  C 
Enter a 4-digit number 
9001 
The reverse number is 1009 
Enter Q to quit, enter any letter to continue 
Q 
Thanks for using this program, bye !...

Important hint

  • The integer % operator gives the remainder of a division of two values. For example: x = 11 % 3; results in x = 2;
  • When integers are divided, the result of the / operator is the algebraic quotient with any fractional part discarded. For example: x = 11 / 3; results in x = 3.
  • If the number entered is n, what does n %10 give you? How about n/10?
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback