Problem Solving
Problem Solving
Complete the seven problem-solving steps to calculate the water bill given the cubic feet
of water used for Eureka Water Company, which charges the homeowner one of the
following: a. A flat rate of $15.00 for usage up to and including 1000 cubic feet. b. $0.0175
per cubic foot for usage over 1000 cubic feet and up to and including 2000 cubic feet. c.
$0.02 per cubic foot for usage over 2000 cubic feet and up to and including 3000 cubic feet.
1. Start
2. Initialize variables:
- cubic_feet_used
- flat_rate = 15.00
- rate_1 = 0.0175
- rate_2 = 0.02
- bill = 0
3. Input cubic_feet_used
4. If cubic_feet_used <= 1000, then
bill = flat_rate
Else if cubic_feet_used > 1000 and cubic_feet_used <= 2000, then
bill = flat_rate + (cubic_feet_used - 1000) * rate_1
Else if cubic_feet_used > 2000 and cubic_feet_used <= 3000, then
bill = flat_rate + (1000 * rate_1) + ((cubic_feet_used - 2000) * rate_2)
Else
Display "Usage over 3000 cubic feet is not supported"
5. Output bill
6. End
2. A company that issues check-cashing cards uses an algorithm to create card numbers.
The algorithm adds the digits of a four-digit number, and then adds a fifth digit of 0 or 1
to make the sum of the digits even. The last digit in the number is called the check digit.
Complete the seven problem-solving steps to develop a solution that accepts a four-digit
number into one variable, adds the check digit, and prints the original number and the new
number. Test your flowchart with the following data: Original (47371) and 4631 (46310).
1. Start
2. Input a four-digit number into variable "original_number"
3. Set "sum_of_digits" to 0
4. Set "check_digit" to 0
5. Split "original_number" into individual digits
6. Add each digit to "sum_of_digits"
7. If "sum_of_digits" is even, set "check_digit" to 0, otherwise set it to 1
8. Concatenate "original_number" and "check_digit" to form the new number
"new_number"
9. Print "original_number" and "new_number"
10. End
3. An admission charge for The Little Rep Theater varies according to the age of the person.
Develop a solution to print the ticket charge given the age of the person. The charges are
as follows: a. Over 55: $10.00 b. 21–54: $15.00 c. 13–20: $10.00 d. 3–12: $5.00 e. Under 3:
Free
1. Start
4. End
4. A customer needs a specific amount of paper. The charges on the paper are $0.10 for
single sheets, $0.055 for amounts in multiples of 100 sheets, $0.04 in multiples of 500
sheets, and $0.03 in multiples of 1000 sheets. Develop a solution to calculate the type and
number of package(s) for the least amount of money the customer should buy, given the
minimum amount of sheets the customer needs. For example, if the customer needs 380
sheets, the amount she would pay when buying in multiples of 100 would be $22.00.
However, if the customer bought 500 sheets, the cost would be $20.00. It would be cost
effective for the customer to buy a package of 500 sheets
1. Start
3. Initialize variables:
total_cost = 0
package_count_1000 = 0
package_count_500 = 0
package_count_100 = 0
remainder = N
4. Calculate the number of packages needed for 1000 sheets:
package_count_1000 = N / 1000
remainder = N % 1000
total_cost += package_count_1000 * 0.03
9. End
5. A hotel has a pricing policy as follows: a. 2 people: $85 b. 3 people: $90 c. 4 people: $95
d. Additional people: $6 per person If the customer is staying on company business, there
is a 20% discount. If the customer is over 60 years of age, there is a 15% discount. A
customer does not receive both discounts. Given the above data, print the cost of the room.
1. Start
5. Set base_price = 0
6. Set discount = 0
7. If num_people == 2:
Set base_price = $85
Else if num_people == 3:
Set base_price = $90
Else if num_people == 4:
Set base_price = $95
Else:
Set base_price = $95 + ($6 * (num_people - 4))
8. If is_business:
Set discount = 0.20
Else if customer_age > 60:
Set discount = 0.15
9. If discount > 0:
Set total_price = base_price - (base_price * discount)
Else:
Set total_price = base_price
11. End
6. A manufacturer would like to have a device for a car that will turn on a light when the
temperature is between 34 and 40 degrees Fahrenheit (F) and sound a warning signal when
the outside temperature is 34 degrees F or below. The light and the sound are never going
simultaneously. Write a solution to this problem.
1. Start
2. Initialize variables:
- temperature
- light_status = OFF
- sound_status = OFF
3. Repeat:
a. Read the temperature from the sensor.
4. End loop
6. End
7. The Last Stop Boutique is having a five-day sale. Each day, starting on Monday, the price
will drop 10% of the previous day’s price. For example, if the original price of a product is
$20.00, the sale price on Monday would be $18.00 (10% less than the original price). On
Tuesday the sale price would be $16.20 (10% less than Monday). On Wednesday the sale
price would be $14.58; on Thursday the sale price would be $13.12; and on Friday the sale
price would be $11.81. Develop a solution that will calculate the price of an item for each
of the five days, given the original price. Test the solution for an item costing $10.00.
1. Start
2. Input original_price
3. Set current_price = original_price
4. Set discount_rate = 0.10
5. For i = 1 to 5
6. Set current_price = current_price - (current_price * discount_rate)
7. Output "Day ", i, ": $", current_price
8. End for
9. End
8. Mary Smith, a student, has borrowed $3,000 to help pay her college expenses. After
setting up a budget, $85 was the maximum monthly payment she could afford to make on
the loan. Develop a solution to calculate and print the interest, the principal, and the
balance on the loan per month. Other information she would like to know is the number of
years and months it will take to pay the loan back and the total interest she will pay during
that period. The interest rate is 1% per month on the unpaid balance. Keep in mind these
formulas: payment = balance - interest interest normal = balance*interest rate new balance
= balance - payment .
1. Initialize variables:
- loan_amount = 3000 (amount borrowed)
- monthly_payment = 85 (maximum monthly payment)
- interest_rate = 0.01 (1% interest rate per month)
- balance = loan_amount (initial loan balance)
- total_interest = 0
- months = 0
2. While balance > 0:
3. Increment months by 1
9. he counselor of a camp would like to know the average age of those attending a camp,
and who the oldest and the youngest are. The number of people attending a camp can
vary from 50 to 100..
1. Start
2. Initialize variables: total_age = 0, count = 0, oldest_age = 0, youngest_age = infinity
3. Input the number of attendees (n) // Assuming it's within the range of 50 to 100
4. Repeat n times:
a. Input age of attendee
b. Add age to total_age
c. Increment count
d. If age > oldest_age, set oldest_age = age
e. If age < youngest_age, set youngest_age = age
5. Calculate average_age = total_age / count
6. Display average_age, oldest_age, and youngest_age
7. End