CPS 1 - Spring, 2000 - Ramm 2/4/00 #9

2. An Introduction to Programming: Coding Decision Trees

Strings and String Manipulation

3 Numerical Computation and the Study of Functions

  • New Classes for Numbers
    (Have used IntField)
    public class IntField extends TextField
    {
        public IntField();
        public IntField(int size);
        public void setInt(int number);
        public int getInt();
    }
    public class DoubleField extends TextField
    {
        public DoubleField();
        public DoubleField(int size);
        public void setDouble(double num);
        public Double getDouble();
    }
    

  • Using DoubleField in Example
    Numbers.java, Numbers.html

  • Iteration by Button Pushing
    • Often need to repeat a calculation with minor changes
    • Sometimes refine previous solution
    • Somtimes calculates sucessive values in series
    • Can do this under control of a button

  • Interest Calculation Example
    ButCompound.java, ButCompound.html