资源简介
SSD3 所有练习答案
SSD3 所有练习答案
SSD3 所有练习答案
代码片段和文件信息
import java.io.*;
import java.util.*;
/* DOCUMENT THIS CLASS */
public class StockApplication {
/* Standard input stream */
private static BufferedReader stdIn =
new BufferedReader(new InputStreamReader(System.in));
/* Standard output stream */
private static PrintWriter stdOut =
new PrintWriter(System.out true);
/* Standard error stream */
private static PrintWriter stdErr =
new PrintWriter(System.err true);
/* DOCUMENT THIS PUBLIC METHOD */
public static void main(String[] args) throws IOException {
Stock stock = readStock();
stdOut.println(stock.getxml());
}
/* DOCUMENT THIS PUBLIC METHOD */
public static Stock readStock() throws IOException {
/* Delimiter of stock data */
final String DELIM = “_“;
String symbol = ““;
String name = ““;
double highestPrice = 0.0;
double lowestPrice = 0.0;
double lastPrice = 0.0;
/* PLACE YOUR CODE HERE */
do {
String temp = stdIn.readLine();
StringTokenizer tnz = new StringTokenizer(temp DELIM);
int justice = tnz.countTokens();
if(justice != 5) {
stdErr.println(“Incomplete data“);
continue;
}
else {
try {
symbol = tnz.nextToken();
name = tnz.nextToken();
highestPrice = Double.parseDouble(tnz.nextToken());
lowestPrice = Double.parseDouble(tnz.nextToken());
lastPrice = Double.parseDouble(tnz.nextToken());
break;
}
catch (Exception e) {
stdErr.println(“Incorrect data“);
}
}
}while(true);
return new Stock(symbol name highestPrice lowestPrice lastPrice);
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1630 2008-01-10 10:48 SSD3作业\Exam 1\StockApplication.java
..A.SH. 5632 2008-01-15 12:32 SSD3作业\Exam 1\Thumbs.db
文件 118556 2008-01-12 01:00 SSD3作业\Exam 1\uml-loan-system.jpg
文件 1935 2008-01-11 19:53 SSD3作业\Exam 2\Manager.java
文件 2446 2007-12-17 22:56 SSD3作业\Exercise 1\ShoppingCartApplication.java
..A.SH. 4608 2008-01-15 20:57 SSD3作业\Exercise 2\Thumbs.db
文件 234901 2007-12-23 14:28 SSD3作业\Exercise 2\uml-gou-cof.jpg
文件 1557 2007-12-23 14:29 SSD3作业\Exercise 3\Coffee.java
文件 1056 2007-12-23 14:30 SSD3作业\Exercise 3\CoffeeBrewer.java
文件 649 2007-12-23 14:30 SSD3作业\Exercise 3\OrderItem.java
文件 1297 2007-12-23 14:30 SSD3作业\Exercise 3\Product.java
文件 623 2007-12-23 23:16 SSD3作业\Exercise 4\Catalog.java
文件 7752 2007-12-24 12:55 SSD3作业\Exercise 4\GourmetCoffee.java
文件 1041 2007-12-24 12:23 SSD3作业\Exercise 4\Order.java
文件 351 2007-12-23 14:50 SSD3作业\Exercise 4\Sales.java
文件 7752 2007-12-24 12:55 SSD3作业\Exercise 5\GourmetCoffee.java
文件 1762 2007-12-24 12:39 SSD3作业\Exercise 5\HTMLSalesFormatter.java
文件 1366 2007-12-24 12:38 SSD3作业\Exercise 5\PlainTextSalesFormatter.java
文件 85 2007-12-24 12:13 SSD3作业\Exercise 5\SalesFormatter.java
文件 1615 2007-12-24 12:40 SSD3作业\Exercise 5\xm
文件 1842 2007-12-17 22:56 SSD3作业\Practical Quiz 1\ICarnegieInfoApplication.java
文件 1260 2007-12-17 22:56 SSD3作业\Practical Quiz 1\SecondsCalculator.java
文件 1086 2007-12-17 22:56 SSD3作业\Practical Quiz 2\DebuggingReport.txt
文件 4488 2007-12-17 22:57 SSD3作业\Practical Quiz 2\DNASequence.java
文件 30957 2007-12-20 11:46 SSD3作业\Practical Quiz 3\animals-uml.jpg
文件 99229 2007-12-20 11:47 SSD3作业\Practical Quiz 3\computer-uml.jpg
..A.SH. 7168 2008-11-15 12:14 SSD3作业\Practical Quiz 3\Thumbs.db
..A.SH. 4608 2008-01-15 20:56 SSD3作业\Practical Quiz 4\Thumbs.db
文件 89925 2007-12-20 11:47 SSD3作业\Practical Quiz 4\uml-customer-system.jpg
文件 2770 2008-01-12 01:02 SSD3作业\Practical Quiz 5\TestAthleteScores.java
............此处省略26个文件信息
- 上一篇:rk3288 双屏异显
- 下一篇:CCS2详细例程 DSP作业 CCS2使用教程
评论
共有 条评论