Overdraftfee q minimize the use of static variables

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: lic static final double OVERDRAFT_FEE = 5; // Refer to it as BankAccount.OVERDRAFT_FEE } q༇  Minimize the use of static variables (static final variables are ok) Examples in the Java library n༆  Static variables in the System class: q༇  q༇  System.in and System.out. And in the Java Math class: public class Math { public static final double PI = 3.141592653589793; public static final double E = 2.718281828459045; ... } Creating a Java Package Rectangle.java Shape.java Java packages Savitch Chapter 6.7 // a shape stores its position // on the screen public abstract class Shape { int x,y; public Shape(int x, int y){ this.x = x; this.y = y; } } Circle.java public class Rectangle extends Shape { double width, height; public Rectangle(int x, int y, double h, double w ) { super(x, y); width = w; height = h; } } public class Circle extends Shape { double radius; public Circle(int x, int y, double r) { super(x, y); radius = r; } } 2 4/27/13 Some motivation n༆  Java packages A few observations about the classes/ interfaces on the previous slide: q༇  q༇  q༇  n...
View Full Document

This note was uploaded on 02/10/2014 for the course CS 161 taught by Professor Boese during the Spring '08 term at Colorado State.

Ask a homework question - tutors are online