Page 323 - Introduction to Programming with Java: A Problem Solving Approach
P. 323
Exercises 289 58 //*********************************************************
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
public boolean isTight()
107
}
// end specifyTransmission
{
}
// end isTight
{
}
// end specifyEngine
{
boolean tight = false;
if (this.frame == 'A' && this.body.equals("4-door"))
{
}
}
else
{
}
// end if tight else
tight = true;
return tight;
//*********************************************************
public void specifyEngine(boolean tight)
Scanner stdIn = new Scanner(System.in);
if (tight)
{
while (this.hp != 85 && this.hp != 115)
{
System.out.print("Enter HP (85 or 115): ");
tAhips.ahpg=ostdPInD.nFextIEntn()h; ancer } // end while
while (this.hp != 85 && this.hp != 115 && this.hp != 165)
{
System.out.print("Enter HP (85, 115, 165): ");
this.hp = stdIn.nextInt();
} // end while
stdIn.nextLine(); // flush \r\n after nextInt
//*********************************************************
public void specifyTransmission()
Scanner stdIn = new Scanner(System.in);
System.out.print("Automatic (y/n?): ");
if (stdIn.nextLine().charAt(0) == 'y')
{
}
this.automatic = true;