Page 372 - Introduction to Programming with Java: A Problem Solving Approach
P. 372
338
Chapter 8 Software Engineering
10
public static void main(String[] args)
11
{
12
Shirt shirt1 = new Shirt();
Shirt shirt2 = new Shirt();
System.out.println();
shirt1.display();
shirt2.display();
// end main
13
14
15
16
17
18
}
19
}
// end ShirtDriver
9
10
import java.util.Scanner;
11
public class Shirt
12
{
13
private String name;
private String primary;
private String trim;
14
// person's name
// shirt's primary color
// shirt's trim color
//*********************************************************
public Shirt()
15
16
17
18
19
20
{
21
Scanner stdIn = new Scanner(System.in);
System.out.print("Enter person's name: ");
this.name = stdIn.nextLine();
this.primary = selectColor("primary");
this.trim = selectColor("trim");
// end constructor
22
23
24
25
26
27
}
28
29
//*********************************************************
30
31
public void display()
1 /**************************************************************
2 *
3 *
4*
5
ShirtDriver.java
Dean & Dean
This is a driver for the Shirt class.
**************************************************************/
6
7
8
public class ShirtDriver
9{
1
/************************************************************
2
*
3
Shirt.java
Dean & Dean
This class stores and displays color choices for
a sports-uniform shirt.
************************************************************/
4*
Apago PDF Enhancer
5
*
6
*
7
8
*
*