Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Design an algorithm for each of the following problems. All algorithms in this l

ID: 3781093 • Letter: D

Question

Design an algorithm for each of the following problems. All algorithms in this lab should include input steps, processing steps (e.g. steps performing calculations) and output steps.

Problem 1

The retirement account of each employee in a company receives money from two sources each month. First, each employee contributes 6% of his salary to his own retirement account. Second, the company also makes a contribution equal to 3 % of the employee’s salary to the account. For example, suppose the monthly salary of an employee is $2000. The employee’s own contribution will be $120, while the company’s contribution will be $60. They need a program to manage the retirement accounts. The user will enter the monthly salary of an employee. The program will calculate and display the following items: amount of money contributed by the employee each month, amount of money contributed by the company each month, total contribution each month (i.e. the sum of employee’s and company’s contributions). Use 6% and 3% directly in the algorithm to calculate employee’s and company’s contributions. There is no need to ask the user to enter these rates.

Problem 2

All jackets in a store are on sale now. They need a program to process discounts. The user will enter the original price of a jacket and the discount percentage using a decimal (for example: if it is 25% off, the user should enter 0.25; if it is 30% off, the user should enter 0.30, etc). The program will use the original price and the discount percentage entered by the user to calculate the sale price (i.e. the reduced price). It will all calculate sales tax and total amount due. Use 0.07 as sales tax rate. There is no need to ask the user to enter sales tax rates. Display sale price, sales tax and total amount due.

Problem 3

   A group of high school students are selling pizza and soda during a basketball game to raise fund for a field trip. Pizza is $3.50 per slice and soda is $1.25 per cup. Design a program to do the following. Ask the user to enter number of cups of soda and number of slices of pizza ordered by the customer. The program will calculate and display the total amount due from the customer.

Problem 4

   A company is sending its employees to receiving training on some new equipment. The training includes two parts: part A and part B. The cost for attending part A is $100 while the cost for part B is $150. There are three options for each attendee:

     Option A: Attend part A only

     Option B: Attend part B only

     Option C: Attend both part A and part B

          Attendees who choose option C get a 20% discount. Write a program to calculate how much training fee the company needs to pay in total. The program should ask the user to enter the number of people who choose option A, option B and option C, respectively. It will calculate and display the total training fee the company needs to pay.

Explanation / Answer

Algorithm for problem 1

----------------------------------------------------------------------------------------------------

ALGORITHM: RETIREMENTACCOUNT

Input Step:

Step 1: INPUT “Monthly Salary of the employee “ to salary

Processing steps

Step 2: empContribution=salary*6/100

Step 3: compContribution=salary*3/100

Step 4: totalContribution= empContribution+ compContribution

Output Step:

Step 5: OUTPUT “Employee’s Own Contribution for retirement account is “,empContribution

Step 6: OUTPUT “Company’s Contribution for retirement account is “, compContribution

Step 7: OUTPUT “Total Contribution for retirement account is “,totalContribution

Step 8: END

------------------------------------------------------------------------------------------------------------

Algorithm for problem 2

ALGORITHM: JACKETSSALE

Input Step:

Step 1: INPUT “Price of Jacket “ to price

Step 2: INPUT “Discount percentage “ to discountPercent

Processing steps

Step 3: discount=price* discountPercent

Step 4: salePrice=price-discount

Step 5: salesTax=salePrice*0.07

Step 6 : amountDue=salePrice+salesTax

Output Step:

Step 7: OUTPUT “Sale Price :“,salePrice

Step 8: OUTPUT “Sales Tax : “, salesTax

Step 9: OUTPUT “Total amount due : “, amountDue

Step 10: END

---------------------------------------------------------------------------------------------

Algorithm for problem 3

ALGORITHM: FUNDCALCULATION

Input Step:

Step 1: INPUT “Number of cups of soda “ to soda

Step 2: INPUT “Number of slices of Pizza “ to pizza

Processing steps

Step 3: sodaPrice=soda*1.25

Step 4: pizzaPrice=pizza*3.50

Step 5: totalprice=sodaPrice+pizzaPrice

Output Step:

Step 6: OUTPUT “Total amount due to the Customer: “,totalPrice

Step 7: END

--------------------------------------------------------------------------------------------------------

Algorithm for problem 4

ALGORITHM: TRAININGFEE

Input Step:

Step 1: INPUT “Number of peoples choose for Part A only “ to numberA

Step 2: INPUT “Number of peoples choose for Part B only“ to numberB

Step 3: INPUT “Number of peoples choose for both Part A and Part B “ to numberC

Processing steps

Step 4: feeA=numberA*100

Step 5: feeB=numberB*150

Step 6: feeC=numberC*100 + numberC*150

Step 7: disc=feeC*20/100

Step 8: feeC=feeC-disc

Step 9: totalFee = feeA + feeB + feeC

Output Step:

Step 10: OUTPUT “Total training fee company needs to pay : “,totalFee

Step 7: END

--------------------------------------------------------------

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote