Vous êtes sur la page 1sur 7

Computer Engineering Department

Machine Problem

1
CP EP LFA
MP1
Format/Presentation (10%) : ________
Timeliness

(20%) : ________

Correctness

(10%) : ________

Analysis

(30%) : ________

Conclusion

(30%) : ________

GRADE

GUBALLA, DARYL ADRIAN M.


Signature over Printed Name

201520098/BSCPE/E074
Student Number / Course /
Section

9/3/2016
Date Submitted

Lyberius Ennio F. Taruc


Instructor, CPEPLFLA

PROBLEM 1
Create a program that will allow user to input scores for four exams namely; Exam1,
Exam2, Exam3 and Exam4. The program should calculate for the weighted average base on the
percentage given per exam and display its weighted average. Sample output is displayed below
with inputs of 100 for Exam1 at 20%, 85 for Exam2 at 35%, 90 for Exam3 at 15% and 75 for
Exam4 at 30%.

Algorithm
1)
2)
3)
4)

Get 4 exam scores


Multiply the first score by .20, second score by .35, third score by .15, and the fourth score by .30
Get the sum of the multiplied scores
Display the weighted average

Pseudo Code
1) Start
2) Input exam scores e1,e2,e3
3) Compute weighted average wAve=(e1*.20)+(e2*.35)+(e3*.15)+(e4*.30)
4) Output Weighted average
Flow Chart

Variables
- Variables e1,e2,e3,e4 is used to enter the 4 exam scores
- wAve is to represent the weighted average
Expressions Used
(e1*.20) + (e2*.35) + (e3*.15) + (e4*.30)
This expression was used to compute the weighted average.
PROBLEM 2
Create a program that will allow the user to enter number of typed envelopes and the number of
typed pages that will calculates and displays the bill of the customer with charges as $0.10 per typed
envelop and $0.25 per type page. Use 20 for number of typed envelopes and 15 for the number of typed
pages. Sample output is shown below.

Algorithm
1) Get the number of envelops and number of type pages
2) Compute the total number of envelopes sold
3) Compute the total number of typed pages sold
4) Compute the total sales
5) Display the total sales
Pseudo Code
1) Start
2) Input number of envelopes, x
3) Input Number of typed pages y
4) Compute the total amount of envelopes sold rTenve = x*.10
5) Compute the total amount of typed pages sold, rTpage = y*0.25
6) Compute the total amount of sales Tsale = rTenve+rTpage
7) Out the total sales Tsale.

Flow Chart

Variables Used
x - number of envelopes
y - number of typed pages
rTenve - the total amount of sold envelopes
rTpage the total amount of sold typed pages
Tsales amount of sales
Expressions Used
rTenve = x*.10 to get the total amount of from sold envelopes
rTpage = y*0.25 to get the total amount of from sold typed pages
Tsale = rTenve+rTpage To get the total sales

PROBLEM 3
Create a program that will allow the user to enter employee name and gross pay amount that will
calculate and display the monthly paycheck of an employee. The net pay is calculated after taking the
following deductions: Federal Income Tax is at 15%, State Tax is at 3.5%, Social Security Tax is at 5.57%,
Medicare/Medicaid Tax is at 2.75%, Pension plan is at 5% and Health Insurance is at $75.00 which is a
fixed amount for the year. Use Bill Robinson for the employee name and $3575.00 for the gross pay
amount.

Algorithm
1) Get the name of the employee.
2) Get their gross salary
3) Compute the federal tax
4) Compute the state tax
5) Compute the social security tax
6) Compute the medicare tax
7) Compute the pension plan
8) Declare the health insurance
9) Compute the net pay
10) Display the employees name, federal tax, state tax, social security tax, Medicare tax, pension
plan and their net pay.
Pseudo Code
1) Start
2) Input name, nAme
3) Input Gross pay, x
4) Compute federal tax, fTax=x*.15
5) Compute State Tax, sTax=x*0.035
6) Compute Social Security tax, secTax=x*0.0275
7) Compute pe, Ptax=x*0.05
8) Declare Health insurance, hIntax=75
9) Compute Netpay, Npay = x-(fTax+sTax+secTax+meDtax
10) Display nAme, fTax, sTax, secTax, meDtax, pePtax, hInTax and Npay
11) End

Flowchart

Variables
nAme employees name
fTax the federal tax
sTax state tax
secTax social security Tax
meDtax medicare tax
pePtax pension plan
hIntax health insurance
Npay net pay

Expression
fTax= x*.15
To Obtain the federal tax by multiplying the gross profit with its rate of .15
sTax= x*0.035
To Obtain the State tax by multiplying the gross profit with its rate of 0.035
secTax = x*0.0557
To Obtainthe Social Security tax by multiplying the gross profit with its rate of 0.0557
meDtax = x*0.0275
To Obtainthe Medicare tax by multiplying the gross profit with its rate of 0.0275
pePtax = x*0.05
To Obtain the Pension plan by multiplying the gross profit with its rate of 0.75
hIntax = 75
Declaring the health insurance tax
Npay = x-(fTax+sTax+secTax+meDtax+pePtax+hIntax)
To deduct the sum of all the tax to the gross pay to obtain the net pay.

Vous aimerez peut-être aussi