package ch2_period4;
import kareltherobot.*;

public class Ch2_period4
{

private int width, length;

// this method doesn't return anything:
// you call this from the word "void"
public void method1()
{
}

// the "int" indicates that the method will return
// an int
public int method2()
{ int m = 5;
return m;
}

// illustrating creating an object in Java:
public void method3()
{ Robot k = new Robot(1, 3, Directions.South, 5);
}

// accessor method:
// accesses one or more private instance variables
public int getWidth()
{ return width;
}

// mutator method:
// changes one or more private instance variables
public void increaseWidth()
{ width = width * 2;
}

public static void main(String[] args) {
// "Monday" is a parameter:
System.out.println("Monday");
String name = "Metuchen";
// length is a method that has no parameters:
int len = name.length();
System.out.println(name + " has " + len + " characters.");
String river = "Mississippi";
river = river.replace("issipp", "our");
System.out.print(river);
// calling a method that returns an int;
// be sure to store any values that are returned
Ch2_period4 c = new Ch2_period4();
int value = c.method2();
System.out.println("\nThe numbered returned by method2 is " + value);
c.method3();
}
}