CS 1114 Introduction to Programming and Problem Solving Homework #3 SOLVED

\$30.00

Category:

Description

Question!1:
Textbook%Page%144,%Q4.
calculate%one’s%BMI.%Augment%that%program%by%print%out%where%that%BMI%fits%in%the%CDC%
standard%weight%status%categories:
Question!2:
The%price%is%calculated according%to%the%following%rules:
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
member’s%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,%an%execution%could%look%like%this:
Enter%price%of%first%item:%10
Enter%price%of%second%item:%20
Does%customer%have%a%club%card?%(Y/N):%y
Enter%tax%rate,%e.g.%5.5%for%5.5%%tax:%8.25
Base%price%= 25.0
Price%after%discounts = 22.5
Total%price%= 24.36
Question!3:
Write%a%program%that%does%the%following:
quadratic%equation%!!! + !” + ! = 0
6 Classify%to%one%of%the%following:%
o ’Infinite%number%of%solutions’ (for%example,%0!! + 0! + 0 = 0 has%infinite%
number%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%solution’
o ’Two%real%solutions’
6 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,%an%execution%could%look%like:
This%equation has%single%real%solution%x=62.0
Question!4:
Write%a%program%that%does%the%following:
the%sides%of%a%triangle.)
6 Classify%it%into%one%of%the%following:%
o Equilateral%triangle
o Isosceles%right%triangle
o Isosceles%triangle%that%is%not%a%right%triangle
o A%triangle that%is%not%an%isosceles%and%not an%equilateral
For%example,%an%execution%could%look%like: