booking.java

来自「Java程序设计高级教程(第三版)」· Java 代码 · 共 51 行

JAVA
51
字号
package com.nearhills;

import java.sql.*;

public class Booking {
   int memberId;
   int tripId;

   public Booking() {
      this( 0, 0 );
   }

   public Booking( int memberId, int tripId ) {
      setMemberId( memberId );
      setTripId( tripId );
   }

   void setMemberId( int memberId ) {
      this.memberId = memberId;
   }

   int getMemberId( ) {
      return memberId;
   }

   void setTripId( int tripId ) {
      this.tripId = tripId;
   }

   int getTripId( ) {
      return tripId;
   }

   void drop( ) 
      throws DBopException, SQLException, BookingException
   {
        SkiTrip trip = SkiTrip.getTrip( getTripId() );
        trip.dropBooking(); 
        SkiClubDB.dropBooking( this );
        SkiClubDB.updateTrip( trip );
   }

   void add( ) 
      throws DBopException, SQLException, BookingException 
   {
      SkiTrip trip = SkiTrip.getTrip( getTripId() );
      trip.addBooking();
      SkiClubDB.addBooking( this );
      SkiClubDB.updateTrip( trip );
   }
}

⌨️ 快捷键说明

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