Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Please give the algorithm and python source code for the following questions.

ID: 3771262 • Letter: 1

Question

1. Please give the algorithm and python source code for the following questions. a. Write a program that will compute a 6% sales tax on a purchase. The user is to input the cost of the item. Compute the total sale amount at the cashier. Print the cost of the item and the total sale amount. b. Develop a program that will compute the total bill of a hospital patient. The user inputs are: 1. Number of days in the hospital 2. Surgery cost 3. Medication cost 4. Miscellaneous cost 5. Cost per day 6. Insurance deductible The program must compute and print the following for insurance purposes. 1. Total cost 2. Total cost less insurance deductible 3. Total Cost less cost of medication and deductible c. Create a program where the user selects the name of a figure and the program presents the formula that is used for calculating its area. Use rectangle and triangle as the figure choices Figure Formula for Area Rectangle Area = Width * Length Triangle Area = (Height * Base)/2 d. Develop a program that will solve for the power dissipation of a resistor when the voltage across the resistor and the current in the resistor are known. The relationship for resistor power dissipation is the following equation P = I * E Where : P = Power of dissipated in watts. I = Resistor current in amps E = Resistor voltage in volts 1. Please give the algorithm and python source code for the following questions. a. Write a program that will compute a 6% sales tax on a purchase. The user is to input the cost of the item. Compute the total sale amount at the cashier. Print the cost of the item and the total sale amount. b. Develop a program that will compute the total bill of a hospital patient. The user inputs are: 1. Number of days in the hospital 2. Surgery cost 3. Medication cost 4. Miscellaneous cost 5. Cost per day 6. Insurance deductible The program must compute and print the following for insurance purposes. 1. Total cost 2. Total cost less insurance deductible 3. Total Cost less cost of medication and deductible c. Create a program where the user selects the name of a figure and the program presents the formula that is used for calculating its area. Use rectangle and triangle as the figure choices Figure Formula for Area Rectangle Area = Width * Length Triangle Area = (Height * Base)/2 d. Develop a program that will solve for the power dissipation of a resistor when the voltage across the resistor and the current in the resistor are known. The relationship for resistor power dissipation is the following equation P = I * E Where : P = Power of dissipated in watts. I = Resistor current in amps E = Resistor voltage in volts 1. Please give the algorithm and python source code for the following questions. a. Write a program that will compute a 6% sales tax on a purchase. The user is to input the cost of the item. Compute the total sale amount at the cashier. Print the cost of the item and the total sale amount. b. Develop a program that will compute the total bill of a hospital patient. The user inputs are: 1. Number of days in the hospital 2. Surgery cost 3. Medication cost 4. Miscellaneous cost 5. Cost per day 6. Insurance deductible The program must compute and print the following for insurance purposes. 1. Total cost 2. Total cost less insurance deductible 3. Total Cost less cost of medication and deductible c. Create a program where the user selects the name of a figure and the program presents the formula that is used for calculating its area. Use rectangle and triangle as the figure choices Figure Formula for Area Rectangle Area = Width * Length Triangle Area = (Height * Base)/2 d. Develop a program that will solve for the power dissipation of a resistor when the voltage across the resistor and the current in the resistor are known. The relationship for resistor power dissipation is the following equation P = I * E Where : P = Power of dissipated in watts. I = Resistor current in amps E = Resistor voltage in volts

Explanation / Answer

def computeSalesTax(cost):
   return 0.06*cost;

def computeTotalSale(cost):
   totalSale = cost + computeSalesTax(cost)
   print "Cost: " + cost + " Total Sale: " + totalSale


def computeHospitalBill():
   totalCost = 0
   days = input()
   surgery = input()
   totalCost += surgery
   medication = input()
   totalCost += medication
   miscellaneous = input()
   totalCost += miscellaneous
   costPerDay = input()
   totalCost += costPerDay*days
   insurance = input()
   print "Total cost: " + totalCost
   print "Total cost less insurance :" + (totalCost - insurance)
   print "Total cost less cost of medication and deductible :" + (totalCost - insurance - medication)