📄 coffeeshop.java
字号:
import java.io.*;
import java.util.*;
import java.text.*;
import javagently.*;
import myutilities.*;
class CoffeeShop {
/* A test Coffee Shop program by J M Bishop Oct 1996
* -------------------------- Java 1.1 October 1997
* updated August 2000
* checks that data can be read into the
* Coffee and Batch classes, and printed out again.
* Uses an array to store several objects of each.
*/
public static void main (String [] args) throws IOException {
Stream in = Filer.open("coffee.dat");
Coffee C [ ] = new Coffee [10];
int kind;
// Introductory messages
System.out.println("Nelson's Coffee Shop");
System.out.println("Inventory control");
System.out.println("Stocking from coffee.data");
// Read in the data for the coffees
for (kind=0; kind<10; kind++) {
try {
C[kind] = new Coffee ();
C[kind].prepareToStock (in);
boolean morebatches = true;
while (morebatches)
morebatches = C[kind].newBatchIn (in);
}
catch (EOFException e) {
System.out.println("That's the shop stocked for today\n");
break;
}
}
// Display all the details
DateFormat DF = DateFormat.getDateInstance(DateFormat.FULL);
System.out.println("The contents on " + DF.format(new Date()));
for (int i = 0; i<kind; i++)
C[i].display();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -