Main method:
public class Problem2
{
public static void main( String[] args )
{
Centimeters test = new Centimeters();
test.setInches(6);
test.calculateCentimeters( );
test.print();
}
}
------------------------------------------------
Code for the centimeters file:
public class Centimeters
{
private double centimeter;
private int inches;
public void setInches(int inch)
{
inches = inch;
}
public void calculateCentimeters( )
{
centimeter = (2.54 * inches);
}
public void print( )
{
System.out.println("Inches is equal to : " + inches);
System.out.println("When the number of inches is changed to centimeters it equals : " + centimeter);
}
}