TestShirt - Shirt two = new Shirt();...

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

View Full Document Right Arrow Icon
class Shirt { private double Collar; private int Sleeve; private String Material; Shirt(double c,int s, String m) { Collar = c; Sleeve = s; Material = m; } Shirt() { Collar = 17.5; Sleeve = 38; Material = "Cotton"; } public void setCollar(int c) { Collar = c; } public double getCollar() { return Collar; } public void setSleeve(int s) { Sleeve = s; } public int getSleeve() { return Sleeve; } public void setMaterial(String m) { Material = m; } public String getMaterial() { return Material; }} public class TestShirt { public static void main(String[]args) { Shirt one = new Shirt(20,40,"Cotton");
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Shirt two = new Shirt(); System.out.println("Constructor 1: Collar Size: " + one.getCollar()); System.out.println("Constructor 1: Sleeve Length: " + one.getSleeve()); System.out.println("Constructor 1: Material: " + one.getMaterial()); System.out.println("Constructor 2: Collar Size: " + two.getCollar()); System.out.println("Constructor 2: Sleeve Length: " + two.getSleeve()); System.out.println("Constructor 2: Material: " + two.getMaterial()); }}...
View Full Document

This note was uploaded on 10/04/2010 for the course COMPUTER S 106 taught by Professor Moore during the Spring '08 term at Clark Atlanta.

Ask a homework question - tutors are online