Programming Assignment #5

Slides:



Advertisements
Similar presentations
Event-drive SimulationCS-2303, C-Term Project #3 – Event-driven Simulation CS-2303 System Programming Concepts (Slides include materials from The.
Advertisements

Wednesday, 10/2/02, Slide #1 CS 106 Intro to CS 1 Wednesday, 10/2/02  QUESTIONS (on HW02 – due at 5 pm)??  Today:  Review of parameters  Introduction.
©2004 Brooks/Cole Chapter 2 Variables, Values and Operations.
Numerical Computation Review and Continuation CS-2301, B-Term Numerical Computation in C Review and Continuation CS-2301, System Programming for.
Differences between Java and C CS-2303, C-Term Differences between Java and C CS-2303, System Programming Concepts (Slides include materials from.
Display a 12-Month Calendar CS-2301 D-term Programming Assignment #2 12-Month Calendar CS-2301 System Programming C-term 2009 (Slides include materials.
Discussion of Assignment #2 CS-2301, B-Term Discussion of Assignment #2 CS-2301, System Programming for Non-Majors (Slides include materials from.
Loose endsCS-2301, B-Term “Loose Ends” CS-2301, System Programming for Non-Majors (Slides include materials from The C Programming Language, 2 nd.
Programming Assignment #4 Binary Trees
"Loose ends"CS-2301 D-term “Loose Ends” CS-2301 System Programming C-term 2009 (Slides include materials from The C Programming Language, 2 nd edition,
More on Numerical Computation CS-2301 B-term More on Numerical Computation CS-2301, System Programming for Non-majors (Slides include materials from.
More on Operator Overloading CS-2303, C-Term More on Operator Overloading CS-2303 System Programming Concepts (Slides include materials from The.
Digression on Loop Invariants CS-2303, C-Term Digression on Loop Invariants CS-2303, System Programming Concepts (Slides include materials from The.
Symbolic Constants in CCS-2303, C-Term Digression – Symbolic Constants in C CS-2303, System Programming Concepts (Slides include materials from The.
Introduction to C++CS-2303, C-Term Introduction to C++ CS-2303 System Programming Concepts (Slides include materials from The C Programming Language,
More about Numerical Computation CS-2301, B-Term More about Numerical Computation CS-2301, System Programming for Non-Majors (Slides include materials.
 2006 Pearson Education, Inc. All rights reserved. Templates (again)CS-2303, C-Term Templates (again) CS-2303 System Programming Concepts (Slides.
Introduction to Classes and Objects CS-2303, C-Term Introduction to Classes and Objects CS-2303 System Programming Concepts (Slides include materials.
Assignment #2, 12- month Calendar CS-2301, B-Term Programming Assignment #2 12-Month Calendar CS-2301, System Programming for Non-Majors (Slides.
Operator OverloadingCS-2303, C-Term Operator Overloading CS-2303 System Programming Concepts (Slides include materials from The C Programming Language,
Homework #4: Operator Overloading and Strings By J. H. Wang May 8, 2012.
Introduction to FunctionsCIS 1057 Fall Introduction to Functions CIS 1057 Computer Programming in C Fall 2013 (Acknowledgement: Many slides based.
Java Primer 1: Types, Classes and Operators
Computing Fundamentals
BY GAWARE S.R. COMPUTER SCI. DEPARTMENT
Java Review: Reference Types
Programming Assignment #4 Binary Trees in C++
More about Numerical Computation
Makefiles and Notes on Programming Assignment PA2
First Python Program Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming: An.
Strings and Streams Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2nd edition,
CS 100: Roadmap to Computing
“Under the Hood” of Polymorphism
Classes, Constructors, etc., in C++
Containers and the Standard Template Library (STL)
Miscellaneous C++ Topics
Dynamic Memory Allocation (and Multi-Dimensional Arrays)
Structures, Unions, and Typedefs
Arrays and Pointers in C & C++
Derived Classes in C++ Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2nd edition,
Linked Lists in C and C++
Binary Trees (and Big “O” notation)
Polymorphism Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2nd edition, by Kernighan.
Bit Fields & Bitwise Operations
Programming Assignment #1 12-Month Calendar—
Templates (again) Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2nd edition,
History and Background
Symbolic Constants in C
Recursion and Implementation of Functions
Programming Assignment #6
Accessing Files in C Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2nd edition,
Scope Rules and Storage Types
Summary Two basic concepts: variables and assignments Basic types:
Differences between Java and C
Strings in C Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2nd edition, by Kernighan.
Variables, Lists, and Objects
Debuggers and Debugging
More elements of Python programs
Your first C and C++ programs
Iterators Professor Hugh C. Lauer CS-2303, System Programming Concepts
Lab Project #1: Datalab Assigned March 12, 2012; due March 22, 11:59 PM Professor Hugh C. Lauer CS-2011, Machine Organization and Assembly Language.
Operator Overloading Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2nd edition,
Functions in C and C++ CS-2303 System Programming Concepts Hugh C. Lauer (Slides include materials from The C Programming Language, 2nd edition, by Kernighan.
Digression on Loop Invariants
Assignment #3 Programming Language, Spring 2003
A Deeper Look at Classes
CS 100: Roadmap to Computing
Introduction to Classes and Objects
Presentation transcript:

Programming Assignment #5 Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2nd edition, by Kernighan and Ritchie, Absolute C++, by Walter Savitch, The C++ Programming Language, Special Edition, by Bjarne Stroustrup, and from C: How to Program, 5th and 6th editions, by Deitel and Deitel) CS-2303, A-Term 2012 Programming Assignment #5

Programming Assignment #5 Define and develop a class of rational numbers Overloaded operators for manipulating them +, –, *, /, ==, !=, <, <=, >, >= Overloaded << and >> operators for reading in from or writing out to streams Overloaded assignment operator to assign to a double A copy constructor, a default constructor, and two other constructors To make rational numbers from integers Create a test program to exercise this rational class. Scan in numbers and operations Execute them Print out the result in rational format and as a double CS-2303, A-Term 2012 Programming Assignment #5

What is a rational number A number comprising two integers Numerator and denominator (Denominator may not be zero) Represent both as int I.e., 32-bit in Intel processors Do internal arithmetic in long long int i.e., 64-bit in Intel processors Always normalize! CS-2303, A-Term 2012 Programming Assignment #5

You may NOT refer to them! Programming Assignment #5 Notes There are many rational classes available on the web and in print. You may NOT refer to them! You must design and implement your own class and your own operators You may work alone or in two-person teams Project due at 11:59 PM, Sunday, September 30 CS-2303, A-Term 2012 Programming Assignment #5

Programming Assignment #5 Test program Command line arguments are one or more text files Each text file is a sequence of lines Each line consists of rational numbers of the form a/b c/d, etc., and operators such as +, -, *, /, ==, etc. All operations are expressed in postfix — e.g., 1/6 1/3 + 1/4 1/8 + 2 * 3/4 6/8 == Result should be 1/2 Result should be 3/4 Result should be true CS-2303, A-Term 2012 Programming Assignment #5

Test Program (continued) An arbitrary number of test files Each file an arbitrary number of lines Each line an arbitrary number of rational numbers and operations CS-2303, A-Term 2012 Programming Assignment #5

Programming Assignment #5 Test cases As many as you need to exercise your class … and test all operations different ways … using number with non-trivial denominators — including Denominators that are relatively prime Denominators that are large but not relatively prime CS-2303, A-Term 2012 Programming Assignment #5

Programming Assignment #5 Questions? CS-2303, A-Term 2012 Programming Assignment #5