Algorithm Assignment:

 

For each of the problems below I want you to set up a table that will show the input, processing and output.  Then I want you to test your algorithm with test data you develop.  See if the answer is correct.  Then I want you to tell me how you would decide the form and how you would handle the processing using Visual Basic.

 

For example, lets say I want to input two numbers and add them together and display the total.  The answer that I am looking for would look like this.

 

Input

Processing

Output

number1

number2

get first number and store as number1

get second number and store as number2

total = number1 + number2

total

 

The processing steps must be in order and steps cannot be skipped.  We are writing these steps so that we could eventually program a computer to follow the steps and create the output. The table below shows a test of the algorithm.

 

Input

Processing

Output

49

24

number1 = 49

number2 = 24

total =  49 + 24

73

 

Problem #1:  Take in the high temperature for a day and the low temperature for a day. Display the average temperature for the day.

 

Problem #2:  You need to take in the price of four items a customer bought, determine the total price before tax, determine the tax using the tax rate of 2.5% and then determine the total price after taxes.  The output should show the total price before tax, the tax and the total price after taxes..

 

Problem #3:  You have received 5 numeric grades for the semester.  Grades can range from 0 to 100.  The first grade counts for 10% of you final grade.  The second grade counts for 15% of your final grade. The third grade counts for 25% of your final grade. The fourth grade counts for 20% of your final grade. The fifth grade counts for 30% of your final grade.  Calculate and display your final numeric grade.

 

Problem #4: You need to calculate an employees pay.  To do this you will need the number of hours the employee worked, the number of hours the employee is contracted to work before the employee receives overtime, the pay per hour, the rule for calculating over time (time and one half would be 1.5 while double time would be 2). Test this problem with someone who did not work over their contracted hours and again for someone who did work over their contracted hours.

 

Problem #5: You sell three products.  Product 1 sells for $25, product two sells for $50 and product 3 sells for $100.  You give discounts if someone buys multiple of your products according to the chart below. 

 

 

Product 1

Product 2

Product 3

5-9

3%

3%

5%

10-19

4%

5%

10%

20 or more

5%

10%

15%

 

Tell the customer what they would have paid without a discount and what they owe with the discount.