1 Page

program6

Course: CS 200501, Fall 2009
School: Cal Poly Pomona
Rating:
 
 
 
 
 

Word Count: 297

Document Preview

6 CS Program 141 Winter 2005 Craig A. Rich A cash register contains a number of dollars, quarters, dimes, nickels and pennies, initially 0. Declare a class named Register that implements a type representing a cash register. Implementation NotesInstance Methods llDollars(int), llQuarters(int), llDimes(int), llNickels(int) and llPennies(int) add a given number of the corresponding denomination to the register....

Register Now

Unformatted Document Excerpt

Coursehero >> California >> Cal Poly Pomona >> CS 200501

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
6 CS Program 141 Winter 2005 Craig A. Rich A cash register contains a number of dollars, quarters, dimes, nickels and pennies, initially 0. Declare a class named Register that implements a type representing a cash register. Implementation NotesInstance Methods llDollars(int), llQuarters(int), llDimes(int), llNickels(int) and llPennies(int) add a given number of the corresponding denomination to the register. purchase(int, int) takes (in cents) a given purchase price and amount tendered, adds the amount tendered to the register, and removes the correct change from the register. It should also print the amount tendered, the purchase price and change amount; for example: tendered: 1100 price: 1022 change: 78 refund(int) takes (in cents) a given refund amount, and removes the refund amount from the register. It should also print the refund amount; for example: refund: 256 report() prints (in cents) the total amount taken (lls in and tendered), total amount given out (change and refunds), and total amount currently in the drawer, as well as the number of each denomination currently in the drawer; for example: Total Amount in: 10394 Total Amount out: 1646 Amount in Drawer: 8748 Money in Drawer: 75 dollars 27 quarters 42 dimes 24 nickels 33 pennies In the methods above, assume that all amounts are handled using the least number of dollars and coins possible, amounts tendered are never less than the purchase price, and the register is always lled with a sufcient number of...

Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Cal Poly Pomona - CS - 141
Program 7CS 141 Winter 2005 Craig A. RichIn this program, we modify the Register object class from Program 6 and implement a separate command-line user interface in a class named Program7. Register Implementation Notes-Instance Methods fillDolla
Cal Poly Pomona - CS - 200501
Program 7CS 141 Winter 2005 Craig A. RichIn this program, we modify the Register object class from Program 6 and implement a separate command-line user interface in a class named Program7. Register Implementation Notes-Instance Methods fillDolla
Cal Poly Pomona - EGR - 59902
EGR 599Advanced Engineering Math II Problem set #1_ LAST NAME, FIRST1. Use Newton's method with x(0) = 0 to compute x(2) for each of the following nonlinear systems: a. 4 x12 - 20x1 + 1 2 x +8=0 4 2 b. sin(4x1x2) 2x2 x1 = 0 4 - 1 2 x1 2 ( e -
Cal Poly Pomona - CE - 301
Lecture No. 2 Factors: How Time and Interest Affect Money 1. Single Payment FactorsA. F/P, P/FThe fundamental factor in engineering economy is the one that determines the amount of money F accumulated after n periods from a single present worth, P,
Wisconsin Milwaukee - D - 02
D02 Ordinary Dierential EquationsD02LZF NAG Fortran Library Routine DocumentNote. Before using this routine, please read the Users Note for your implementation to check the interpretation of bold italicised terms and other implementation-depende
Cal Poly Pomona - PHY - 132
Physics 132Final ExamWinter 2006Name Time allowed: 125 minutes. You may use two sheets of notes (8-1/2 x 11, both sides) and a calculator. No brimmed hats; no communication devices. Work the problems on separate sheets of paper and staple this
Cal Poly Pomona - PHY - 132
Physics 132 NameFinal ExamWinter 2001PLEASE READ THIS FIRST: Work the problems on separate sheets of paper and staple this sheet to the front. Read each problem carefully. Show your work and/or give brief explanations for all answers. (But ther
Cal Poly Pomona - PHY - 133
Physics 133 NameFinal ExamFall 2002PLEASE READ THIS FIRST: Work the problems on separate sheets of paper and staple this sheet to the front. Read each problem carefully. The credit you receive on each problem will depend at least as much on how
Cal Poly Pomona - PHY - 133
Physics 133Final ExamSpring 2005Name Time allowed: 125 minutes. You may use two sheets of notes (8-1/2 x 11, both sides) and a standard calculator. No communication devices. No hats. Work the problems on separate sheets of blank paper and stapl
Cal Poly Pomona - PHY - 131
Physics 131 NameFinal ExamWinter 2002PLEASE READ THIS FIRST: Work the problems on separate sheets of paper and staple this sheet to the front. Read each problem carefully and be sure to pay attention to any hints that are provided. The credit y
Cal Poly Pomona - PHY - 131
Physics 131 NameMidtermWinter 2004PLEASE READ THIS FIRST: Work the problems on separate sheets of paper and staple this sheet to the front. Read each problem carefully and be sure to pay attention to any hints that are provided. The credit you
Cal Poly Pomona - PHY - 131
Physics 131 NameFinal ExamWinter 2004You may use two sheets of notes (8-1/2 x 11, both sides) and a standard calculator. No communication or photographic devices. No hats. Work the problems on separate sheets of blank paper and staple this shee
Cal Poly Pomona - PHY - 132
Physics 132Final ExamSpring 2005Name Time allowed: 125 minutes. You may use two sheets of notes (8-1/2 x 11, both sides) and a standard calculator. No communication devices. No hats. Work the problems on separate sheets of blank paper and stapl
Cal Poly Pomona - PHY - 133
Physics 133Midterm ExamWinter 2005Name Time allowed: 55 minutes. You may use one sheet of notes (8-1/2 x 11, both sides) and a standard calculator. No communication or photographic devices. No hats. Work the problems on separate sheets of bla
Cal Poly Pomona - PHY - 133
Physics 133 Name MidtermFall 2003PLEASE READ THIS FIRST: Work the problems on separate sheets of paper and staple this sheet to the front. Read each problem carefully. The credit you receive on each problem will depend at least as much on how
Cal Poly Pomona - PHY - 131
Physics 131 Name PLEASE READ THIS FIRST:FinalFall 2006 Time limit: 125 minutes Please remove hats and turn off and put away any communication devices. You may use two sheets of prepared notes (8 x 11, both sides). Please staple it to the bac
Cal Poly Pomona - PHY - 131
Physics 131 NameFinal ExamFall 2004You may use two sheets of notes (8-1/2 x 11, both sides) and a standard calculator. No communication or photographic devices. No hats. Work the problems on separate sheets of blank paper and staple this sheet
Cal Poly Pomona - PHY - 132
Physics 132 NameMidtermWinter 2007PLEASE READ THIS FIRST: Time limit: 55 minutes Please remove your hat and turn off and put away any communication devices. You may use one sheet of notes (8 x 11, both sides). Please staple it to the back o
Cal Poly Pomona - EGR - 509
% Plot the Fourier expansion of 100 % n=1:51; bn=400.0./(2*n-1)/pi; x=0:.002:1;fx=x;nv=length(x); for i=1:nv; xi=x(i);si=pi*(2*n-1)*xi; fx(i)= bn*(sin(si)'; end plot(x,fx) xlabel('x/L');ylabel('Fourier expansion of 100') __ imenu=menu('3-D plot',. 'M
Cal Poly Pomona - BIO - 431
0015322729282025312124231829272226191832251928201725292315181822262021221922152723222017202126251524183224211623272124203029313631333530252420181532232021242920221127
Cal Poly Pomona - BOT - 125
BOT 125 - Plant Morphology Fall 1992 Second Midterm ExamAnswer all questions on the Scantron sheet. Please keep this sheet, and turn in the Scantron only. Please write your lab section on the Scantron (sect. 1 = TTh 1-4, sect. 2 = MW 12-3). There i
Cal Poly Pomona - POSTERS - 2008
To Click or not To ClickNina Abramzon Physics Department. California State Polytechnic University, Pomona, California, USA.Results The Question:Do clickers show an improvement over cards in students learning the following concepts: 1. Coulombs for
Cal Poly Pomona - BOT - 125
BOT 125 - Plant Morphology Summer 1992 Second Midterm Exam Answer all questions on the Scantron sheet. Please keep this sheet, and turn in the Scantron only. There is only one correct answer to each question. 1. _ are always haploid. a. Gametangia b.
Cal Poly Pomona - CS - 460
Final ExamCS 460 Winter 2007 Craig A. Rich1 Answer each of the questions about the stream modes of block cipher operation. a) Why is electronic codebook (ECB) mode not recommended for most uses? b) What are two advantages of having a plaintext ti
Cal Poly Pomona - PHY - 133
Physics 133 NameMidtermSpring 2002PLEASE READ THIS FIRST: Work the problems on separate sheets of paper and staple this sheet to the front. Read each problem carefully. The credit you receive on each problem will depend at least as much on how
Cal Poly Pomona - PHY - 133
Physics 133 NameFinal ExamFall 2001BE SURE TO READ THIS FIRST: Work the problems on separate sheets of paper and staple this sheet to the front. Read each problem carefully. Support all answers-especially the easy ones-by showing your work or,
Cal Poly Pomona - PHY - 132
Physics 132 NameSecond Midterm ExamSpring 2000PLEASE READ THIS FIRST: Work the problems on separate sheets of paper and staple this sheet to the front. Read each problem carefully. Show your work and/or give explanations for all answers. Make s
Cal Poly Pomona - EC - 201
Table 2 The Various Measures of Cost: Thirsty Thelmas Lemonade StandTHE VARIOUS MEASURES OF COST Costs of production may be divided into fixed costs and variable costs.Copyright2004 South- estern WCopyright 2004 South-Western/Fixed and Vari
Cal Poly Pomona - CS - 240
Greedy Graph AlgorithmsCS 240 Fall 1992 Craig A. RichSingle-source least-cost paths problem Dijkstras algorithm nds least-cost paths from vertex SOURCE to every vertex in the digraph represented by the labeled adjacency matrix A. LEAST(j) is the
Cal Poly Pomona - EC - 201
MonopolyWhile a competitive firm is a price taker, a monopoly firm is a price maker.1MonopolyuAfirm is considered a monopoly if . . . it is the sole seller of its product. its product does not have close substitutes.2Why Monopolies Arise
Cal Poly Pomona - CS - 198904
Program 4CS 231 Fall 1989 Craig A. RichAdd implementations of the operations in the following abstract data type to the digraph ADT module created in program 3. These operations read and operate on labeled digraphs of type LABELED DIGRAPH. digrap
Cal Poly Pomona - CS - 231
Program 4CS 231 Fall 1989 Craig A. RichAdd implementations of the operations in the following abstract data type to the digraph ADT module created in program 3. These operations read and operate on labeled digraphs of type LABELED DIGRAPH. digrap
Cal Poly Pomona - EC - 201
Problem Set #5 suggested answersCal Poly Pomona, EC 201- Bruce Brown1) Non-excludability (inability to exclude people from consuming). 2) Pure Public Goods Goods Excludable? No Rival? No Pure Private Goods Yes Yes Common Resources No Yes Natural
Cal Poly Pomona - CS - 460
seedsecretHMACA(1)|secretseedHMACsecretHMACA(2)|secretseedHMACsecretHMACA(3 ) |secretseedHMAC length= hash sizeFigure 17.7TLS Function P_hash (secret, seed)
Cal Poly Pomona - CS - 199102
Homework 2CS 240 Spring 1991 Craig A. Rich1 In each of the following, give the simplest function f (n) such that the function T (n) expressed by the recurrence equations is big-theta of f (n). a) T (n) = b) T (n) = c) T (n) = 1, if n = 1; 3T (n/2
Cal Poly Pomona - CS - 240
Homework 2CS 240 Spring 1991 Craig A. Rich1 In each of the following, give the simplest function f (n) such that the function T (n) expressed by the recurrence equations is big-theta of f (n). a) T (n) = b) T (n) = c) T (n) = 1, if n = 1; 3T (n/2
Cal Poly Pomona - CS - 141
Final ExamCS 141 Winter 1991 Craig A. RichName: 1 Consider a binary tree whose elements are characters. Assuming characters and pointers require 1 and 4 bytes of storage respectively, calculate the total number of bytes required to store a binary
Cal Poly Pomona - CS - 199101
Final ExamCS 141 Winter 1991 Craig A. RichName: 1 Consider a binary tree whose elements are characters. Assuming characters and pointers require 1 and 4 bytes of storage respectively, calculate the total number of bytes required to store a binary
Cal Poly Pomona - CS - 441
Project SDDCS 441 Spring 1995 Craig A. RichThe following S-attributed syntax-directed definition defines Pure Lisp, in which most grammar symbols have one associated attribute and each production has one associated semantic rule. All attributes a
Cal Poly Pomona - EGR - 511
Chapter 2Iterative Methods for Solving Sets of Equations 2.4 Gradient Methods2.4.1 Gradients and Hessian Gradient methods use derivative information of a function to locate optima. At the location where the first derivative is equal to zero, the fu
Cal Poly Pomona - COURSE - 3
->example: Pr Pr Pr / ( x)(Hx v Kx)1. Fa 2. (x)(Fx Gx) 3. (x)(Gx Hx)->example: Pr / Fb ( x)Gx1. (x)(Fx Gx)- UI, EG apply to WHOLE lines 1. (x)Fx (x)Gx 2. Fa Ga 1. (x)(Fx Gx) 2. Fa Ga 1. Fb Gb 2. Fb ( x)Gx 1. Fb Gb 2. ( x)(Fx G
Cal Poly Pomona - MATH - 316
Geometric Interpretation of the Vector DerivativeLet be a smoothly varying, vector-valued function of a single (scalar) evolution variable , having both smoothly varying magnitude and direction At any instant during the continuing evolution of th
Cal Poly Pomona - MATH - 316
1/2Derivative & Rotation Rate Vector of a Unit Vector = ()relative rotation plane1 = ()1u = u() ; > o111 = uouo = u(o) plane within which the unit vector has rotated = () ~ non-negative of rotation relative to reference
Cal Poly Pomona - MATH - 316
Vector Derivative expressed in terms of its smoothly varying (time dependent) magnitude & direction (unit vector) functions.u t = u t u t du = u = uu + uu dtA Vector's Derivative is determined by its current magnitude & direction, as well as
Cal Poly Pomona - BIO - 431
Introduction to Geiger Counters A Geiger counter (Geiger-Muller tube) is a device used for the detection and measurement of all types of radiation: alpha, beta and gamma radiation. Basically it consists of a pair of electrodes surrounded by a gas. Th
Cal Poly Pomona - CHE - 441
1) A 1000 lb-mole per hour mixture of 5% methane, 20% ethane, 25% propane, 30% n-butane, and 20% n-pentane at 14.7 psia and 90F is to be compressed first to 50 psia, then to 200 psia using a two-stage compressor system. For the second stage, 938.3 lb
Cal Poly Pomona - CS - 441
Project Phase 1CS 441 Spring 1995 Craig A. Richgeneric - T y p e s -type Universe is private ; type Order is private ; -- O p e r a t i o n s -with function Compare ( Left, Right : Universe ) return Order is <> ; with function Equal ( Compare : O
Cal Poly Pomona - CS - 198904
Project Phase 2CS 441 Fall 1989 Craig A. RichConsider the following S-attributed syntax-directed definition, in which each grammar symbol has one associated attribute named val and each production has one associated semantic rule. All attributes
Cal Poly Pomona - CS - 441
Project Phase 2CS 441 Fall 1989 Craig A. RichConsider the following S-attributed syntax-directed definition, in which each grammar symbol has one associated attribute named val and each production has one associated semantic rule. All attributes
Cal Poly Pomona - CS - 441
Final ExamCS 441 Fall 1994 Craig A. Rich1 Consider the following CFG G: E LEAE+ E LEM E* Ed L A M a) Construct the canonical collection C of sets of LR(0) items which results from G after steps IIII of the SLR syntax analyzer construction. b)
Cal Poly Pomona - CS - 441
Project Phase 1CS 441 Fall 1992 Craig A. RichA Pure Lisp interpreter will be constructed of several packages in two phases. In order to insure synchronization of the phases, the constants and types which are used throughout the interpreter will b
Cal Poly Pomona - CS - 441
MidtermCS 441 Spring 1992 Craig A. RichName: 1 Let N = (ITEMS, , , i0 , F ) be the NFA that is constructed from the following CFG after steps III of the SLR syntax analyzer construction. S A B C a) Compute (A B, ). A|C AcB | AaC | B | a Bb |
Cal Poly Pomona - CS - 441
Project Phase 2CS 441 Spring 1993 Craig A. RichConsider the S-attributed syntax-directed denition for Pure Lisp, in which most grammar symbols have one associated attribute of type TREE and each production has one associated semantic rule. The se
Cal Poly Pomona - CS - 441
Final ExamCS 441 Fall 1991 Craig A. RichName: 1 Consider the following CFG G which generates a language of tours: Tour | Tour Move ; Move rotate literal | walk literal Construct an S-attributed attribute grammar from the underlying CFG G which
Cal Poly Pomona - CS - 441
Project SDDCS 441 Fall 1992 Craig A. RichThe following S-attributed syntax-directed denition denes Pure Lisp, in which most grammar symbols have one associated attribute and each production has one associated semantic rule. All attributes are of
Cal Poly Pomona - CS - 441
Project SDDCS 441 Winter 1994 Craig A. RichThe following S-attributed syntax-directed denition denes Pure Lisp, in which most grammar symbols have one associated attribute and each production has one associated semantic rule. All attributes are o
Cal Poly Pomona - CS - 441
Computer Science 441 (Section 1CRN 20816) (Section 2CRN 20817) Spring 1993 Compiler Design Instructor Craig A. Rich Oce: Bldg. 8, Room 40 Oce Hours: Mon,Wed 23:30; Tue,Thu 1112 Phone: (909)869-3447 Electronic mail: carich Section 1Lecture Meetings Ti
Cal Poly Pomona - CS - 441
Homework 3CS 441 Spring 1995 Craig A. Rich1 Given the following SDD: Productions LLS L S W C loop L end loop ; S id := E ; W while CE <E EE +T ET T T F T F F (E ) F id F literal Semantic Ruleswriteln (GOTO top); write (end: ); writeln (STO
Cal Poly Pomona - CS - 441
Homework 3CS 441 Fall 1994 Craig A. Rich1 Given the following SDD: Productions LLS L S W C loop L end loop ; S id := E ; W while CE <E EE +T ET T T F T F F (E ) F id F literal Semantic Ruleswriteln (GOTO top); write (end: ); writeln (STORE
Cal Poly Pomona - CS - 441
Computer Science 441 Section 1 (CRN 12013) Winter 1994 Compiler Design Instructor Craig A. Rich Oce: Bldg. 8, Room 40 Oce Hours: Mon,Wed 10:3012; Tue,Thu 12 Phone: (909)869-3447 Electronic mail: carich@csupomona.edu Lecture Meetings Time: Mon,Wed,Fri
Cal Poly Pomona - CS - 441
Computer Science 441 Section 1 (CRN 41964) Fall 1994 Compiler Design Instructor Craig A. Rich Oce: Bldg. 8, Room 40 Oce Hours: Mon,Wed 1112; Tue,Thu 2:304 Phone: (909)869-3447 Electronic mail: carich@csupomona.edu Lecture Meetings Time: Tue,Thu 4:005