Disponible uniquement sur Etudier
  • Pages : 5 (1070 mots )
  • Téléchargement(s) : 0
  • Publié le : 30 mars 2011
Lire le document complet
Aperçu du document

Prepare a payroll earnings statements. All the employees are on commission basis of 12.5% of sales. Each month, they also receive a bonus that varies depending on the profit for the month and their length of service. Sales manager calculates the bonus and enters it with the salesperson's total sales for the month. The program has to calculate taxes and retirement for the month basedon the following rates:
Federal tax:                25 %
state tax:                     10%
retirement plan             8%


Program Payroll
Calculation based on commission based on sales, and bonus.
1. Define commissionRate, FederalTaxRate, StateTaxRate and RetirementRate
2. getData (Total Sales, bonus)
3. assign Commission = calcComm(Total Sales)
4. assignTotal Earning = Commission + Bonus
5. calcTaxes(total earning, FederalTax, StateTax ,Retirement)
6. display
End Program Payroll

================== Get income Data =============================
Function getData
1. prompt user and read Total sales and bonus
End Function getData

================== Calculate Commission =========================
Function calcComm
1.assign commission = commissionRate * Sales
2. return commission
End Function calcComm

================== Calculate Taxes ===============================
Function calcTaxes
1. assign fedTax = FederalTaxRate * Earning
2. assign stateTax = StateTaxRate * Earning
3. assign retirement = RetirementRate * earning
End Function calcTaxes
================== Print Information================================
Function display
1. display fedTax, stateTax, retirement, total deduction, sales, commission, bonus and net earning.
End Function display
Problem 2

Write a function to compute the area and perimeter of a right angle triangle when given the length of the two smaller sides. use following formula:  c2 = a2 + b2 and area = 0.5 * (a * b)


ProgramCalculate area and Perimeter
Calculation is based on given two sides of a right angle Triangle
1. getSides (side1, side2)
2. calcAreaPeri(side1, side2, area, peri)
3. display(side1, side2, area, peri)
End Calculate area and Perimeter

================= Get two sides of a right angle triangle ==================
Function getSides
1. Prompt user and read two sides of a rightangle triangle
End Function getSides

================= Calculate area and perimeter =========================
Function caclAreaPeri
1. Assign side3 = square root of (square of side1 + square of side2)
2. Assign area = (0.5 * side 1 * side 2)
3. Assign peri = (side 1 + side 2 + side 3)
End Function calcAreaPeri

================ Print Results ====================================Function display
1. Display side1, side2, area and perimeter
End Function display

Problem 3

Write a program that determines a student's grade. It reads three test scores (1-100) and calls a function that calculates and returns a student's grade based on the following rules:
• If average is more than or equal to 90%, the grade is 'A'.
• if the average is less than 90% andmore than or equal to 70%, it checks the third score. If the third score is more than 90%, the grade is 'A' otherwise it is 'B'.
• If the average is less than 70% and more than or equal to 50%, it checks the average of second and third scores. If the average of the two is greater than 70% the grade is 'C', otherwise it is 'D'.
• If the average is less than 50%, then the grade is 'F'.Pseudocode

Program Grade
Find grade for a student based on three scores

1. getData (score1, score2, score3)
2. assign Grade = findGrade(score1, score2, score3)
3. Display
End Program grade

====================== Get Data ===============================
Function getData
1. Prompt user and read three grades
End Function getData

====================== findGrade...
tracking img