Calculate the Cost of Purchasing Disinfectant Sprays

How can you calculate the cost of purchasing disinfectant sprays?

What factors are considered when determining the cost of purchasing disinfectant sprays?

Answer:

To calculate the cost of purchasing disinfectant sprays, we need to consider the type of spray and the number of sprays purchased. The cost per spray varies depending on the type of spray and the quantity purchased. In this case, we have two types of sprays: LieSol Spray and Microbond Spray.

The price per spray for LieSol Spray is $8.99 for 1-2 sprays and $8.75 for 3 or more sprays. The price per spray for Microbond Spray is $7.99 for 1-2 sprays and $7.50 for 3 or more sprays.

To calculate the total cost of the purchase, we need to ask the user for the type of spray and the number of sprays they are buying. We can display a menu to validate the user's choice of spray and continuously ask for a valid choice if an invalid choice is entered.

Once we have the type of spray and the number of sprays, we can determine the price per spray based on the table provided. We can then multiply the price per spray by the number of sprays to calculate the subtotal.

Next, we need to add a 4.75% sales tax to the subtotal. We can calculate the tax by multiplying the subtotal by 0.0475.

Finally, we can calculate the total price of the purchase by adding the subtotal and the tax. We should display the subtotal, tax, and total price of the purchase with correct formatting for currency.

← Special binary puzzle how to solve it Travel sore exploring the joy of exhausting adventures →