COMPSCI 61B Study Guide - Midterm Guide: Interval Class, Dont, Doubly Linked List

37 views7 pages
8 Jan 2019
School
Professor

Document Summary

Given below is a framework for an intervalenumeration class for successively returning integer values in an interval in increasing order. For examples, if this represents the interval [3,5], the enumeration should return first an integer object representing 3, then an integer object representing 4, then an integer object representing 5. Complete the method bodies on the next page. // overview: this class defines nonempty intervals of consecutive integers, Intervals are immutable. public class interval { public interval (int a, int b) throws illegalargumentexception{ // this interval represents all the integers between mylow and myhigh, // inclusive, with mylow <= myhigh. private int mylow, myhigh; // requires: this interval is not modified while the enumeration returned. // effects: returns an enumeration of integer objects corresponding. // to the values in this interval, enumerated lowest to highest. public enumeration values ( ) { return new intervalenumeration ( ); Fill in the following definitions: private class intervalenumeration ( ) implements enumeration {

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