Starting from:
$30

$24

CS Assignment 1 Solution

 Question 1:

Write a program that computes the wages for an employee. The program is interactive, and asks the user to enter the employee name, followed by two values, one for the number of hours the employee worked, and one for the employee's hourly rate. The program then computes the employee's gross wages. Salary deductions consist of 2.4% of the gross salary for employment insurance, 1% as union dues, and 17% for taxes. All three percentages should be declared as constants. The program computes all the deductions, as well as the Net pay, then outputs the information in the following format: 
```
Employee name:     .....

Hours worked:                xx
Hourly rate:                 xx.xx

Gross Pay:                             xxxx.xx

Deductions:
   Union dues                xx.xx
   Employment insurance      xx.xx
   Taxes                     xx.xx

Total Deductions            xxx.xx

Net pay:                               xxxx.xx  
```

## Question 2

You probably know that the roots of the quadratic equation  

ax^2 + bx + c = 0 

are given by:

x1 = (- b + sqrt (b2 - 4ac)) /2a

x2 = (- b - sqrt (b2 - 4ac)) /2a
    

Write a program that asks the user to enter  a, b, c, then calculates and prints the roots. Make sure to include all necessary operators and parentheses! 

Run it with different values:

a = 1, b = - 4, c = 4    should give two equal roots of value 2

a = 1, b = -5, c = 6    should give 3 and 2

a = 6, b = -7, c = -5    should give 1.6666 and -0.5

More products