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

Similar documents
Visit the TA Helpdesk (schedule posted on class website)

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

CS 1803 Individual Homework 1 Python Practice Due: Wednesday, January 26th, 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 1803 Individual Homework 2 Conditionals & Loops Due: Wednesday, February 2 nd, 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 1301 Homework Robot Web Writer

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 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, January 20 th, before 11:55 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 1301 Individual Homework 3 Conditionals & Loops Due: Monday February 8 th before 11:55pm Out of 100 points

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

CS 2316 Individual Homework 5 Joint Probability Out of 100 points

CMSC 201 Fall 2016 Homework 6 Functions

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

CS 2316 Homework 9b GT Thrift Shop Due: Wednesday, April 20 th, 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 2316 Homework 9a GT Room Reservation Login

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

CS 2316 Homework 9b GT Room Reservation

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

Coached Instruction Supplement

Functional Programming, Classes, and Recursion!

ROUNDING ERRORS LAB 1. OBJECTIVE 2. INTRODUCTION

IMPORTANT WORDS AND WHAT THEY MEAN

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

3-1 Writing Linear Equations

Welcome to Introduction to Microsoft Excel 2010

Seventh Grade Spiraling Review Week 1 of First Six Weeks

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?

Simplifying Expressions

Attract Connect Grow!

Math 6 Notes Unit 03 Notes: Decimals

Alg. 1 Unit 3 Notes Unit 3 Day 1: Represent Relations and Functions (O.C. 1-5)

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

IAE Professional s (02)

Algebraic Reasoning. Participant Materials

Geometric Sequences 6.7. ACTIVITY: Describing Calculator Patterns. How are geometric sequences used to. describe patterns?

1. Expand and simplify: 9. Determine the area of the triangle. a. 5 b. 2. Simplify: a. ( 3) c. ( 2) d. 4 ( 2) 3. e ( 3) ( 5)

CMSC 201 Spring 2019 Lab 06 Lists

Adding Integers with the Same Sign

TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA

2.Simplification & Approximation

Math 7 Notes Unit Three: Applying Rational Numbers

Chapter 1 Operations With Numbers

Full file at Google Unit A: Getting Started with Google

Revision on fractions and decimals

360 right angle, 90. Types of Angles

The Copywriting Snapshot Amy Harrison

Page 1 CCM6+ Unit 10 Graphing UNIT 10 COORDINATE PLANE. CCM Name: Math Teacher: Projected Test Date:

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

Advanced Algebra I Simplifying Expressions

Number skills. Jemma Michael. This chapter will revise your skills in working with whole numbers, fractions and decimals.

CS1100: Excel Lab 1. Problem 1 (25 Points) Filtering and Summarizing Data

News English.com Ready-to-use ESL / EFL Lessons 2005 was a second longer than usual

Roberto Clemente Middle School

Digital Media. Seasons Assignment. 1. Copy and open the file seasonsbegin.fla from the Read folder.

2015 ICPC. Northeast North America Preliminary

Homework: More Abstraction, Trees, and Lists

Guide to Newbury Building Society s Online Intermediary Service

Algebra II Honors Summer Packet Summer 2017

Tips from the experts: How to waste a lot of time on this assignment

1 of 49 11/30/2017, 2:17 PM

CS1 Lecture 5 Jan. 25, 2019

7 th Pre-AP REVIEW for TEST1 1 st Six Weeks

PA3: Violet's Vending Venture (Version 3.0)

2-2 Adding Integers. Warm Up Problem of the Day Lesson Presentation Lesson Quizzes

Understanding the U.S. Banking System

Family Literacy. readers. Easy Algebra Reading Practice

MATH 099 HOMEWORK TWO

Using your DVUSD ipad. What to Do When You First Get Your ipad How to Set Up Expectations ipad Care What if?

Programming Assignment #3 Event Driven Simulation

Floating Point Arithmetic

Welcome to Lab! Feel free to get started until we start talking! The lab document is located on the course website:

CMSC 201 Spring 2018 Project 3 Minesweeper

WHOLE NUMBERS AND DECIMALS

CMSC 201 Spring 2017 Project 1 Number Classifier

Managing Groups Using InFellowship. A guide for Small Group Leaders

LESSON 5 - DECIMALS INTRODUCTION

4. Java Project Design, Input Methods

Grade 5 STAAR Review Station Reflection Templates

Com S 127x - Lab 6 1. READING FLOWCHARTS WITH CONDITIONAL ACTIONS!

Note: This is a miniassignment and the grading is automated. If you do not submit it correctly, you will receive at most half credit.

6.1 Evaluate Roots and Rational Exponents

Digital Citizenship. Student Packet Grades K-2 UNIT

Integrated Math 1 Module 3 Honors Sequences and Series Ready, Set, Go! Homework

CS Name : Grading TA:

CMSC 201 Spring 2018 Project 2 Battleship

BASIC MATH CONTENTS. Section 1... Whole Number Review. Section 2... Decimal Review. Section 3... Fraction Review. Section 4...

Math 152: Applicable Mathematics and Computing

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

Unit 2: Functions, Equations, & Graphs of Degree One

Welcome to CS61A! Last modified: Thu Jan 23 03:58: CS61A: Lecture #1 1

