namespace Prog1A { public abstract class LibraryItem {
|
|
- Audrey Hood
- 6 years ago
- Views:
Transcription
1 //Program 1a //ben spalding //2/17/15 //this is a complex class heierarchy //cis using System; public abstract class LibraryItem private Int32 _copyrightyear; //the backing field for the copyrightyear property private Int32 _loanperiod; //the backing field for the loanperiod propery private LibraryPatron _patron; //the backing field for the patron property private bool _checkedout; //the backing field for the Checkout, return to shelf, and ischeckedout methods public LibraryItem(String TheTitle, String ThePublisher, Int32 TheCopyrightYear, Int32 TheLoanPeriod, String TheCallNumber) Title = TheTitle; Publisher = ThePublisher; CopyrightYear = TheCopyrightYear; LoanPeriod = TheLoanPeriod; CallNumber = TheCallNumber; ReturnToShelf(); public String Title ; public String Publisher ; public Int32 CopyrightYear //Precondition : An int that is greater then 0 //Postcondition : Valdiates that the int is >0
2 if (_copyrightyear >= 0) return _copyrightyear; throw new ArgumentOutOfRangeException(); //Precondition : an int >0 //Postcondition : assigns _copyrightyear to value value = _copyrightyear; public Int32 LoanPeriod //Precondition : A valid integer //Postcondition : checks to see if the int is >0 if (_loanperiod >= 0) return _loanperiod; throw new ArgumentOutOfRangeException(); //Precondition : a non negative int //Postcondition : assigns _loanperiod to value value = _loanperiod; public String CallNumber ; public LibraryPatron Patron //Precondition: The book must not be checked out //Postcondition: The patron has been returned if (IsCheckedOut()) return _patron; return null;
3 // Postcondition: The book is checked out public void CheckOut(LibraryPatron apatron) _checkedout = true; _patron = apatron; // Postcondition: The book is not checked out public void ReturnToShelf() _checkedout = false; _patron = null; // Postcondition: true is returned if the book is checked out, // otherwise false is returned public bool IsCheckedOut() return _checkedout; public abstract decimal CalcLateFee(); //Postcondition : Outputs a string for the information available in this class return String.Format("Title: 10Publisher: 20Copyright Year: 30Loan Period: 40Call Number50", System.Environment.NewLine.ToString(),Title,Publisher,CopyrightYear,LoanPeriod,CallNumber,IsCheckedOut()?_patron.ToString():null);
4 using System; public class LibraryBook : LibraryItem public LibraryBook(String TheTitle, String TheAuthor, String ThePublisher, Int32 TheCopyrightYear, Int32 TheLoanPeriod, String TheCallNumber) : base(thetitle, ThePublisher, TheCopyrightYear, TheLoanPeriod, TheCallNumber) TheAuthor = Author; public String Author //Precondition : A valid string //Postcondition : returns the value of that string ; //Postcondition : Sets the value of value = the value of author //Postcondition : Calculates the late fee public override decimal CalcLateFee() decimal dailyrate =.25m; //the rate at which the patron is being charged return dailyrate = base.loanperiod * dailyrate; //Postcondition : Outputs a string for the information available in this class return String.Format("1Author: 20",System.Environment.NewLine.ToString(),base.ToString(),Author);
5 using System; class LibraryMagazine : LibraryPeriodical public LibraryMagazine(String TheTitle, String ThePublisher, Int32 TheCopyrightYear, Int32 TheLoanPeriod, String TheCallNumber, Int32 TheVolume, Int32 TheNumber) : base(thetitle, ThePublisher, TheCopyrightYear, TheLoanPeriod, TheCallNumber, TheVolume, TheNumber) //Precondition : A valid loan period //Postcondition : Calculates the late fee according to the loan period public override decimal CalcLateFee() const decimal LOANMAX = 20.00m; //the limit to the late fee const decimal LOANRATE = 0.25m; //the daily rate the patron will be charged decimal calc = LOANRATE * LoanPeriod; //the calculation for the loan period if (calc > LOANMAX) return LOANMAX; return calc; //Postcondition : Outputs the information from the parent class and this class return String.Format("2Late Fee : 10",System.Environment.NewLine,CalcLateFee(),base.ToString());
6 using System; class LibraryJournal : LibraryPeriodical public LibraryJournal(String TheTitle, String ThePublisher, Int32 TheCopyrightYear, Int32 TheLoanPeriod, String TheCallNumber, Int32 TheVolume, Int32 TheNumber, String TheDiscipline, String TheEditor) : base(thetitle, ThePublisher, TheCopyrightYear, TheLoanPeriod, TheCallNumber, TheVolume, TheNumber) TheDiscipline = Discipline; TheEditor = Editor; public String Discipline //Precondition : a string //Postcondition : returns the string ; //Postcondition : s the string to the appropriate value public String Editor //Precondition : a string //Postcondition : returns the string ; //Postcondition : s the string to the appropriate value //Precondition : A valid loan period //Postcondition : Calculates the late fee according to the loan period public override decimal CalcLateFee() const decimal LOANRATE = 0.75m; //The rate at which the patron will be charged return LOANRATE * LoanPeriod; //Postcondition : Outputs the information from the parent class and this class
7 return String.Format("4Discipline : 10Editor : 20 Late Fee : 30", System.Environment.NewLine, Discipline, Editor, CalcLateFee(), base.tostring());
8 using System; public abstract class LibraryMediaItem:LibraryItem private Double _duration; //the backing field for the duration property protected MediaType _medium; //the backing field for the medium property public LibraryMediaItem(String TheTitle, String ThePublisher, Int32 TheCopyrightYear, Int32 TheLoanPeriod, String TheCallNumber, Double TheDuration) :base (TheTitle,ThePublisher,TheCopyrightYear,TheLoanPeriod,TheCallNumber) TheDuration = Duration; public enum MediaType DVD = 0, BLURAY = 1, VHS = 2, CD = 3, SACD = 4, VINYL = 5 public abstract MediaType Medium ; public Double Duration //Precondition : a valid nonnegative int //Postcondition : valiidates that the int is non negative if (_duration >= 0) return _duration; throw new ArgumentOutOfRangeException(); //Postcondition : s the value of value = to _duration value = _duration; //Postcondition : Outputs the information from the parent class and this class return String.Format("2Duration : 10",
9 System.Environment.NewLine, Duration, base.tostring());
10 using System; public class LibraryMovie : LibraryMediaItem public LibraryMovie(String TheTitle, String ThePublisher, Int32 TheCopyrightYear, Int32 TheLoanPeriod, String TheCallNumber, Double TheDuration, String TheDirector, MediaType TheMedium, MPAARatings TheRating) : base(thetitle, ThePublisher, TheCopyrightYear, TheLoanPeriod, TheCallNumber, TheDuration) TheDirector = Director; TheMedium = Medium; public enum MPAARatings G, PG, PG13, R, NC17, U ; public MPAARatings Ratings //Precondition : a valid MPAA value //Postcondition : returns the Mpaa value ; //Postcondition : s the MPAA value appropriatly public String Director //Precondition : a valid string //Postcondition : returns Director ; //Postcondition : Sets the director to the appropriate value public override MediaType Medium //Precondition : A medium object //Postcondition : Checks to see if the medium object is a dvd, bluray, or vhs
11 if (_medium >= MediaType.DVD && _medium <= MediaType.VHS) return _medium; throw new ArgumentOutOfRangeException(); ; //Postcondition : Sets medium to the correct value _medium = value; //Postcondition : calculates the proper late fee public override decimal CalcLateFee() const decimal MAXLATEFEE = 25.00m; //The limit for the late fee const decimal LOANRATELOW = 1.00m; //the lower amount that wil be charged for every day const decimal LOANRATEHIGH = 1.50m; //The higher amount that will be charged for everyday decimal calclow = LOANRATELOW * LoanPeriod; decimal calchigh = LOANRATEHIGH * LoanPeriod; //the calculation for the lower amount //the calculation for the higher amount if (calchigh <= MAXLATEFEE && calclow <= MAXLATEFEE) if (Medium == MediaType.VHS Medium == MediaType.DVD) return calclow; return calchigh; return MAXLATEFEE; //Postcondition : Outputs the information from the parent class and this class return String.Format("5Medium : 10Director : 20Rating : 40Late Fee : 30", System.Environment.NewLine, Medium, Director, CalcLateFee(), Ratings, base.tostring());
12 using System; public class LibraryPatron private String _patronname; // Name of the patron private String _patronid; // ID of the patron // Postcondition: The patron has been initialized with the specified name // and ID public LibraryPatron(String name, String id) PatronName = name; PatronID = id; public String PatronName // Postcondition: The patron's name has been returned return _patronname; // Postcondition: The patron's name has been to the specified value _patronname = value; public String PatronID // Postcondition: The patron's ID has been returned return _patronid;
13 // Postcondition: The patron's ID has been to the specified value _patronid = value; // Postcondition: A string is returned presenting the libary patron's data on // separate lines return String.Format("Name: 02ID: 1", PatronName, PatronID, System.Environment.NewLine);
14 using System; public abstract class LibraryPeriodical : LibraryItem private Int32 _volume; //the bacing field for the volume property private Int32 _number; //the backingfield for the number property public LibraryPeriodical(String TheTitle, String ThePublisher, Int32 TheCopyrightYear, Int32 TheLoanPeriod, String TheCallNumber, Int32 TheVolume, Int32 TheNumber) : base(thetitle, ThePublisher, TheCopyrightYear, TheLoanPeriod, TheCallNumber) TheVolume = Volume; TheNumber = Number; public Int32 Volume //Precondition : A nonnegative int //Postcondition : returns _volume or throws an error if (_volume > 0) return _volume; throw new ArgumentOutOfRangeException(); //Precondition : noen //Postcondition : s _volume equal to the approriate value value = _volume; public Int32 Number //Precondition : nonegative int //Postcondition : returns _number or throws an error if (_number> 0) return _number; throw new ArgumentOutOfRangeException();
15 //Precondition : none //Postcondition : s _number to the appropriate value value = _number; //Postcondition : Outputs the information from the parent class and this class return String.Format("3Volume : 10Number : 20", System.Environment.NewLine, Volume, Number, base.tostring());
// Program 2 - Extra Credit // CIS // Spring // Due: 3/11/2015. // By: Andrew L. Wright. //Edited by : Ben Spalding
// Program 2 - Extra Credit // CIS 200-01 // Spring 2015 // Due: 3/11/2015 // By: Andrew L. Wright //Edited by : Ben Spalding // File: Prog2Form.cs // This class creates the main GUI for Program 2. It
More information// Program 4 // CIS // Due: 4/12/2015 // By: Ben Spalding
// Program 4 // CIS 200-01 // Due: 4/12/2015 // By: Ben Spalding //This program was created to use the Icomparer and IComparable interfaces to sort objects of the library item class // the sorts are at
More informationCS246 Software Abstraction and Specification Final Examination
CS246 Software Abstraction and Specification ination Spring 2007 Date: 04-Aug-2007 Time: 4.00 6.30pm Permitted Aids: None 14 pages Student Name: UW Student ID: Instructions: (Read carefully before the
More informationSOLUTIONS TO EXERCISES PART ONE: Problem-Solving Techniques
SOLUTIONS TO EXERCISES PART ONE: Problem-Solving Techniques 1 Principles of Programming and Software Engineering 1 const CENTS_PER_DOLLAR = 100; void computechange(int dollarcost, int centscost, int& d,
More informationEECS2030 Week 7 worksheet Tue Feb 28, 2017
1. Interfaces The Comparator interface provides a way to control how a sort method (such as Collections.sort) sorts elements of a collection. For example, the following main method sorts a list of strings
More informationUnit 9 Practice Test (AB27-30)
Unit 9 Practice Test (AB27-30) Name 1. Consider the following method: public static int checktree(treenode root) return 0; int x = checktree(root.getleft()); if ( x >= 0 && checktree(root.getright()) ==
More informationExam Duration: 2hrs and 30min Software Design
Exam Duration: 2hrs and 30min. 433-254 Software Design Section A Multiple Choice (This sample paper has less questions than the exam paper The exam paper will have 25 Multiple Choice questions.) 1. Which
More informationLargest Online Community of VU Students
WWW.VUPages.com http://forum.vupages.com WWW.VUTUBE.EDU.PK Largest Online Community of VU Students MIDTERM EXAMINATION SEMESTER FALL 2003 CS301-DATA STRUCTURE Total Marks:86 Duration: 60min Instructions
More informationCMSC 433 Section 0101 Fall 2012 Midterm Exam #1
Name: CMSC 433 Section 0101 Fall 2012 Midterm Exam #1 Directions: Test is closed book, closed notes. Answer every question; write solutions in spaces provided. Use backs of pages for scratch work. Good
More informationAssertions, pre/postconditions
Programming as a contract Assertions, pre/postconditions Assertions: Section 4.2 in Savitch (p. 239) Specifying what each method does q Specify it in a comment before method's header Precondition q What
More informationmoretosearch = (location < length);
Chapter 3(6th edition): Exercises 1,2,3,9,10,11,12,18-28 (due: 25/10/2017) Solution: 1. (a) Boolean IsThere(ItemType item) Function: Determines if item is in the list. Precondition: List has been initialized.
More informationInheritance (Part 5) Odds and ends
Inheritance (Part 5) Odds and ends 1 Static Methods and Inheritance there is a significant difference between calling a static method and calling a non-static method when dealing with inheritance there
More informationAP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS
AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS PAUL L. BAILEY Abstract. This documents amalgamates various descriptions found on the internet, mostly from Oracle or Wikipedia. Very little of this
More informationselectors, methodsinsert() andto_string() the depth of a tree and a membership function
Binary Search Trees 1 Sorting Numbers using a Tree a sorting algorithm using a tree of integer numbers 2 Header Files defining a node struct defining a tree class 3 Definition of Methods selectors, methodsinsert()
More informationChapter-8 DATA TYPES. Introduction. Variable:
Chapter-8 DATA TYPES Introduction To understand any programming languages we need to first understand the elementary concepts which form the building block of that program. The basic building blocks include
More informationIntroduction to C# Applications
1 2 3 Introduction to C# Applications OBJECTIVES To write simple C# applications To write statements that input and output data to the screen. To declare and use data of various types. To write decision-making
More informationPrelim 1, Solution. CS 2110, 13 March 2018, 7:30 PM Total Question Name Short answer
Prelim 1, Solution CS 2110, 13 March 2018, 7:30 PM 1 2 3 4 5 6 Total Question Name Short answer Exception handling Recursion OO Loop invariants Max 1 30 11 14 30 14 100 Score Grader The exam is closed
More information04-24/26 Discussion Notes
04-24/26 Discussion Notes PIC 10B Spring 2018 1 When const references should be used and should not be used 1.1 Parameters to constructors We ve already seen code like the following 1 int add10 ( int x
More informationC++: Const Function Overloading Constructors and Destructors Enumerations Assertions
C++: Const Function Overloading Constructors and Destructors Enumerations Assertions Const const float pi=3.14159; const int* pheight; // defines pointer to // constant int value cannot be changed // pointer
More informationInheritance. A key OOP concept
Inheritance A key OOP concept Setting the scene Why do we need inheritance? Inheritance enables you to define a new class based upon an existing class. The new class is similar to the existing class, but
More informationCom S 227 Spring 2013 Topics and review problems for Final Exam Wednesday, April 8, 7:00 9:00 pm in Hoover 2055 and 1213 ** You must bring your ID **
General information Com S 227 Spring 2013 Topics and review problems for Final Exam Wednesday, April 8, 7:00 9:00 pm in Hoover 2055 and 1213 ** You must bring your ID ** This will be a 120-minute, timed,
More informationPrelim 1. CS 2110, 13 March 2018, 7:30 PM Total Question Name Short answer
Prelim 1 CS 2110, 13 March 2018, 7:30 PM 1 2 3 4 5 6 Total Question Name Short answer Exception handling Recursion OO Loop invariants Max 1 30 11 14 30 14 100 Score Grader The exam is closed book and closed
More informationgcc o driver std=c99 -Wall driver.c bigmesa.c
C Programming Simple Array Processing This assignment consists of two parts. The first part focuses on array read accesses and computational logic. The second part focuses on array read/write access and
More informationMidterm I Exam Principles of Imperative Computation Frank Pfenning. February 17, 2011
Midterm I Exam 15-122 Principles of Imperative Computation Frank Pfenning February 17, 2011 Name: Sample Solution Andrew ID: fp Section: Instructions This exam is closed-book with one sheet of notes permitted.
More informationDefault arguments, documentation
, documentation Comp Sci 1570 Introduction to C++ Outline 1 2 to functions A default parameter (also called an optional parameter or a default argument) is a function parameter that has a default value
More informationCS 1063 Introduction to Computer Programming Midterm Exam 2 Section 1 Sample Exam
Seat Number Name CS 1063 Introduction to Computer Programming Midterm Exam 2 Section 1 Sample Exam This is a closed book exam. Answer all of the questions on the question paper in the space provided. If
More informationCSE 331 Winter 2016 Midterm Solution
CSE 331 Winter 2016 Midterm Solution Name There are 7 questions worth a total of 100 points. Please budget your time so that you get to all of the questions. Keep your answers concise. The exam is closed
More informationTOP-DOWN PROCEDURAL PROGRAMMING
TOP-DOWN PROCEDURAL PROGRAMMING Top-down programming is an incremental strategy where you implement the most general modules first and work towards implementing those that provide specific functionality.
More informationCSCD 326 Data Structures I Stacks
CSCD 326 Data Structures I Stacks 1 Stack Interface public interface StackInterface { public boolean isempty(); // Determines whether the stack is empty. // Precondition: None. // Postcondition: Returns
More informationEECE.3220: Data Structures Spring 2017
EECE.3220: Data Structures Spring 2017 Lecture 14: Key Questions February 24, 2017 1. Describe the characteristics of an ADT to store a list. 2. What data members would be necessary for a static array-based
More informationImproving structure with inheritance. Main concepts to be covered. The DoME example. DoME objects. DoME classes. DoME object model
Improving structure with inheritance Main concepts to be covered Inheritance -- adding functionality to classes by extending them Subtyping, as in ArrayList Substitution: if you want a car, either
More informationStructured Data. CIS 15 : Spring 2007
Structured Data CIS 15 : Spring 2007 Functionalia HW4 Part A due this SUNDAY April 1st: 11:59pm Reminder: I do NOT accept LATE HOMEWORK. Today: Dynamic Memory Allocation Allocating Arrays Returning Pointers
More informationSolutions to Quiz 1 (March 22, 2019)
MIT 6.031: Software Construction Max Goldman and Prof. Armando Solar-Lezama revised Tuesday 19 th March, 2019, 23:26 Solutions to Quiz 1 (March 22, 2019) For this quiz, a thermostat program describes the
More information02291: System Integration
02291: System Integration Week 7 Hubert Baumeister hub@imm.dtu.dk DTU Compute Technical University of Denmark Spring 2016 Contents Components (part III) Sequence Diagrams Design Validation: Use Case Realization
More informationCSE 331 Midterm Exam 2/13/12
Name There are 10 questions worth a total of 100 points. Please budget your time so you get to all of the questions. Keep your answers brief and to the point. The exam is closed book, closed notes, closed
More informationTokens, Expressions and Control Structures
3 Tokens, Expressions and Control Structures Tokens Keywords Identifiers Data types User-defined types Derived types Symbolic constants Declaration of variables Initialization Reference variables Type
More informationThis examination has 11 pages. Check that you have a complete paper.
MARKING KEY The University of British Columbia MARKING KEY Computer Science 252 2nd Midterm Exam 6:30 PM, Monday, November 8, 2004 Instructors: K. Booth & N. Hutchinson Time: 90 minutes Total marks: 90
More informationUniversity of Technology. Laser & Optoelectronics Engineering Department. C++ Lab.
University of Technology Laser & Optoelectronics Engineering Department C++ Lab. Second week Variables Data Types. The usefulness of the "Hello World" programs shown in the previous section is quite questionable.
More informationException Examples. All examples written by Edith Hemaspaandra and modified by Jessica Bayliss
Exception Examples All examples written by Edith Hemaspaandra and modified by Jessica Bayliss using System; // An example showing how exceptions propogate. public static int divide( int n, int m ) { return
More informationCode Documentation.
Code Documentation Important! It s for you It s for others The Function Description Describes what the function does for the user What resources are needed It should not need to state how this is done,
More informationCSE wi Midterm Exam 2/8/18. Name UW ID #
Name UW ID # There are 11 questions worth a total of 120 points. Please budget your time so you get to all of the questions. Keep your answers brief and to the point. The exam is closed book, closed notes,
More informationPart of the Picture: Simulation
Part of the Picture: Simulation Random Number Generators The RandomInt Class The Part of the Picture: Simulation section in Chapter 5 referred to a class RandomInt, which can be used to conveniently generate
More informationDue Date: See Blackboard
Source File: ~/2315/45/lab45.(C CPP cpp c++ cc cxx cp) Input: under control of main function Output: under control of main function Value: 4 Integer data is usually represented in a single word on a computer.
More informationSolutions for Selected Exercises
Data Abstraction & Problem Solving with C++: Walls and Mirrors 6th Edition by Carrano, Henry Solutions Manual Completed download: https://solutionsmanualbank.com/download/data-abstraction-problem-solvingwith-c-walls-and-mirrors-6th-edition-by-carrano-henry-solutions-manual/
More informationOutline. Purpose. Useful Definitions. Pattern Overview
Design Patterns Outline Purpose Useful Definitions Pattern Overview Purpose To provide programmers with already documented solutions to common problems. Gives the programmers a common language. COMPOSITION?
More informationSubmit your answers to these questions to the Curator under Quizzes as HW08 by the posted due date and time. No late submissions will be accepted.
Instructions: For all questions, assume that any necessary header files have been included. Submit your answers to these questions to the Curator under Quizzes as HW08 by the posted due date and time.
More informationProgramming in C++ 4. The lexical basis of C++
Programming in C++ 4. The lexical basis of C++! Characters and tokens! Permissible characters! Comments & white spaces! Identifiers! Keywords! Constants! Operators! Summary 1 Characters and tokens A C++
More informationA web-based IDE for Java
A web-based IDE for Java Software Engineering Laboratory By: Supervised by: Marcel Bertsch Christian Estler Dr. Martin Nordio Prof. Dr. Bertrand Meyer Student Number: 09-928-896 Content 1 Introduction...3
More informationDeclarations and Access Control SCJP tips
Declarations and Access Control www.techfaq360.com SCJP tips Write code that declares, constructs, and initializes arrays of any base type using any of the permitted forms both for declaration and for
More informationIntroduction to Linked Lists. Introduction to Recursion Search Algorithms CS 311 Data Structures and Algorithms
Introduction to Linked Lists Introduction to Recursion Search Algorithms CS 311 Data Structures and Algorithms Lecture Slides Friday, September 25, 2009 Glenn G. Chappell Department of Computer Science
More informationReview Questions for Final Exam
CS 102 / ECE 206 Spring 11 Review Questions for Final Exam The following review questions are similar to the kinds of questions you will be expected to answer on the Final Exam, which will cover LCR, chs.
More informationAssertions. Assertions - Example
References: internet notes; Bertrand Meyer, Object-Oriented Software Construction; 11/13/2003 1 Assertions Statements about input to a routine or state of a class Have two primary roles As documentation,
More information1 de :02
1 de 6 02-12-2005 18:02!" $%$&&$ ' ( ) ) * +,"* (-)( )(*) ) ). /) %) ( ( -( *)% ) (0 ( " ' * ) *) *)(%* % ) (!%12%! ( ) ( ( )*)3 *) ( *(-)( %. )(( ) *(!() 2 ( (6 &)*7 8 ( 1( -(! ", % ' ( *.() (%) )() (
More information3. Java - Language Constructs I
Educational Objectives 3. Java - Language Constructs I Names and Identifiers, Variables, Assignments, Constants, Datatypes, Operations, Evaluation of Expressions, Type Conversions You know the basic blocks
More informationObject oriented programming
Exercises 7 Version 1.0, 11 April, 2017 Table of Contents 1. Inheritance.................................................................. 1 1.1. Tennis Player...........................................................
More informationMidterm Practice Exam
Name: CS 410 Introduction to Software Engineering Fall 2016 Instructor: Marc Pomplun Midterm Practice Exam Duration: 75 minutes No books, no notes, and no calculators are allowed. Question 1: out of points
More informationThis sheet must be the cover page for every programming assignment. Total
This sheet must be the cover page for every programming assignment. Name Joe Student Assignment Title May the Greatest Integer Win (do not write below this line; for grader use only) Validity (up to 70%)
More informationdouble d0, d1, d2, d3; double * dp = new double[4]; double da[4];
All multiple choice questions are equally weighted. You can generally assume that code shown in the questions is intended to be syntactically correct, unless something in the question or one of the answers
More informationPriority Queues and Huffman Trees
Priority Queues and Huffman Trees 1 the Heap storing the heap with a vector deleting from the heap 2 Binary Search Trees sorting integer numbers deleting from a binary search tree 3 Huffman Trees encoding
More informationAutomatic Renewal Using DIY Technology to Create an Improved Patron Experience
Using DIY Technology to Create an Improved Patron Experience Samantha Jekot-Graham, Patron Experience Lead Phil Feilmeyer, System Integration What is automatic renewal? A service that automatically renews
More informationMotivation. Correct and maintainable software Cost effective software production Implicit assumptions easily broken
Spec# Andreas Vida Motivation Correct and maintainable software Cost effective software production Implicit assumptions easily broken Need more formal f specification Integration into a popular language
More informationLAB 5, THE HIDDEN DELIGHTS OF LINKED LISTS
LAB 5, THE HIDDEN DELIGHTS OF LINKED LISTS Questions are based on the Main and Savitch review questions for chapter 5 in the Exam Preparation section of the webct course page. In case you haven t observed
More informationDo not start the test until instructed to do so!
CS 1054: Programming in Java Page 1 of 6 Form A READ THIS NOW! Failure to read and follow the instructions below may result in severe penalties Failure to adhere to these directions will not constitute
More informationthe pointer range [first, last) into the tree
1 #ifndef BINARY_SEARCH_TREE_CLASS 2 #define BINARY_SEARCH_TREE_CLASS 3 4 #ifndef NULL 5 #include 6 #endif // NULL 7 8 #include // for setw() 9 #include // for format conversion
More informationpublic static boolean isoutside(int min, int max, int value)
See the 2 APIs attached at the end of this worksheet. 1. Methods: Javadoc Complete the Javadoc comments for the following two methods from the API: (a) / @param @param @param @return @pre. / public static
More informationTopic 7: Algebraic Data Types
Topic 7: Algebraic Data Types 1 Recommended Exercises and Readings From Haskell: The craft of functional programming (3 rd Ed.) Exercises: 5.5, 5.7, 5.8, 5.10, 5.11, 5.12, 5.14 14.4, 14.5, 14.6 14.9, 14.11,
More informationExpression Trees and the Heap
Expression Trees and the Heap 1 Binary Expression Trees evaluating expressions splitting strings in operators and operands 2 C++ Binary Tree of Strings header files defining the methods 3 the Heap or Priority
More informationThe Composite State Visitor Pattern
Design Patterns for Data Structures Chapter 8 he Composite State Visitor Pattern Design Patterns for Data Structures Chapter 8 he Composite State Binary ree with the Visitor Pattern BireeCSV Design Patterns
More informationGradeBook code. Main Program
// Program 4 // CIS 199-01/-76 // Due: Tuesday April 20 by class // By: Charles Rady GradeBook code Main Program // File: Program.cs // This file serves as a simple test program for the gradebook class.
More informationReview: Exam 1. Your First C++ Program. Declaration Statements. Tells the compiler. Examples of declaration statements
Review: Exam 1 9/20/06 CS150 Introduction to Computer Science 1 1 Your First C++ Program 1 //*********************************************************** 2 // File name: hello.cpp 3 // Author: Shereen Khoja
More informationLargest Online Community of VU Students
WWW.VUPages.com WWW.VUTUBE.EDU.PK http://forum.vupages.com Largest Online Community of VU Students MIDTERM EXAMINATION SEMESTER FALL 2003 CS301-DATA STRUCTURE Total Marks:86 Duration: 60min Instructions
More information// Precondition: None // Postcondition: The address' name has been set to the // specified value set;
// File: Address.cs // This classes stores a typical US address consisting of name, // two address lines, city, state, and 5 digit zip code. using System; using System.Collections.Generic; using System.Linq;
More informationBinary Search Trees. Contents. Steven J. Zeil. July 11, Definition: Binary Search Trees The Binary Search Tree ADT...
Steven J. Zeil July 11, 2013 Contents 1 Definition: Binary Search Trees 2 1.1 The Binary Search Tree ADT.................................................... 3 2 Implementing Binary Search Trees 7 2.1 Searching
More informationCSE 331 Spring 2018 Midterm
CSE 331 Spring 2018 Midterm Name There are 8 questions worth a total of 93 points. Please budget your time so that you get as many points as possible. We have done our best to make a test that folks can
More informationLinked Lists. Linked List Nodes. Walls and Mirrors Chapter 5 10/25/12. A linked list is a collection of Nodes: item next -3.
Linked Lists Walls and Mirrors Chapter 5 Linked List Nodes public class Node { private int item; private Node next; public Node(int item) { this(item,null); public Node(int item, Node next) { setitem(item);
More informationAs a member of the Bridges Library System, Menomonee Falls Public Library primarily serves residents of Waukesha and Jefferson Counties.
CIRCULATION POLICY: LIBRARY CARD ELIGIBILITY As a member of the Bridges Library System, Menomonee Falls Public Library primarily serves residents of Waukesha and Jefferson Counties. Most Wisconsin residents
More informationObjectives. Introduce static keyword examine syntax describe common uses
Static Objectives Introduce static keyword examine syntax describe common uses 2 Static Static represents something which is part of a type rather than part of an object Two uses of static field method
More informationBASIC ELEMENTS OF A COMPUTER PROGRAM
BASIC ELEMENTS OF A COMPUTER PROGRAM CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING LOGO Contents 1 Identifier 2 3 Rules for naming and declaring data variables Basic data types 4 Arithmetic operators
More informationCALCULATOR APPLICATION
CALCULATOR APPLICATION Form1.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms;
More informationVictoria University of Wellington School of Engineering and Computer Science. SWEN224: Formal Foundations of Programming. Exam Prep Questions
Victoria University of Wellington School of Engineering and Computer Science SWEN224: Formal Foundations of Programming Exam Prep Questions 1 Static Analysis These questions are illustrative of the kinds
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 informationUNIVERSITY OF EDINBURGH COLLEGE OF SCIENCE AND ENGINEERING SCHOOL OF INFORMATICS INFR08013 INFORMATICS 1 - FUNCTIONAL PROGRAMMING
UNIVERSITY OF EDINBURGH COLLEGE OF SCIENCE AND ENGINEERING SCHOOL OF INFORMATICS INFR08013 INFORMATICS 1 - FUNCTIONAL PROGRAMMING Monday 15 th December 2014 14:30 to 16:30 INSTRUCTIONS TO CANDIDATES 1.
More informationDEVELOPED BY THE SHARE BIBLIOGRAPHIC SERVICES TEAM SPRING 2013 REVISED MAY
ITEM RECORDS DEVELOPED BY THE SHARE BIBLIOGRAPHIC SERVICES TEAM SPRING 2013 REVISED MAY 2014 Table of Contents General cataloging steps... 3 Matching... 3 General match points... 3 Creating Item Records...
More informationContract Programming For C++0x
Contract Programming For C++0x WG21/N1800 and J16/05-0060 Lawrence Crowl and Thorsten Ottosen lawrence.crowl@sun.com and nesotto@cs.aau.dk 2005-04-27 Overview This is an annotated version of the presentation
More informationBITS, BYTES, AND INTEGERS
BITS, BYTES, AND INTEGERS CS 045 Computer Organization and Architecture Prof. Donald J. Patterson Adapted from Bryant and O Hallaron, Computer Systems: A Programmer s Perspective, Third Edition ORIGINS
More informationIntroduction to Computers and C++ Programming p. 1 Computer Systems p. 2 Hardware p. 2 Software p. 7 High-Level Languages p. 8 Compilers p.
Introduction to Computers and C++ Programming p. 1 Computer Systems p. 2 Hardware p. 2 Software p. 7 High-Level Languages p. 8 Compilers p. 9 Self-Test Exercises p. 11 History Note p. 12 Programming and
More informationInput Space Partitioning
Input Space Partitioning Instructor : Ali Sharifara CSE 5321/4321 Summer 2017 CSE 5321/4321, Ali Sharifara, UTA 1 Input Space Partitioning Introduction Equivalence Partitioning Boundary-Value Analysis
More informationFinal exam. Final exam will be 12 problems, drop any 2. Cumulative up to and including week 14 (emphasis on weeks 9-14: classes & pointers)
Review Final exam Final exam will be 12 problems, drop any 2 Cumulative up to and including week 14 (emphasis on weeks 9-14: classes & pointers) 2 hours exam time, so 12 min per problem (midterm 2 had
More informationToday's Agenda. References. Open Closed Principle. CS 247: Software Engineering Principles. Object-Oriented Design Principles
CS 247: Software Engineering Principles Reading: none Object-Oriented Design Principles Today's Agenda Object-Oriented Design Principles - characteristics, properties, and advice for making decisions that
More informationThere are three basic elements in object oriented programming: encapsulation, inheritance and polymorphism.
More on Object Oriented Programming Concepts Functional, structured programming often results in programs that describe a hierarchy of tasks to be performed. Object oriented design, however, results in
More informationMPLAB Harmony Help - Sample Library
MPLAB Harmony Help - Sample Library MPLAB Harmony Integrated Software Framework v1.11 2013-2017 Microchip Technology Inc. All rights reserved. Sample Library Help Sample Library Help This section describes
More informationThe Hong Kong Polytechnic University Faculty of Engineering
The Hong Kong Polytechnic University Faculty of Engineering Programme(s) : BEng(Hons) in Transportation Systems Engineering (41481, 41481SY) BSc(Hons) in Internet and Multimedia Technologies (42477) Higher
More informationUniversity of Utah School of Computing
University of Utah School of Computing CS 1410 / CS 2000 Study Notes December 10, 2011 This study guide is designed to help you prepare and study the appropriate material for the final exam. For the multiple
More informationCSE 331 Midterm Exam Sample Solution 2/18/15
Question 1. (10 points) (Forward reasoning) Using forward reasoning, write an assertion in each blank space indicating what is known about the program state at that point, given the precondition and the
More informationTaxiBot New attributes Variables Math! TaxiBot
TaxiBot New attributes Variables Math! TaxiBot TaxiBot operates in the city BUT it charges you for its actions TaxiBot extends RobotSE TaxiBot displays how much is owed 1 TaxiBot charges Moving 1 space
More informationC#.Net. Course Contents. Course contents VT BizTalk. No exam, but laborations
, 1 C#.Net VT 2009 Course Contents C# 6 hp approx. BizTalk 1,5 hp approx. No exam, but laborations Course contents Architecture Visual Studio Syntax Classes Forms Class Libraries Inheritance Other C# essentials
More informationPrelim 1. CS 2110, March 15, 2016, 7:30 PM Total Question Name True False. Short Answer
Prelim 1 CS 2110, March 15, 2016, 7:30 PM 0 1 2 3 4 5 Total Question Name True False Short Answer Object- Oriented Recursion Loop Invariants Max 1 20 14 25 19 21 100 Score Grader The exam is closed book
More informationCS Spring 05 - MidTerm
CS1411-160 - Spring 05 - MidTerm March 8, 2005 1. When working at the keyboard, the user generates a newline character by pressing the Enter or Return key. 2. In the design of a flag-controlled loop, the
More informationITI 1120 Lab #9. Slides by: Diana Inkpen, Alan Williams, Daniel Amyot Some original material by Romelia Plesa
ITI 1120 Lab #9 Slides by: Diana Inkpen, Alan Williams, Daniel Amyot Some original material by Romelia Plesa 1 Objectives Review fundamental concepts Example: the Time class Exercises Modify the Time class
More informationRefresher: Interface Specifications. ADT Documentation. Set Represented as an Array. Representation Invariant, Abstraction Function
CS 247: Software Engineering Principles Representation Invariant, Abstraction Function Refresher: Interface Specifications An interface specification is a contract between a module's provider and the client
More information