Define a class called Counter whose objects count things. An object of this class records a count that is a nonnegative integer. Include methods to set the counter to 0, to increase the count by 1, and to decrease the count by 1. Include an accessor method that returns the current count value and a method that outputs the count to the screen. Write a program to test
counter.reset();
counter.inc();
counter.inc();
counter.dec();
counter.output();
因為加七次減一次,所以是六次
導覽連結: 首頁 -> 標題: Lab counter
2007年12月7日 星期五
Lab counter
ARTICLE LABELS: Java
訂閱:
張貼留言 (Atom)
0 COMMENT:
張貼留言