⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chapter12n2.java

📁 JAVA源代码程序aashjkjhkjhkjhjkhkj
💻 JAVA
字号:
/** * models three different types of flight reservation */import java.io.* ;import java.lancs.* ;import java.util.* ;class Reservation    {    private int flightNumber ;    private Date dateOfTravel ;    private int seatNumber ;    public void readRes() throws IOException	{	BasicIo.prompt("Flight number?: ") ;	flightNumber = BasicIo.readInteger() ;	BasicIo.prompt("Seat number?: ") ;	seatNumber = BasicIo.readInteger() ;	} // end of method readRes    } // end of class Reservationclass BasicReservation extends Reservation    {    } // end of class BasicReservationclass NiceReservation extends Reservation    {    public static final int AISLE = 1, WINDOW = 2 ;    public static final int GREEN = 1, WHITE = 2, RED = 3 ;    private int seatSort ;    private int food ;    public void readNr() throws IOException	{	readRes() ;	BasicIo.prompt("kind of food? 1 (green), 2 (white), 3 (red): ") ;	food = BasicIo.readInteger() ;	BasicIo.prompt("kind of seat? 1 (aisle), 2 (window): ") ;	seatSort = BasicIo.readInteger() ;	} // end of method readNr    } // end of class NiceReservationclass PoshReservation extends NiceReservation    {    private String destination ;    public void readPr() throws IOException	{	readNr() ;	BasicIo.prompt("Destination address?: ") ;	destination = BasicIo.readString() ;	} // end of method readPr    } // end of class PoshReservation    public class Chapter12n2    {    public static void main(String[] args) throws IOException	{	System.out.println("res1: Basic") ;	BasicReservation res1 = new BasicReservation() ;	res1.readRes() ;	System.out.println() ;	System.out.println("res2: Nice") ;	NiceReservation res2 = new NiceReservation() ;	res2.readNr() ;	System.out.println() ;	System.out.println("res3: Posh") ;	PoshReservation res3 = new PoshReservation() ;	res3.readPr() ;	} // end of main method    } // end of class Chapter12n2

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -