Visit the TA Helpdesk (schedule posted on class website)

Similar documents
CS 1301 Pair Homework 2 Conversions Due: Monday January 27th, 2014, before 11:55pm Out of 100 points Files to submit: hw2.py

CS 1803 Individual Homework 1 Python Practice Due: Wednesday, January 26th, before 6 PM Out of 100 points

CS 1803 Pair Homework 3 Calculator Pair Fun Due: Wednesday, September 15th, before 6 PM Out of 100 points

CS 1803 Pair Homework 4 Greedy Scheduler (Part I) Due: Wednesday, September 29th, before 6 PM Out of 100 points

CS 2316 Individual Homework 4 Greedy Scheduler (Part I) Due: Wednesday, September 18th, before 11:55 PM Out of 100 points

CS 1803 Individual Homework 2 Conditionals & Loops Due: Wednesday, September 8th, before 6 PM Out of 100 points

CS 1301 Pair Homework 4 Conditionals & Loops Due: Friday, October 1, before 6 PM Out of 100 points

Ascii Art. CS 1301 Individual Homework 7 Ascii Art Due: Monday April 4 th, before 11:55pm Out of 100 points

CS 1301 Homework Robot Web Writer

CS 1803 Individual Homework 2 Conditionals & Loops Due: Wednesday, February 2 nd, before 6 PM Out of 100 points

CS 1301 Individual Homework 3 Conditionals & Loops Due: Monday February 8 th before 11:55pm Out of 100 points

CS 2316 Individual Homework 1 Python Practice Due: Wednesday, January 20 th, before 11:55 PM Out of 100 points

CS 1803 Pair Homework 10 Newsvendor Inventory Policy Due: Monday, November 29th before 6:00 PM Out of 100 points

CS 2316 Individual Homework 1 Python Practice Due: Wednesday, August 28th, before 11:55 PM Out of 100 points

CS 2316 Individual Homework 5 Joint Probability Out of 100 points

CS Homework 4 Lifeguard Employee Ranker. Due: Tuesday, June 3rd, before 11:55 PM Out of 100 points. Files to submit: 1. HW4.py.

Geometric Probabiltiy

CS 2316 Homework 9a Login Due: Friday, November 2nd, before 11:55 PM Out of 100 points. Premise

CS 2316 Pair 1: Homework 3 Enigma Fun Due: Wednesday, February 1st, before 11:55 PM Out of 100 points

CS Homework 4 Employee Ranker. Due: Wednesday, February 8th, before 11:55 PM Out of 100 points. Files to submit: 1. HW4.py.

CS 2316 Homework 9a GT Pizza Login Due: Wednesday November 6th Out of 100 points. Premise

GENERAL MATH FOR PASSING

REVIEW FOR BASIC MATH SKILLS FINAL EXAM (December 2008) (Basic 4-Function, 10-Key Calculator Allowed No Scientific or Graphing Calculators)

Advanced Algebra I Simplifying Expressions

1.1 Metric Systems. Learning Target: to practice converting between different metric units. Main Ideas:

Simplifying Expressions

CS 2316 Homework 9a GT Room Reservation Login

Functional Programming, Classes, and Recursion!

, 6.7,, Order the numbers from least to greatest. 1. 1, 0, 2, 5, 4. Simplify the expression. 10.

CS 2316 Homework 9b GT Thrift Shop Due: Wednesday, April 20 th, before 11:55 PM Out of 100 points. Premise

Mathematical Reasoning. Lesson 47: Prisms and Cylinders. LESSON 47: Prisms and Cylinders. D. Legault, Minnesota Literacy Council,

Individual Homework- Create Your Own Password! Due: September 15 th, 2014 Before 11:55PM Out of 100 points

CMSC 201 Fall 2016 Homework 6 Functions

This homework has an opportunity for substantial extra credit, which is described at the end of this document.

CS 2316 Homework 9b GT Room Reservation

Number Sense. I CAN DO THIS! Third Grade Mathematics Name. Problems or Examples. 1.1 I can count, read, and write whole numbers to 10,000.

Seventh Grade Spiraling Review Week 1 of First Six Weeks

ISLEWORTH & SYON BOYS SCHOOL

Woodland Community College: Math practice Test

Algebra I EOC Packet #

8 th Grade Math STAAR Review

Summer Math Learning Packet for Students Entering. Grade 6. SFTitle I

For full credit, show all work.

April 25, Lesson 8.2B

Is the product of two integers positive, negative, or zero? How can you tell? ACTIVITY: Multiplying Integers with the Same Sign

Page 3 GO ON. 1 The visual representation describes the relationships between the sets and subsets of numbers.

Table of Contents. Student Practice Pages. Number Lines and Operations Numbers. Inverse Operations and Checking Answers... 40

Office 2016 Excel Basics 09 Video/Class Project #21 Excel Basics 9: Number Formatting and the ROUND Function

Math 7 Honors Final Exam Review #6

REVIEW OF 6 TH GRADE

Math 7 Accelerated Summer Review

For the test, be sure to show all work! PROBLEMS: ANSWERS: For problems 1 9, simplify the expression ( ) Evaluate if x = -2 and y = 1 8.

Adding and Subtracting All Sorts of Numbers

Math 135: Intermediate Algebra Homework 10 Solutions December 18, 2007

mm. What is the length of the radius to

Large & Small Numbers

1.0 Fractions Review Name: Date: Goal: to review some key fractions skills in preparation for the upcoming unit. Main Ideas: b)!!

CS 141, Lecture 3. Please login to the Math/Programming profile, and look for IDLE (3.4 or the unnumbered. <-- fine <-- fine <-- broken

Lesson Plan -- Adding and Subtracting Integers

Scarsdale Middle School Popham House Mr. Weiss

Unit 9 Tech savvy? Tech support. 1 I have no idea why... Lesson A. A Unscramble the questions. Do you know which battery I should buy?

Skills Practice Skills Practice for Lesson 6.1

STAAR Category 3 Grade 8 Mathematics TEKS 8.6A/8.6B/8.7A. Student Activity 1

Unit 3, Activity 1, Vocabulary Self-Awareness Chart

A theme park charges $12 entry to visitors. Find the money taken if 1296 people visit the park.

February 8 th February 12 th. Unit 6: Polynomials & Introduction to Quadratics

Assignment 3: Distance COP3330 Fall 2017

LESSON 5 - DECIMALS INTRODUCTION

Math A Regents Exam 0102 Page 1

Coached Instruction Supplement

Topic 2: Decimals. Topic 1 Integers. Topic 2 Decimals. Topic 3 Fractions. Topic 4 Ratios. Topic 5 Percentages. Topic 6 Algebra

2500( ) ( ) ( ) 3

Problem 1.1 (3 pts) :Python uses atomic data types and builds up from there. Give an example of: a. an int b. a double c. a string

6.S189 Homework 2. What to turn in. Exercise 3.1 Defining A Function. Exercise 3.2 Math Module.

Study Guide for Exam 2

Assignment 1 Expressions Data Types Formatted Printing Variables Scanning CSC 123 Fall 2018 Answer Sheet Short Answers

Radicals and Rational Exponents

Chapter 1 Operations With Numbers

Study Guide and Review - Chapter 1

CS1 Lecture 5 Jan. 25, 2019

Extreme Computing. Introduction to MapReduce. Cluster Outline Map Reduce

MATH Ms. Becker

Math 111: Midterm 1 Review

Warm-up for Foundations of Precalculus

REPRESENTING ALGORITHMS. REPRESENTING ALGORITHMS IB DP Computer science Standard Level ICS3U

Family Literacy. readers. Easy Algebra Reading Practice

Intermediate Mathematics League of Eastern Massachusetts

Accelerated Algebra I Final Review Linear and Exponential Functions 1. If f (x) = 3x 5 and the domain of f is {2, 4, 6}, what is the range of f (x)?

Chapter 5 DECIMAL NOTATION

loose-leaf paper Name: Class: Date: Multiple Choice Identify the choice that best completes the statement or answers the question.

Associative Property of Addition. Associative Property of Multiplication and 1

CMSC 201 Spring 2016 Homework 7 Strings and File I/O

3.4 Equivalent Forms of Rational Numbers: Fractions, Decimals, Percents, and Scientific Notation

SENIOR HIGH MATH LEAGUE April 24, GROUP IV Emphasis on TRIGONOMETRY

MATH 099 HOMEWORK TWO

1-2 Order of Operations. Evaluate each expression SOLUTION: ANSWER: SOLUTION: ANSWER: SOLUTION: ANSWER: 243

Eighth Grade Mathematics 2017 Released Items Analysis

Homework: More Abstraction, Trees, and Lists

Math 7 Notes Unit Three: Applying Rational Numbers

Monday 3/26 Problems due on Tues 4/3

Transcription:

CS 1301 Pair Homework 2 Conversions Due: Monday September 8th, before 11:55pm Out of 100 points Files to submit: hw2.py You will be writing several functions, but they will all be saved in one file: hw2.py. Please save all of the functions in this one file or you will lose points. This is a pair programming problem! You are expected to work with the person you have been pared with in class, and you are both responsible for submitting the exact same code to T-Square. Your pair may collaborate with other students in this class. Collaboration means talking through problems, assisting with debugging, explaining a concept, etc. You should not exchange code or write code for other pairs. Collaboration at a reasonable level will not result in substantially similar code. For pair programming assignments, you and your partner should turn in identical assignments with both your names at the top. NOTE: EACH partner is responsible for turning in their own assignment! If you fail to turn in your assignment, you will receive a zero, regardless of if your partner turned in their assignment or not. For Help: Visit the TA Helpdesk (schedule posted on class website) Email your TAs Notes: Do not forget to include the required comments and collaboration statement (as outlined on the course syllabus). Do not wait until the last minute to do this assignment in case you run into problems. If you find a significant error in the homework assignment, please let a TA know immediately.

Conversions/Calculations (100 Points) Section A - Queso For Fishy (10 points) You are throwing a very big fifth birthday party for your amazingly resilient goldfish. To help celebrate, you want to spend your life s savings on queso dip. Write a function called quesoforfishy() that accepts one parameter which is a number representing the dollar amount of your bank account balance. Have the function return an integer representing the maximum number of queso jars you can purchase if each one costs $2.98 and you do not exceed your bank account balance. You may ignore tax. >>> a = quesoforfishy(6) 2 >>> b = quesoforfishy(6.32) >>> print( b ) 2 >>> c = quesoforfishy(1234) >>> print( c ) 414 Section B - Mailboxes (1) Studies have shown that hitting a mailbox at speeds over 30 MPH can shorten the lifespan of your car by anywhere from 2 to 6 months (not really). As a chronically bad driver, you are concerned about how much longer you have with you car. Write a function called mailboxes() that accepts one parameter which is an integer representing the number of mailboxes you have hit in your car. The function should then print the number of mailboxes you have hit, the least amount of months you could have removed from the lifespan of your car and the most amount of months based on the statistic. >>> mailboxes(1) Because you have run into 1 mailbox(es), your car's life has been shortened by anywhere from 2 to 6 months. >>> mailboxes(5) Because you have run into 5 mailbox(es), your car's life has been shortened by anywhere from 10 to 30 months.

Section C - Concert Ticket (1) You would like to go to a Taylor Swift concert, but first you want to calculate how many hours you will need to work to pay for the ticket. Write a function called concertticket() that gets input from the user asking for the ticket price and also gets input from the user for their hourly rate. The function should then print the number of hours of work needed to earn the ticket amount. The number should be rounded to two decimal places. >>> concertticket() <enter 123 for the cost> <enter 7.50 for the hourly rate> You need to work 16.40 hours to buy your ticket Section D - Boring Interlude (1) You re getting tired of all of these hypothetical scenarios. Write a function called boringinterlude() that calculates the volume of a sphere. It should take in a float representing the radius of the sphere in inches. It should return the volume of the sphere in cubic feet as a float. Remember the volume of a sphere is as follows: (4 / 3) * π * r 3. Hint: Use math.pi for π. Don t forget to import math. >>> a = boringinterlude(12) 4.1887902047863905 >>> b = boringinterlude(324.123) >>> print( b ) 82541.892315010977

Section E - Traffic Jam (1) You re sitting in a traffic jam and you would like to know how many cars are in front of you at any given time. Write a function (not while you re in traffic, though) called trafficjam() that accepts two parameters. One should accept an integer representing the number of lanes, and the other should accept a float representing the number of miles of traffic in front of you. The function should return a float representing the number of cars in the traffic jam in front of you. Assume that each car takes up 15 feet total. You may assume the number of lanes does not change. Hint: There are 5,280 feet in a mile. >>> a = trafficjam(4, 1) 1408.0 >>> b = trafficjam( 3, 3.12 ) >>> print( b ) 3294.7200000000007 Section F - Time Left (1) You are lost in the dark with a single rechargeable flashlight that is running out of battery power. Naturally, to calm your nerves, you write Python functions in your head. Write a function called timeleft() that accepts a single parameter which is an integer representing the amount of time that you have used your flashlight in minutes. The function should then get input from the user asking for the number of hours that the flashlight battery lasts (this could be a float). The function should print an integer representing the percentage of the battery left (you can round down). The function should also return a float representing the number of minutes left before the battery dies. >>> a = timeleft(30) <enter 8 for length of time the battery lasts> 93 450.0

Section G - Daffodils (1) Your neighbor is upset with you after you kept running over his mailbox, and now he wants you to replant some flowers that he had towards the front of his yard. His favorite color daffodils only come in groups of 12, so you will probably have some extras. Write a function called daffodils() that accepts the following parameters: an integer representing the number of flowers he needs planted, a float representing the price your neighbor is willing to contribute towards the flowers, and a float representing the price of 12 flowers. The function should print a sentence containing a float rounded to two decimal places that represents the amount of money you will have to contribute to the flowers yourself (negative values are fine). Hint: You may find the math.ceil() function extremely useful for this problem. It will round a number up to the nearest integer. Don t forget to import math before using math.ceil(). Example: >>> math.ceil(4.1) 5.0 Sample Outputs: >>> daffodils(20, 5.0, 10.0) You will need to contribute $15.00. >>> daffodils(37, 3.0, 8.0) You will need to contribute $29.00. >>> daffodils(37.5, 35.32, 8.34) You will need to contribute $-1.96.

Rubric: Conversions/Calculations (100 Points) quesoforfishy() - 10 points Function named correctly (quesoforfishy) Returns the correct result mailboxes() - 1 Function named correctly (mailboxes) Prints properly concertticket() - 1 Function named correctly (concertticket) Prints properly boringinterlude() - 1 Function named correctly (boringinterlude) Returns result properly trafficjam() - 1 Function named correctly (trafficjam) Returns result properly timeleft() - 1 Function named correctly (timeleft) Properly handles a parameters and inputs Both prints and returns correct values and types daffodils() - 1 Function named correctly (daffodils) Uses three parameters Prints properly with correct value