CIT 590 Homework 6 Fractions
|
|
- Marybeth Taylor
- 6 years ago
- Views:
Transcription
1 CIT 590 Homework 6 Fractions Purposes of this assignment: Get you started in Java and Eclipse Get you comfortable using objects in Java Start looking at some common object uses in Java. General Idea of the Assignment In this assignment, you will implement two Java classes, Fraction.java and FractionCalculator.java. Create a project Fraction and within it a package called fraction. Your classes, Fraction and FractionCalculator, will be within this package. The Fraction API Your task will be to implement the API (Application Programmer s Interface) and write a small program that uses it. The API is basically a collection of all methods defined in a given class if another programmer would like to use the class, they have to refer to the API to see what methods are available. In other words, Fraction isn't a program in itself; it is designed to be used by programmers who, for whatever reason, need to use fractions in their programs. This means Fraction.java should have no main method. The main method will be in FractionCalculator.java. The following lists some information about your Fraction class. Instance Variables How printed Restrictions Normalization Two private integers, known as the numerator and the denominator. n/d, where n is the numerator and d is the denominator. This is achieved in the tostring() method defined below. The denominator may not be zero. The fraction is always kept in the lowest terms, that is, the Greatest Common Divisor (GCD) of n and d is 1 (use Euclid's algorithm you can look this up; I also showed an example in the Python overview lecture). The denominator is never negative. (You can give a negative number for
2 the denominator to the constructor when you create the fraction, but a negative fraction should be represented internally with a negative numerator.) Represent zero as 0/1. You should have the following constructors. public Fraction(int numberator, int denominator) public Fraction(int wholenumber) Parameters are the numerator and the denominator. Normalize the fraction as you create it. For instance, if the parameters are (8, -12), create a Fraction with numerator -2 and denominator 3. The parameter is the numerator, and denominator is implicitly 1. The parameter is a String such as "5/ -10", or "2" (allow blanks around the integers, but not within). public Fraction(String fraction) You can use split("/") to get the two parts, then trim() both parts, then use Integer.parseInt(part) to convert each part from type String to type int. Note that Java allows you to have more than one constructor, so long as they have different numbers or types of parameters. For example, if you call new Fraction(3) you will get the second constructor listed above. Fractions should be constructed in normalized form. For example, if the user says new Fraction(6, 8), the fraction should be created with a numerator of 3 and a denominator of 4 (not 6 and 8). Similarly, if the user says new Fraction(1, -3), the fraction should be created with a numerator of -1 and a denominator of 3 (not 1 and -3). Finally, you should implement the following methods. Public Fraction add(fraction f) public Fraction subtract(fraction f) the sum of this and that: a/b + c/d is (ad + bc)/bd the difference of this minus that:
3 a/b - c/d is (ad - bc)/bd public Fraction multiply(fraction f) public Fraction divide(fraction f) public Fraction abs() public Fraction negate() public Fraction inverse() public int compareto(fraction f) public String tostring() the product of this minus that: (a/b) * (c/d) is (a*c)/(b*d) the quotient of this minus that: (a/b) / (c/d) is (a*d)/(b*c) the absolute value of this fraction. Returns a new Fraction that has the same numeric value as this fraction but the opposite sign. Inverse of a/b is b/a. Any negative int if this is less than f. Zero if this is equal to f. Any positive int if this is greater than f. Returns a String of the form n/d, unless d is 1, in which case it returns just n. Notes Fractions should be immutable, that is, there should be no way to change their components after the numbers have been created. Most of your methods simply return a new number. One way to achieve this is to keep instance variables private (without any methods available to modify them). Depending on how fast we go, we may not cover the tostring() method before the assignment is due. All you need to know for this assignment is that it is defined as shown above and that it is called internally when you want to print an object. For example, the following two print statements will print the same thing: Fraction f = new Fraction(6,11); System.out.println(f); System.out.println(f.toString());
4 We haven t covered unit testing in Java yet, so for this assignment you are not required to submit any test files. However, for your own benefit (and to make sure your program is correct) you should still write some tests. To test your files, you can write a FractionTest.java file. This file should contain a public static void main(string[] args) method to test your methods. You should not submit this file. The FractionCalculator Write a FractionCalculator class (containing a main method) that does calculations with Fractions. The first thing this program does is print a zero (indicating the current contents of the calculator), and a prompt (print some message to the user). It then accepts commands from the user, and after each command, prints the result, and a new prompt. It should accept exactly the following commands, and nothing else: a To take the absolute value of the number currently displayed. c To clear (reset to zero) the calculator. i To invert the number currently displayed. s n To discard the number currently displayed and replace it with n. q To quit the program. + n To add n to the number currently displayed. - n To subtract n from the number currently displayed. * n To multiply the number currently displayed by n. / n To divide the number currently displayed by n. In each case, the user may enter either a whole number or a fraction for n. Fractions may be written with or without spaces, as for example 27 / 99 or 27/99. You can require that there be no space after a unary minus, so for example -3 is legal, but - 3 is not. You don't have to handle unary +, i.e., assume + if always followed by a fraction (and space). You can require at least one space after the initial +, -, *, /, or s; for example a - -3/5 is legal, but --3/5 is not. If the user enters a different command than the ones defined above, your program should not crash. Instead, the program should print a short error message and keep running. Illegal input should not affect the state of the computation. You can assume that fractions are well formatted, i.e., in any command that contains a fraction you can just parse the fraction assuming that it is indeed a fraction (though you need to handle the case where the fraction is a whole number). In other words, you don t need to worry about checking whether the string contains a fraction (which requires exception handling in java, and we haven t covered that yet). You will need to use the Scanner. You can find a description (skip over the confusing details) in the Scanner page in the Java API. Recommendation: Just use the Scanner's nextline() method, and use String methods to work with the input. Some useful methods are trim(), length(),
5 and substring(beginindex). I found this somewhat easier that working with the Scanner methods to read the input in smaller pieces. Submission and Due Date Zip your Eclipse project and turn it in to Canvas before 11:59pm Tuesday, October 31.
Recitation #2 Abstract Data Types, Collection Classes, and Linked List
Recitation #2 Abstract Data Types, Collection Classes, and Linked List (1) Create an ADT Fraction that describes properties of fractions. Include the constructor, setter, getter, and tostring() methods
More informationObject Oriented Design: Building a Fraction Class
Object Oriented Design: Building a Fraction Class http://www.zazzle.com/fraction+tshirts Fundamentals of Computer Science Outline Object oriented techniques Constructors Methods that take another object
More informationCreating a new data type
Appendix B Creating a new data type Object-oriented programming languages allow programmers to create new data types that behave much like built-in data types. We will explore this capability by building
More informationCarleton University Department of Systems and Computer Engineering SYSC Foundations of Imperative Programming - Winter Lab 8 - Structures
Carleton University Department of Systems and Computer Engineering SYSC 2006 - Foundations of Imperative Programming - Winter 2012 Lab 8 - Structures Objective To write functions that manipulate structures.
More informationA Fraction Class. Using a Fraction class, we can compute the above as: Assignment Objectives
A Fraction Class Assignment Objectives What to Submit Evaluation Individual Work Write a Fraction class that performs exact fraction arithmetic. 1. Practice fundamental methods like equals, tostring, and
More informationRules of Exponents Part 1[Algebra 1](In Class Version).notebook. August 22, 2017 WARM UP. Simplify using order of operations. SOLUTION.
WARM UP Simplify using order of operations. Aug 22 3:22 PM 1 Aug 22 4:09 PM 2 WARM UP a) The equation 3(4x) = (4x)3 illustrates which property? b) Which property of real numbers is illustrated by the equation
More informationCS 101 Fall 2006 Midterm 3 Name: ID:
You only need to write your name and e-mail ID on the first page. This exam is CLOSED text book, closed-notes, closed-calculator, closed-neighbor, etc. Questions are worth different amounts, so be sure
More informationRational numbers as decimals and as integer fractions
Rational numbers as decimals and as integer fractions Given a rational number expressed as an integer fraction reduced to the lowest terms, the quotient of that fraction will be: an integer, if the denominator
More informationChapter 4 Section 2 Operations on Decimals
Chapter 4 Section 2 Operations on Decimals Addition and subtraction of decimals To add decimals, write the numbers so that the decimal points are on a vertical line. Add as you would with whole numbers.
More informationcoe318 Lab 2 ComplexNumber objects
Objectives Overview coe318 Lab 2 objects Implement a class. Learn how immutable objects work. Week of September 15, 2014 Create a project with more than one class. Duration: one week. In mathematics, complex
More informationReteaching. Comparing and Ordering Integers
- Comparing and Ordering Integers The numbers and - are opposites. The numbers 7 and -7 are opposites. Integers are the set of positive whole numbers, their opposites, and zero. 7 6 4 0 negative zero You
More informationCSE 373. Objects in Collections: Object; equals; compareto; mutability. slides created by Marty Stepp
CSE 373 Objects in Collections: Object; equals; compareto; mutability slides created by Marty Stepp http://www.cs.washington.edu/373/ University of Washington, all rights reserved. 1 Recall: A typical
More informationBuilding a fraction class.
Building a fraction class http://www.zazzle.com/fraction+tshirts CSCI 135: Fundamentals of Computer Science Keith Vertanen Copyright 2013 Overview Object oriented techniques Constructors Methods that take
More informationIntegers are whole numbers; they include negative whole numbers and zero. For example -7, 0, 18 are integers, 1.5 is not.
What is an INTEGER/NONINTEGER? Integers are whole numbers; they include negative whole numbers and zero. For example -7, 0, 18 are integers, 1.5 is not. What is a REAL/IMAGINARY number? A real number is
More informationCMSC 132, Object-Oriented Programming II Summer Lecture 1:
CMSC 132, Object-Oriented Programming II Summer 2018 Lecturer: Anwar Mamat Lecture 1: Disclaimer: These notes may be distributed outside this class only with the permission of the Instructor. 1.1 Course
More informationWhat is a Fraction? A fraction is a part or piece of something. The way we write fractions tells us the size of the piece we are referring to
October 0, 0 What is a Fraction? A fraction is a part or piece of something. The way we write fractions tells us the size of the piece we are referring to ⅝ is the numerator is the denominator is the whole
More informationUsing APIs. Chapter 3. Outline Fields Overall Layout. Java By Abstraction Chapter 3. Field Summary static double PI
Outline Chapter 3 Using APIs 3.1 Anatomy of an API 3.1.1 Overall Layout 3.1.2 Fields 3.1.3 Methods 3.2 A Development Walkthrough 3.2.1 3.2.2 The Mortgage Application 3.2.3 Output Formatting 3.2.4 Relational
More informationRational number operations can often be simplified by converting mixed numbers to improper fractions Add EXAMPLE:
Rational number operations can often be simplified by converting mixed numbers to improper fractions Add ( 2) EXAMPLE: 2 Multiply 1 Negative fractions can be written with the negative number in the numerator
More informationCIT 590 Homework 5 HTML Resumes
CIT 590 Homework 5 HTML Resumes Purposes of this assignment Reading from and writing to files Scraping information from a text file Basic HTML usage General problem specification A website is made up of
More informationWhat is a Fraction? Fractions. One Way To Remember Numerator = North / 16. Example. What Fraction is Shaded? 9/16/16. Fraction = Part of a Whole
// Fractions Pages What is a Fraction? Fraction Part of a Whole Top Number? Bottom Number? Page Numerator tells how many parts you have Denominator tells how many parts are in the whole Note: the fraction
More informationName: Date: Review Packet: Unit 1 The Number System
Name: Date: Math 7 Ms. Conway Review Packet: Unit 1 The Number System Key Concepts Module 1: Adding and Subtracting Integers 7.NS.1, 7.NS.1a, 7.NS.1b, 7.NS.1c, 7.NS.1d, 7.NS.3, 7.EE.3 To add integers with
More information( 3) ( 4 ) 1. Exponents and Radicals ( ) ( xy) 1. MATH 102 College Algebra. still holds when m = n, we are led to the result
Exponents and Radicals ZERO & NEGATIVE EXPONENTS If we assume that the relation still holds when m = n, we are led to the result m m a m n 0 a = a = a. Consequently, = 1, a 0 n n a a a 0 = 1, a 0. Then
More informationRational Expressions Sections
Rational Expressions Sections Multiplying / Dividing Let s first review how we multiply and divide fractions. Multiplying / Dividing When multiplying/ dividing, do we have to have a common denominator?
More informationAlgebra 1 Review. Properties of Real Numbers. Algebraic Expressions
Algebra 1 Review Properties of Real Numbers Algebraic Expressions Real Numbers Natural Numbers: 1, 2, 3, 4,.. Numbers used for counting Whole Numbers: 0, 1, 2, 3, 4,.. Natural Numbers and 0 Integers:,
More information3.1 Dividing a Whole into Fractional Parts. 3.1 Dividing a Set into Fractional Parts. 3.2 Identifying Parts of Wholes.
. Dividing a Whole into Fractional Parts Fraction: represents a part of a whole object or unit Numerator: (top number) represents number of parts of the whole Denominator: (bottom number) represents how
More informationControls Structure for Repetition
Controls Structure for Repetition So far we have looked at the if statement, a control structure that allows us to execute different pieces of code based on certain conditions. However, the true power
More informationAlgebra Homework: Chapter 1 (Homework is listed by date assigned; homework is due the following class period) Day Date In-Class Homework
Algebra Homework: Chapter 1 (Homework is listed by date assigned; homework is due the following class period) Day Date In-Class Homework 1 T 8/30 Introductions Operations on Decimals Converting Decimals
More informationTechnical Section. Lab 4 while loops and for loops. A. while Loops or for loops
Lab 4 while loops and for loops The purpose of this lab is to introduce you to the concept of a for loop, gain experience distinguishing between a while loop (which is a more general type of loop than
More informationSOLUTION: Because the fractions have a common denominator, compare the numerators. 5 < 3
Section 1 Practice Problems 1. Because the fractions have a common denominator, compare the numerators. 5 < 3 So,. 2. 0.71 To compare these numbers, write both fractions as a decimal. 0.8 is greater than
More informationLecture 13. Example. Encapsulation. Rational numbers: a number is rational if it can be defined as the ratio between two integers.
Lecture 13 Example Rational numbers: a number is rational if it can be defined as the ratio between two integers Issues in object-oriented programming The class Rational completed Material from Holmes
More informationMULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.
Math 24 - Study Guide - Chapter 1 Name MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. 1) Give one number between -8 and 8 that is a negative real
More informationUnit 3: Multiplication and Division Reference Guide pages x 7 = 392 factors: 56, 7 product 392
Lesson 1: Multiplying Integers and Decimals, part 1 factor: any two or more numbers multiplied to form a product 56 x 7 = 392 factors: 56, 7 product 392 Integers: all positive and negative whole numbers
More informationName Student ID Number. Group Name. Group Members. Fractions
Name Student ID Number Group Name Group Members Fractions Many people struggle with and even fear working with fractions. Part of the reason people struggle is because they do not know what a fraction
More informationCoding Standards for Java
Why have coding standards? Coding Standards for Java Version 1.3 It is a known fact that 80% of the lifetime cost of a piece of software goes to maintenance; therefore, it makes sense for all programs
More informationUnit 2: Accentuate the Negative Name:
Unit 2: Accentuate the Negative Name: 1.1 Using Positive & Negative Numbers Number Sentence A mathematical statement that gives the relationship between two expressions that are composed of numbers and
More informationSection 1.2 Fractions
Objectives Section 1.2 Fractions Factor and prime factor natural numbers Recognize special fraction forms Multiply and divide fractions Build equivalent fractions Simplify fractions Add and subtract fractions
More informationFraction to Percents Change the fraction to a decimal (see above) and then change the decimal to a percent (see above).
PEMDAS This is an acronym for the order of operations. Order of operations is the order in which you complete problems with more than one operation. o P parenthesis o E exponents o M multiplication OR
More informationLearning Log Title: CHAPTER 3: ARITHMETIC PROPERTIES. Date: Lesson: Chapter 3: Arithmetic Properties
Chapter 3: Arithmetic Properties CHAPTER 3: ARITHMETIC PROPERTIES Date: Lesson: Learning Log Title: Date: Lesson: Learning Log Title: Chapter 3: Arithmetic Properties Date: Lesson: Learning Log Title:
More informationIntegers and Rational Numbers
A A Family Letter: Integers Dear Family, The student will be learning about integers and how these numbers relate to the coordinate plane. The set of integers includes the set of whole numbers (0, 1,,,...)
More informationAny Integer Can Be Written as a Fraction
All fractions have three parts: a numerator, a denominator, and a division symbol. In the simple fraction, the numerator and the denominator are integers. Eample 1: Find the numerator, denominator, and
More informationCSI33 Data Structures
Outline Department of Mathematics and Computer Science Bronx Community College September 6, 2017 Outline Outline 1 Chapter 2: Data Abstraction Outline Chapter 2: Data Abstraction 1 Chapter 2: Data Abstraction
More informationRational Number is a number that can be written as a quotient of two integers. DECIMALS are special fractions whose denominators are powers of 10.
PA Ch 5 Rational Expressions Rational Number is a number that can be written as a quotient of two integers. DECIMALS are special fractions whose denominators are powers of 0. Since decimals are special
More informationSection A Arithmetic ( 5) Exercise A
Section A Arithmetic In the non-calculator section of the examination there might be times when you need to work with quite awkward numbers quickly and accurately. In particular you must be very familiar
More informationMini-Lesson 1. Section 1.1: Order of Operations PEMDAS
Name: Date: 1 Section 1.1: Order of Operations PEMDAS If we are working with a mathematical expression that contains more than one operation, then we need to understand how to simplify. The acronym PEMDAS
More informationNote: This is a miniassignment and the grading is automated. If you do not submit it correctly, you will receive at most half credit.
Com S 227 Fall 2017 Miniassignment 1 50 points Due Date: Monday, October 16, 11:59 pm (midnight) Late deadline (25% penalty): Tuesday, October 17, 11:59 pm General information This assignment is to be
More informationProgramming Project 5: NYPD Motor Vehicle Collisions Analysis
: NYPD Motor Vehicle Collisions Analysis Due date: Dec. 7, 11:55PM EST. You may discuss any of the assignments with your classmates and tutors (or anyone else) but all work for all assignments must be
More information(-,+) (+,+) Plotting Points
Algebra Basics +y (-,+) (+,+) -x +x (-,-) (+,-) Plotting Points -y Commutative Property of Addition/Multiplication * You can commute or move the terms * This only applies to addition and multiplication
More informationTips from the experts: How to waste a lot of time on this assignment
Com S 227 Spring 2018 Assignment 1 100 points Due Date: Friday, September 14, 11:59 pm (midnight) Late deadline (25% penalty): Monday, September 17, 11:59 pm General information This assignment is to be
More informationLab 1: Silver Dollar Game 1 CSCI 2101B Fall 2018
Lab 1: Silver Dollar Game 1 CSCI 2101B Fall 2018 Due: Tuesday, September 18, 11:59 pm Collaboration Policy: Level 1 (review full policy for details) Group Policy: Individual This lab will give you experience
More informationCA4003 Compiler Construction Assignment Language Definition
CA4003 Compiler Construction Assignment Language Definition David Sinclair 2017-2018 1 Overview The language is not case sensitive. A nonterminal, X, is represented by enclosing it in angle brackets, e.g.
More informationChapter 10 Writing Classes
CSc 2310: Principle of Programming g( (Java) Spring 2013 Java Programming: g g from the Beginning g Chapter 10 Writing Classes 1 Copyright 2000 W. W. Norton & Company. All rights reserved. 10.1Designing
More informationThis exam is open book. Each question is worth 3 points.
This exam is open book. Each question is worth 3 points. Page 1 / 15 Page 2 / 15 Page 3 / 12 Page 4 / 18 Page 5 / 15 Page 6 / 9 Page 7 / 12 Page 8 / 6 Total / 100 (maximum is 102) 1. Are you in CS101 or
More information50 MATHCOUNTS LECTURES (6) OPERATIONS WITH DECIMALS
BASIC KNOWLEDGE 1. Decimal representation: A decimal is used to represent a portion of whole. It contains three parts: an integer (which indicates the number of wholes), a decimal point (which separates
More informationJim Lambers ENERGY 211 / CME 211 Autumn Quarter Programming Project 4
Jim Lambers ENERGY 211 / CME 211 Autumn Quarter 2008-09 Programming Project 4 This project is due at 11:59pm on Friday, October 31. 1 Introduction In this project, you will do the following: 1. Implement
More informationFor Module 2 SKILLS CHECKLIST. Fraction Notation. George Hartas, MS. Educational Assistant for Mathematics Remediation MAT 025 Instructor
Last Updated: // SKILLS CHECKLIST For Module Fraction Notation By George Hartas, MS Educational Assistant for Mathematics Remediation MAT 0 Instructor Assignment, Section. Divisibility SKILL: Determine
More informationCollege Prep Algebra II Summer Packet
Name: College Prep Algebra II Summer Packet This packet is an optional review which is highly recommended before entering CP Algebra II. It provides practice for necessary Algebra I topics. Remember: When
More informationCSE 142 Su 04 Computer Programming 1 - Java. Objects
Objects Objects have state and behavior. State is maintained in instance variables which live as long as the object does. Behavior is implemented in methods, which can be called by other objects to request
More informationstruct _Rational { int64_t Top; // numerator int64_t Bottom; // denominator }; typedef struct _Rational Rational;
Creating a Data Type in C Rational Numbers For this assignment, you will use the struct mechanism in C to implement a data type that represents rational numbers. A set can be modeled using the C struct:
More information************ THIS PROGRAM IS NOT ELIGIBLE FOR LATE SUBMISSION. ALL SUBMISSIONS MUST BE RECEIVED BY THE DUE DATE/TIME INDICATED ABOVE HERE
Program 10: 40 points: Due Tuesday, May 12, 2015 : 11:59 p.m. ************ THIS PROGRAM IS NOT ELIGIBLE FOR LATE SUBMISSION. ALL SUBMISSIONS MUST BE RECEIVED BY THE DUE DATE/TIME INDICATED ABOVE HERE *************
More informationFull file at
Java Programming: From Problem Analysis to Program Design, 3 rd Edition 2-1 Chapter 2 Basic Elements of Java At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class
More informationPre-Algebra Notes Unit Five: Rational Numbers and Equations
Pre-Algebra Notes Unit Five: Rational Numbers and Equations Rational Numbers Rational numbers are numbers that can be written as a quotient of two integers. Since decimals are special fractions, all the
More informationLab 3: Call to Order CSCI 2101 Fall 2018
Due: Monday, October 15, 11:59 pm Collaboration Policy: Level 1 Group Policy: Pair-Optional Lab 3: Call to Order CSCI 2101 Fall 2018 This week s lab will explore sorting, lists, and basic data analysis.
More informationLab 3: Call to Order CSCI 2101 Fall 2017
Lab 3: Call to Order CSCI 2101 Fall 2017 Due: Part 1: Tuesday, Oct 3, 11:59 pm, Part 2: Wednesday, Oct 11, 11:59 pm Collaboration Policy: Level 1 Group Policy: Part 1: Individual, Part 2: Pair-Optional
More informationTopic 6: Partial Application, Function Composition and Type Classes
Topic 6: Partial Application, Function Composition and Type Classes Recommended Exercises and Readings From Haskell: The craft of functional programming (3 rd Ed.) Exercises: 11.11, 11.12 12.30, 12.31,
More informationTopic 6: Partial Application, Function Composition and Type Classes
Topic 6: Partial Application, Function Composition and Type Classes 1 Recommended Exercises and Readings From Haskell: The craft of functional programming (3 rd Ed.) Exercises: 11.11, 11.12 12.30, 12.31,
More informationMini-Lectures by Section
Mini-Lectures by Section BEGINNING AND INTERMEDIATE ALGEBRA, Mini-Lecture 1.1 1. Learn the definition of factor.. Write fractions in lowest terms.. Multiply and divide fractions.. Add and subtract fractions..
More informationMore on Classes. The job of this method is to return a String representation of the object. Here is the tostring method from the Time class:
More on Classes tostring One special method in Java is the tostring method. The method (regardless of which class it s added to) has the following prototype: public String tostring(); The job of this method
More informationEquality for Abstract Data Types
Object-Oriented Design Lecture 4 CSU 370 Fall 2008 (Pucella) Tuesday, Sep 23, 2008 Equality for Abstract Data Types Every language has mechanisms for comparing values for equality, but it is often not
More informationLearning Log Title: CHAPTER 3: PORTIONS AND INTEGERS. Date: Lesson: Chapter 3: Portions and Integers
Chapter 3: Portions and Integers CHAPTER 3: PORTIONS AND INTEGERS Date: Lesson: Learning Log Title: Date: Lesson: Learning Log Title: Chapter 3: Portions and Integers Date: Lesson: Learning Log Title:
More informationCS 315 Software Design Homework 3 Preconditions, Postconditions, Invariants Due: Sept. 29, 11:30 PM
CS 315 Software Design Homework 3 Preconditions, Postconditions, Invariants Due: Sept. 29, 11:30 PM Objectives Defining a wellformed method to check class invariants Using assert statements to check preconditions,
More informationInheritance and Interfaces
Inheritance and Interfaces Object Orientated Programming in Java Benjamin Kenwright Outline Review What is Inheritance? Why we need Inheritance? Syntax, Formatting,.. What is an Interface? Today s Practical
More informationAP Computer Science. TextLab05 Java Assignment. Assignment Purpose: Do not copy this file, which is provided. TextLab05 Student Version
AP Computer Science The Rational Class Program II TextLab05 Java Assignment 80, 90 & 100 Point Versions Assignment Purpose: The purpose of this lab is to demonstrate knowledge of creating a class with
More informationMatrices. A Matrix (This one has 2 Rows and 3 Columns) To add two matrices: add the numbers in the matching positions:
Matrices A Matrix is an array of numbers: We talk about one matrix, or several matrices. There are many things we can do with them... Adding A Matrix (This one has 2 Rows and 3 Columns) To add two matrices:
More informationCMSC 341. Nilanjan Banerjee
CMSC 341 Nilanjan Banerjee http://www.csee.umbc.edu/~nilanb/teaching/341/ Announcements Just when you thought Shawn was going to teach this course! On a serious note: register on Piazza I like my classes
More informationbitwise inclusive OR Logical logical AND && logical OR Ternary ternary? : Assignment assignment = += -= *= /= %= &= ^= = <<= >>= >>>=
Operators in java Operator in java is a symbol that is used to perform operations. For example: +, -, *, / etc. There are many types of operators in java which are given below: Unary Operator, Arithmetic
More informationAP Computer Science Java Mr. Clausen Program 6A, 6B
AP Computer Science Java Mr. Clausen Program 6A, 6B Program 6A LastNameFirstNameP6A (Quadratic Formula: 50 points) (Including complex or irrational roots) Write a program that begins by explaining the
More informationAdding and subtracting rational expressions is quite similar to adding and subtracting rational numbers (fractions).
7.2: Adding and Subtracting Rational Expressions, Simplifying Complex Fractions Adding and subtracting rational expressions is quite similar to adding and subtracting rational numbers (fractions). Adding
More informationClaremont McKenna College Computer Science
Claremont McKenna College Computer Science CS 51 Handout 4: Problem Set 4 February 10, 2011 This problem set is due 11:50pm on Wednesday, February 16. As usual, you may hand in yours until I make my solutions
More information4. Java Project Design, Input Methods
4-1 4. Java Project Design, Input Methods Review and Preview You should now be fairly comfortable with creating, compiling and running simple Java projects. In this class, we continue learning new Java
More informationLecture 14 CSE11 Fall 2013 For loops, Do While, Break, Continue
Lecture 14 CSE11 Fall 2013 For loops, Do While, Break, Continue General Loops in Java Look at other loop constructions Very common while loop: do a loop a fixed number of times (MAX in the example) int
More informationEXAMPLE 1. Change each of the following fractions into decimals.
CHAPTER 1. THE ARITHMETIC OF NUMBERS 1.4 Decimal Notation Every rational number can be expressed using decimal notation. To change a fraction into its decimal equivalent, divide the numerator of the fraction
More informationNumber System. Introduction. Natural Numbers (N) Whole Numbers (W) Integers (Z) Prime Numbers (P) Face Value. Place Value
1 Number System Introduction In this chapter, we will study about the number system and number line. We will also learn about the four fundamental operations on whole numbers and their properties. Natural
More informationAccuplacer Arithmetic Study Guide
Accuplacer Arithmetic Study Guide I. Terms Numerator: which tells how many parts you have (the number on top) Denominator: which tells how many parts in the whole (the number on the bottom) Example: parts
More informationGrade 6 Integers. Answer the questions. Choose correct answer(s) from the given choices. For more such worksheets visit
ID : cn6integers [1] Grade 6 Integers For more such worksheets visit www.edugain.com Answer the questions (1) If a and b are two integers such that a is the predecessor of b, then what is the value of
More informationCOSC 243. Data Representation 3. Lecture 3 - Data Representation 3 1. COSC 243 (Computer Architecture)
COSC 243 Data Representation 3 Lecture 3 - Data Representation 3 1 Data Representation Test Material Lectures 1, 2, and 3 Tutorials 1b, 2a, and 2b During Tutorial a Next Week 12 th and 13 th March If you
More informationJava Review. Fundamentals of Computer Science
Java Review Fundamentals of Computer Science Link to Head First pdf File https://zimslifeintcs.files.wordpress.com/2011/12/h ead-first-java-2nd-edition.pdf Outline Data Types Arrays Boolean Expressions
More informationMath Glossary Numbers and Arithmetic
Math Glossary Numbers and Arithmetic Version 0.1.1 September 1, 200 Next release: On or before September 0, 200. E-mail edu@ezlink.com for the latest version. Copyright 200 by Brad Jolly All Rights Reserved
More informationCSC 222: Computer Programming II. Spring 2005
CSC 222: Computer Programming II Spring 2005 recursion recursive algorithms, recursive methods base case, recursive case avoiding infinite recursion recursive classes recursion vs. iteration recursion
More informationH212 Introduction to Software Systems Honors
Introduction to Software Systems Honors Lecture #04: Fall 2015 1/20 Office hours Monday, Wednesday: 10:15 am to 12:00 noon Tuesday, Thursday: 2:00 to 3:45 pm Office: Lindley Hall, Room 401C 2/20 Printing
More informationSpring, 2014 CIT 590. Programming Languages and Techniques Homework 7
Spring, 2014 CIT 590 Programming Languages and Techniques Homework 7 Mar 21, 2014; Due Mar 28, 2014, before first recitation This homework deals with the following topics * Getting started with Java *
More informationPre-Algebra Notes Unit Five: Rational Numbers and Equations
Pre-Algebra Notes Unit Five: Rational Numbers and Equations Rational Numbers Rational numbers are numbers that can be written as a quotient of two integers. Since decimals are special fractions, all the
More informationIs the statement sufficient? If both x and y are odd, is xy odd? 1) xy 2 < 0. Odds & Evens. Positives & Negatives. Answer: Yes, xy is odd
Is the statement sufficient? If both x and y are odd, is xy odd? Is x < 0? 1) xy 2 < 0 Positives & Negatives Answer: Yes, xy is odd Odd numbers can be represented as 2m + 1 or 2n + 1, where m and n are
More informationOperators. Lecture 3 COP 3014 Spring January 16, 2018
Operators Lecture 3 COP 3014 Spring 2018 January 16, 2018 Operators Special built-in symbols that have functionality, and work on operands operand an input to an operator Arity - how many operands an operator
More informationSection 2.3 Rational Numbers. A rational number is a number that may be written in the form a b. for any integer a and any nonzero integer b.
Section 2.3 Rational Numbers A rational number is a number that may be written in the form a b for any integer a and any nonzero integer b. Why is division by zero undefined? For example, we know that
More informationEE 152 Advanced Programming LAB 7
EE 152 Advanced Programming LAB 7 1) Create a class called Rational for performing arithmetic with fractions. Write a program to test your class. Use integer variables to represent the private data of
More informationCS3110 Spring 2017 Lecture 10 a Module for Rational Numbers
CS3110 Spring 2017 Lecture 10 a Module for Rational Numbers Robert Constable Abstract The notes and lecture start with a brief summary of the relationship between OCaml types, Coq types and logic that
More informationCMPSCI 187 / Spring 2015 Postfix Expression Evaluator
CMPSCI 187 / Spring 2015 Postfix Expression Evaluator Due on Thursday, 05 March, 8:30 a.m. Marc Liberatore and John Ridgway Morrill I N375 Section 01 @ 10:00 Section 02 @ 08:30 1 CMPSCI 187 / Spring 2015
More informationLesson 1: Arithmetic Review
In this lesson we step back and review several key arithmetic topics that are extremely relevant to this course. Before we work with algebraic expressions and equations, it is important to have a good
More informationExample: Which of the following expressions must be an even integer if x is an integer? a. x + 5
8th Grade Honors Basic Operations Part 1 1 NUMBER DEFINITIONS UNDEFINED On the ACT, when something is divided by zero, it is considered undefined. For example, the expression a bc is undefined if either
More informationOperators & Expressions
Operators & Expressions Operator An operator is a symbol used to indicate a specific operation on variables in a program. Example : symbol + is an add operator that adds two data items called operands.
More information