Homework #3Question 1:Textbook Page 144, Q4.In an earlier set of exercises (Textbook Page 79, Q34, or Homework 2, Q1), you were asked to calculate ones BMI. Augment that program by print out where that BMI fits in the CDC standard weight status categories:
Question 2:Write a program that computes how much a customer has to pay after purchasing two items. The price i s calculated according to the following rules: Buy one get one half off promotion: the lower price item is half price. If the customer is club card member, additional 10% off. Tax is added.Inputs to the program include: Two items prices Have club card or not (User enters Y or y for yes; N or n for no) Tax rate (User enters the percentage as a number; for example they enter 8.25 if the tax rate is 8.25%)Program displays: Base price 6 the price before the discounts and taxes
Price after discounts 6 the price after the buy one get one half off promotion and the members discount, if applicable Total price the amount of money the customer has to pay (after tax) printed with precision of at most 2 decimal digits.Hint: In order to print a number in a specific precision, you can use the round function passing 2 arguments to it. Use help(round) to get a brief explanation of this function, and try playing with it, to better understand what it does.For example, a n execution could look like this: Enter price of first item: 10Enter price of second item: 20Does customer have a club card? (Y/N): y Enter tax rate, e .g . 5 . 5 for 5 . 5% tax: 8 . 2 5 Base price = 25.0Price after discounts = 2 2 . 5Total price = 24 . 3 6Question 3:Write a program that does the following:6 Ask user to input three floating point numbers a, b and c. They are the parameters of aquadratic equation !! ! + ! + ! = 06 Classify to one of the following:o Infinite number of solutions (for example, 0!!+0!+0=0 has infinitenumber of solutions)o No solution (for example, 0!!+0!+4=0 has no solution)o No real solution (for example, !!+4=0 has no real solutions)o One real solutiono Two real solutions6 In cases there are 1 or 2 real solutions, also print the solutions.Hint: if !0 and there are real solutions to the equation, you can get these solutions using the following formula: ! ! ! 4 !2 !The number of solutions depends on whether (b2 $4ac) is positive, zero, or negative.For example, a n execution could look like:Please enter value of a : 1 Please enter value of b : 4 Please enter value of c : 4 This equation has single real solution x=62.0
Question 4:Write a program that does the following:6 Ask user to input lengths of three sides. (You may assume that these inputs are really the sides of a triangle.)6 Classify it into one of the following:o Equilateral triangleo Isosceles right triangleo Isosceles triangle that is not a right triangleo A triangle that is not an isosceles and not an equilateralFor example, a n execution could look like: Please enter lengths of a triangles sides Length of the first side: 30Length of the second side: 3 0Length of the third side: 3 03 0, 30, 3 0 form an equilateral triangle.Extra credit:Question 5 :Extend Question 4, by also drawing the triangle using Turtle Graphics. Your program should work with any set of inputs, which means no hardwiring of lengths or angles.Hint: Use the law of cosines (https://en.wikipedia.org/wiki/Law of cosines)
Reviews
There are no reviews yet.