Java Reference
In-Depth Information
18 street = aStreet;
19 city = aCity;
20 state = aState;
21 zip = aZip;
22 }
23
24 /**
25 Formats the address.
26 @return the address as a string with three lines
27 */
28 public String format()
29 {
30 return name + Ð\nÑ + street + Ð\nÑ
31 + city + Ð, Ñ + state + Ð
Ñ + zip;
32 }
33
34 private String name;
35 private String street;
36 private String city;
37 private String state;
38 private String zip;
39 }
555
556
S ELF C HECK
10. Which class is responsible for computing the amount due? What are
its collaborators for this task?
11. Why do the format methods return String objects instead of
directly printing to System.out ?
12.5 Case Study: An Automatic Teller Machine
12.5.1 Requirements
The purpose of this project is to design a simulation of an automatic teller machine
(ATM). The ATM is used by the customers of a bank. Each customer has two
accounts: a checking account and a savings account. Each customer also has a
customer number and a personal identification number (PIN); both are required to
Search WWH ::




Custom Search