CSCA48H3 Study Guide - Midterm Guide: Call Stack, Memory Address, Init

95 views5 pages
16 Oct 2018
School
Course
Professor

Document Summary

Write a class called quartermachine which represents a change machine (which takes bills and dispenses quarters). If the value passed to the quartermachine class constructor is not a non-negative integer, a typeerror should be raised. The quartermachine class has a method get change that takes a bill (either or ) and returns the number of quarters dispensed. The quarters and cash attributes are updated accordingly. If the value passed to get change is not 5 or 10, an invalidbillerror should be raised. If there are not enough quarters to be dispensed, a nochangeerror should be raised. If get change raises an error, both attributes should remain unchanged. The quartermachine object should show up in a print statement as follows: ( quarters, $). For instance, a quartermachine object with 30 quarters and should be printed as (30 quarters, )

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers

Related Documents

Related Questions