Page 272 - Introduction to Programming with Java: A Problem Solving Approach
P. 272
238
Chapter 6 Object-Oriented Programming
13
14
15
16
17
18
19
1
}
} //
myPc.assignRamSize();
myPc.assignDiskSize();
myPc.assignProcessor();
myPc.calculateCost();
myPc.printSpecification();
// end main
end class PcDesignDriver
9
10
public class PcDesign
11
{
12
private long ramSize = (long) 1000000000.0;
private long diskSize;
private String processor;
private double cost;
Apago PDF Enhancer
//********************************************************
void assignRamSize()
13
14
15
16
17
18
19
20
{
21
this.ramSize = (long) 2000000000.0;
} // end assignRamSize
22
23
24
//********************************************************
25
26
void assignDiskSize()
27
{
28
Scanner stdIn = new Scanner(System.in);
long diskSize;
diskSize = stdIn.nextLong();
// end assignDiskSize
//********************************************************
29
30
31
}
32
33
34
35
void assignProcessor()
36
{
}
37
Scanner stdIn = new Scanner(System.in);
this.processor = stdIn.nextLine();
// end assignProcessor
38
39
40
41
//********************************************************
42
2
*
3
PcDesign.java
Dean & Dean
This class collects specifications for a PC.
***********************************************************/
4*
5
*
6
7
8
import java.util.Scanner;
/***********************************************************
*