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. The following is an example.
Problem to solve:
The power of an air conditioner is measured in British Thermal Units (BTU). The higher the BTU, the more heat the air conditioner can bring away. When people buy an air conditioner, they need to know how many BTU they need to keep the room cool. Design a program to estimate how many BTU we need when we install a window air conditioner in a room. This number is determined by the volume of the room. The rule of thumb is that we need 3.5 BTU per cubic foot. The program should ask the user to enter the length, width and height of the room. It should calculate and display the number of BTU needed for the air conditioner.
Algorithm:
Step 1: Input the length of the room
Step 2: Input the width of the room
Step 3: Input the height of the room
Step 4: Calculate volume = length * width * height
Step 5: Calculate BTU needed = volume * 3.5
Step 6: Display BTU needed
Please type and save your answers in a single Microsoft Word document.
Mary is a big fan of tropical fish. She has a few tanks of fish at home. To maintain a healthy environment for the fish, she needs to add conditioner to the water once a week. The amount of conditioner added is determined by the volume of water in the tank. According to the direction on the bottle, she has to add 1 teaspoon of conditioner per 100 cubic inches of water. She wants a program to calculate the amount of conditioner to add to each tank. All tanks are rectangular. The program will ask for the length, width and height of the tank. It will calculate and display the amount of conditioner to add. [Note: volume = length * width * height]
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 employees own contribution will be $120, while the companys 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 employees and companys contributions). Use 6% and 3% directly in the algorithm to calculate employees and companys contributions. There is no need to ask the user to enter these rates.
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. Sales tax is 7% of sale price. Display sale price, sales tax and total amount due.
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.
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.