This is an assignment that involves thinking out how to solve a problem.
For each of the problems, I want you to set up a table like I did that
will show input, processing and output: the input you have to solve, the problem,
the processing you need to do to get an answer and the output you produce (the solution).
Then I want you to test your alogrithm with test data you develop and see if your processing
produces the correct answer.
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 number two
total = number1 + number2
total
Note that number1, number2 and total are variable names. That means they are the names of
areas in memory set up to hold data.
Input
Processing
Output
49 24
number1 = 49 number2 = 24 total = 49+24
73
These are the problems for you to solve using the methodology above:
Problem #1: Take in a patients high temperature for the day. Take in the patients low temperature for the day.
The output should be the persons average temperature for the day.
Problem #2: Take in the price of four items a customer bought, determine the total amount they spent before taxes.
Now calculate the tax using a tax rate of 2.5% and determine the tax. Now add the tax to the total amount spent and
display the amount the customer owes. I want to see the total amount before taxes, the taxes and the
total amount after taxes.
Problem #3: You have received 4 numeric grades for the semester. Grades can range from 0 to 100. The first grade
counts 20% of your final grade, the second grade counts 15% of your final grade, the third grade counts 25% of your
final grade and the fourth grade counts 40% of your final grade. Calculate and then display the grade you earned
for the semester.
Problem #4: You need to calculate the pay for an employee.
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 (for example, the
employee might be contracted to work 40 and receive overtime for hours over 40, therefore if the number of hours the
employee worked was 45 and the number of hours they were contracted to work was 40, they would have 5 overtime hours)
the pay per hour
the rule for calculating overtime (time and one half would be 1.5 while double time would be 2)
Think about how to figure out if the person is entitled to overtime, I would do that with a question phrased with an if.
Test this problem twice: the first itme test with numbers that mean the person did not work over the contracted hours
and the second time test with numbers that mean the person did work over the contracted hours.