题目内容

What’s the punishment if a person loses a book?

查看答案
更多问题

阅读以下说明和Java代码,回答问题
[说明]
对多个元素的聚合进行遍历访问时,需要依次推移元素,例如对数组通过递增下标的方式,数组下标功能抽象化、一般化的结果就称为迭代器(Iterator)。模式以下程序模拟将书籍(Book)放到书架(BookShelf)上并依次输出书名。这样就要涉及到遍历整个书架的过程。使用迭代器Iterator实现。图6-1显示了各个类间的关系。以下是JAVA语言实现,能够正确编译通过。
[图6-1]
[Java代码]
//Iterator. java文件
public interface Iterator {
public abstract boolean hasNext();
public abstract Object next();
}
//Aggregate. java文件
public interface Aggregate {
public abstract Iterator iterator();
}
//Book. java
public class Book {
//省略具体方法和属性
}
//BookshelfIterator. java文件
public class Bookshelf工terator (1) Iterator{
private BookShelf bookShelf;
private int index;
public BookshelfIterator(BookShelf bookShelf) {
this. bookShelf = bookShelf;
this. index = 0;
}
public boolean hasNext(){//判断是否还有下一个元素
if(index < bookShelf. getLength()){
return true;
}else{
return false;
}
}
public Object next()f//取得下一个元素
Book book = bookShelf. getBookAt(index);
index++;
return book;
}
}
//BookShelf. java
import java. util. Vector;
public class BookShelf {
private Vector books;
public BookShelf(int initialsize){
this. books = new Vector(initialsize);
}
public Book getBookAt(int index){
return(Book)books.get(index);
}
public int getLength(){
return books.size();
}
public Iterator iterator(){
return new BookShelfIterator((2) );
}
}
//Main. java文件
public class Main {
public static void main(String args){
BookShelf bookShelf = new BookShelf(4);
//将书籍上架,省略代码
Iterator it = bookShelf. (3) ;
while((4) ){//遍历书架,输出书名
Book book = (Book)it. (5) ;
System.out.printin(" "+book.getName());
}
}
}

If you arrive in the town by train, you’d better______to the hotel.

Section D
A few years ago, people in England voted for the greatest person of all time from their country. They were not just voting for the most famous person ever. They were voting for the people who had an impact on history. During this vote, anyone could add a person’s name to the list, so the final list of names was quite long. It included people who were famous and unknown, rich and poor, loved and hated.
Before the final deadline, about one million people filled out this survey. The Brits (英国人) on the final list included many people famous not only from England, but around the world as well. For example, Princess Diana, Tony Blair, John Lennon, and Shakespeare were four famous people on the list. Although three of these people ranked high on the list, none was chosen as the greatest Brit. In the end, the winner was Winston Churchill, who received more than 400, 000 votes.
Why did so many people think Churchill was great? He led England as Prime Minister during World War II. During the war, Germany sent planes to bomb England, and at the time, many people were afraid Germany would win the war. But Churchill gave the people in England hope through his speeches. He also worked with Roosevelt in the United States and Stalin in Russia to win the war against Hitler, so he became an important man in world history as well.
Churchill is quite famous for things that he said and wrote. In fact, he won the Nobel Prize in literature for his writing. Some things Churchill said were humorous while other things were serious. Also some things he said have become common sayings in English. For example, he was the first person to use the words "the Iron Curtain" to talk about Russia’s control of Eastern Europe. Some of Churchill’s most famous quotes are " It is no use saying, ' We' re doing our best.' You have got to succeed in doing what is necessary, " and "Never, never, never give up. " Many quotes from Winston Churchill can be found in books like the Oxford Dictionary of Quotations.
Read the passage carefully and then complete each space in the summary, using a maximum of three words from the passage.
Summary:
There was s survey in England to find the greatest Brit【41】. Some of the famous names on the list included Princess Diana and Shakespeare, but more than 400, 000 people【42】for Winston Churchill as the greatest Brit. Churchill【43】England during World War II. He is also famous not only for what he did but also for what he【44】In fact, many【45】by Churchill can be found in the Oxford Dictionary of Quotations.
(41)

人们在家里而不是在办公室里工作的趋势日益增长。 (instead of)

答案查题题库