How To Make $100 Per Day Just Collecting s & Promoting Digital Offers

More About WHILE Loops

WHOLE NUMBER AND DECIMAL OPERATIONS

Lesson 1A - First Java Program HELLO WORLD With DEBUGGING examples. By John B. Owen All rights reserved 2011, revised 2015

Transcription:

CS 1301 Pair Homework 2 Conversions Due: Monday January 27th, 2014, 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. For Help: - TA Helpdesk Schedule posted on class website. - Email TAs Notes: Don t 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.

Part 1 - Conversions/Magic (50 points) Section A - Currency (1) You are an investor who after following Bloomberg for 5 years decided that it would be a good idea to invest in Moroccan Dirhams. You would like to know how much Dirhams you would get in exchange for your life savings. You will write a function called currency() which takes in a value in Dollars and converts the value to Dirhams. For reference, 0.27 Dollars gives you 1 Dirham. Please return the value. Your answer doesn t need to be exactly 2 decimal places for this problem. Sample Output: >>>a = currency(25) >>> print(a) 92.59 >>>b = currency(10) >>>print(b) 37.04 Section B - Puppies (1) You were the lucky winner of magical seeds that grow into puppies. You are really excited, however, you have limited space to keep puppies. Therefore, you wish to know how many puppies a certain amount of magical seeds will grow. You know that one seed can grow 2 puppies at a minimum and 5 at a maximum. Make a function that accepts an integer (number of magical seeds) as a parameter and that will print the minimum and maximum amount of puppies you could get. Remember that your answer values must be integers, not floats. Sample Output: >>> puppies(5) You can get a minimum of 10 puppies and a maximum of 25 puppies with 5 magical seeds. >>> puppies(8) You can get a minimum of 16 puppies and a maximum of 40 puppies with 8 magical seeds.

Section C - Making Tea(20 points) You and your friends need to help your grandma with her tea party. She has told you what tea is her favorite and will later tell you how many people will be joining her. Your job is to make sure to buy enough tea for her party. You know that 1 ounce of tea leaves can make 3 cups of tea and each person drinks only 1 cup of tea. Write a function called teaparty() that will take in the number of people your grandma will invite and prints out the number of ounces you should buy. Make sure to format your answer with only 3 digits after the decimal point. Sample output: >>>teaparty(4) You should buy 1.333 ounces of tea. >>>teaparty(7) You should buy 2.333 ounces of tea. Part 2 - Complex Functions (50 points) Section A - Sale! (2) The gaming world has gone mad and a global sale has been made on all your favorite games. You are absolutely thrilled to get your hands on a few new titles, but you must first make sure to pay off your rent and food. You know you use 20% of your monthly income in food and 35% on rent. Your job is to make a function named moneyleft() that will take as a parameter your monthly income and will print how much money you have left to spend after paying rent and food. Remember to format your answer to exactly 2 digits after the decimal point. Sample output: >>>moneyleft(425) You have 191.25 dollars left to spend. >>>moneyleft(533.56) You have 240.10 dollars left to spend. Section B - Prepare for Liftoff! (2) Congratulations! You have been selected to take a ride on the International Space Station! You do not know how many orbits you will remain in space for, but you know that it will be at least a few days. In order to keep yourself from

dying of boredom, you have been allowed to bring your ipad with you. The problem is, you need to bring extra batteries with you for the ride. By doing some quick research, you learn that it takes the ISS 1.51659999913 hours to complete one orbit around the Earth. You know from experience that your ipad battery lasts 9 hours before it needs to be replaced. Write a function called batteriescalculator() that calculates how many batteries you will need to bring along for the ride using the given conversion rates. The function needs to take an input from the user asking how many orbits they will be in space. Your function should print the number of batteries needed twice. For the first time, the number should not be rounded and should be printed by itself. For the second time, the number should be rounded, not be a floating point number (no decimal points) and included printed out in a sentence (see sample interaction). Your function should also return the rounded number of batteries. You are expected to round the number of batteries to the next integer by use of the math.ceil() function. Basically, math.ceil() always rounds the number up to the next integer. Do not forget to import math when using functions from the math module! For example: >>> math.ceil(4.51) 5.0 >>> math.ceil(6.7) 7.0 >>> math.ceil(3.2) 4.0 Sample interaction: >>>c = batteriescalculator() >>>print(c) Enter 100 for the amount of orbits... Output should be: 16.8511111014 You will need to bring 17 batteries to last 100 orbits. 17

Rubric Part 1 - Conversions/Magic (50 points) currency() - 1 Function named correctly (currency) Performs correct conversion (float division) Returns the value puppies() -1 Function named correctly (puppies) Performs correct conversion (multiplication) Prints correct statement with integers teaparty() - 20 points Function named correctly (teaparty) Performs correct conversion Value has exactly 3 decimal places Prints correct statement statement Part 2 - Complex Functions (50 points) moneyleft() - 2 Deals correctly with float input It correctly performs the conversion Answer has exactly 2 decimal places Prints the correct statement batteriescalculator() - 2 It correctly asks for user input Correctly imports math and uses math.ceil() Performs the correct conversion 10 points Correctly prints both the float value and the statement Returns the rounded value