Home HTML →True Basic →Chapter 1 →Chapter 1_2 →Chapter 2 →Chapter 3 →Chapter 4 →Chapter 5 →Linear Functions Program Article Reviews |
!Jeremy Fallick !September 27, 2004 !Period 6 !Chapter 2, Problem 1 input prompt "Degrees Fahrenheit:":Fahrenheit let Fahrenheit_minus_32=Fahrenheit-32 let Celsius=5*Fahrenheit_minus_32/9 print "If the temperature is"; Fahrenheit; "degrees Fahrenheit," print "it is"; Celsius; "degrees Celsius." end !Jeremy Fallick !September 27, 2004 !Period 6 !Chapter 2, Problem 2 input prompt "Number of feet:":feet input prompt "Number of inches:":inches let feet_to_inches=feet*12 let centimeters=inches*2.54+feet_to_inches*2.54 print feet; "feet and"; inches; "inches equals"; centimeters; "centimeters." end !Jeremy Fallick !September 27, 2004 !Period 6 !Chapter 2, Problem 3 input prompt "Salesman's monthly sales:": sales data 10 read percent_rate let rate=percent_rate*.01 let commission=sales*rate print "If a salesman has $"; sales; "of monthly sales, and a commission rate of"; percent_rate; "%, her total commission would be $"; commission; "." end !Jeremy Fallick !September 27, 2004 !Period 6 !Chapter 2, Problem 4 input prompt "List price:":list_price input prompt "% of discount:":percent_discount let discount=percent_discount*.01 let sale_price=list_price-(discount*list_price) print "If the list price is $"; list_price; "and the percentage of discount is"; percent_discount; "%, then the discount is $"; discount; "and the sale price is $"; sale price; "." end !Jeremy Fallick !September 27, 2004 !Period 6 !Chapter 2, Problem 5 data "Emily", 92, 100 read student$, test1, test2 let average=(test1+test2)/2 print "If "; student$; " has a score of"; test1; "and a score of"; test2; ", then she has an average score of"; average; "." end !Jeremy Fallick !September 27, 2004 !Period 6 !Chapter 2, Problem 6 input prompt "Amount of the loan:":loan input prompt "Annual interest rate percentage:":percent_rate input prompt "Number of monthly payments:":number let rate=percent_rate/1200 let payment=loan*rate*(1+rate)^number/((1+rate)^number-1) print "If the loan is $"; loan; print ", the interest rate is"; percent_rate; print "%, and the number of monthly payments is"; number; print ", then the monthly payment is $"; payment; "." end !Jeremy Fallick !September 27, 2004 !Period 6 !Chapter 2, Problem 7 input prompt "Name of product:":product$ input prompt "Price of product:":price input prompt "Weight in pounds:":pounds input prompt "Weight in ounces:":ounces let pounds_to_ounces=pounds*16 let total_ounces=ounces+pounds_to_ounces let unit_price=price/total_ounces print product$; "costs $"; price; print ", weighs"; pounds; "pounds and"; ounces; print "ounces, and has a unit price of $"; unit_price; "." end !Jeremy Fallick !September 27, 2004 !Period 6 !Chapter 2, Problem 8 input prompt "Name of product:":product$ input prompt "List price of product:":price input prompt "Weight in pounds:":pounds input prompt "Weight in ounces:":ounces let pounds_to_ounces=pounds*16 let total_ounces=ounces+pounds_to_ounces let sale_price=price-(price*.15) let unit_price=sale_price/total_ounces print product$; "costs $"; sale_price; print ", weighs"; pounds; "pounds and"; ounces; print "ounces, and has a unit price of $"; unit_price; "." end !Jeremy Fallick !September 27, 2004 !Period 6 !Chapter 2, Problem 9 input prompt "Employee name:":name$ input prompt "ID number:":ID_number input prompt "Hours worked:":hours input prompt "Overtime hours worked:":overtime input prompt "Pay rate per hour:":rate let gross_pay=(hours*rate)+(overtime*(1.5*rate)) print name$; " has ID number"; ID_number; print ", has worked"; hours; print "hours, has worked"; overtime; print "overtime hours, has a pay rate of $"; rate; print ", and has a gross pay of $"; gross_pay; "." end !Jeremy Fallick !September 27, 2004 !Period 6 !Chapter 2, Problem 10 input prompt "Employee name:":name$ input prompt "ID number:":ID_number input prompt "Hours worked:":hours input prompt "Overtime hours worked:":overtime input prompt "Pay rate per hour:":rate let gross_pay=(hours*rate)+(overtime*(1.5*rate)) let net_pay=gross_pay-(gross_pay*.3)-10 print name$; " has ID number"; ID_number; print ", has worked"; hours; print "hours, has worked"; overtime; print "overtime hours, has a pay rate of $"; rate; print ", has a gross pay of $"; gross_pay; print ", and has a net pay of $"; net_pay; "." end !Jeremy Fallick !September 27, 2004 !Period 6 !Chapter 2, Problem 11 input prompt "Sharon's Game 1:":Sharon_1 input prompt "Sharon's Game 2:":Sharon_2 input prompt "Sharon's Game 3:":Sharon_3 input prompt "Judy's Game 1:":Judy_1 input prompt "Judy's Game 2:":Judy_2 input prompt "Judy's Game 3:":Judy_3 let Sharon_average=(Sharon_1+Sharon_2+Sharon_3)/3 let Judy_average=(Judy_1+Judy_2+Judy_3)/3 let total=Sharon_1+Sharon_2+Sharon_3+Judy_1+Judy_2+Judy_3 print "If Sharon's scores are"; Sharon_1; ","; Sharon_2; ", and"; Sharon_3; "," print "and Judy's scores are"; Judy_1; ","; Judy_2; ", and"; Judy_3; "," print "then Sharon's average is"; Sharon_average; "and Judy's average is"; Judy_average; "," print "and the team score is"; total; "." end !Jeremy Fallick !September 27, 2004 !Period 6 !Chapter 2, Problem 12 data "Pandas", 11,0 read team$, wins, losses let percent=wins/(wins+losses) print team$, wins, losses, percent data "Unicorns", 6,6 read team$, wins, losses let percent=wins/(wins+losses) print team$, wins, losses, percent data "Pterpdactyls", 4,6 read team$, wins, losses let percent=wins/(wins+losses) print team$, wins, losses, percent data "White Sox", 0,9 read team$, wins, losses let percent=wins/(wins+losses) print team$, wins, losses, percent end |