Abstract Data Types and Java Classes - PowerPoint PPT Presentation

About This Presentation
Title:

Abstract Data Types and Java Classes

Description:

Your assignment: Study the Throttle class defined in your text pages 36-56, esp. ... Throttle class : specification, implementation and testing. Packages ... – PowerPoint PPT presentation

Number of Views:82
Avg rating:3.0/5.0
Slides: 7
Provided by: cseBu
Learn more at: https://cse.buffalo.edu
Category:

less

Transcript and Presenter's Notes

Title: Abstract Data Types and Java Classes


1
Abstract Data Types and Java Classes
  • B.Ramamurthy

2
Introduction
  • Last class we developed a Rectangle interface and
    an implementation for it.
  • We will examine some more standard methods to be
    added to a class.
  • Also look into creating packages.
  • Your assignment Study the Throttle class
    defined in your text pages 36-56, esp. p.45,46
    (design and code)

3
Topics of Discussion
  • Throttle class specification, implementation
    and testing.
  • Packages
  • Location class
  • Specialty equals method and clone method
  • Examples

4
Throttle
Throttle
int top int position
//constructor public Throttle (int size) //
accessor method public double getFlow() //predic
ate method public boolean isOn() // service
methods public void shift(int amount) public
void shutOff()
5
Location (class)
  • Location class is illustrates two important
    features that you should implement in your
    classes equals method and clone method.

6
Location
Location
double x double y
Location (double xInit, double yInit) Object
clone() static double distance (Location p1,
Location p2) boolean equals(Object obj) double
getX() double getY() static Location
midPoint(Location P1, Location p2) void
rotate90() void shift(double xAmt, double
yAmt) String toString()
Write a Comment
User Comments (0)
About PowerShow.com