构造函数类预订中的预订不能应用于给定类型。任何修复章节?
import java.util.ArrayList;
/**
* Imports the Array List required for the application to use methods such as add, remove, size ect.
*/
public class Trip {
private ArrayList<Bookings> Booking;
public String Date;
public String Trip;
public String Code;
public double price;
public int booking_id;
private int tripID;
private String tripDestination;
/**
* Constructor
*/
public Trip(int ltripID,String ltripDestination, int ltripCapacity, double price)
{
Booking = new ArrayList<Bookings>();
booking_id = 0;
tripID = ltripID;
tripDestination = ltripDestination;
price = price;
}
public int BookingsSeats(String Code, int noAdults, int noChildren, String cForename, String cSurename, String cNumber)
{
Bookings newbooking;
booking_id++;
newbooking = new Bookings(Code, noAdults, noChildren, cForename, cSurename, cNumber, booking_id);
return booking_id;
}
public void RemoveBooking(int ID)
{
//for (Booking obj : Bookings)
//{
// if (obj.IDget() ==ID)
// {
// Bookings.remove(obj);
// }
}
}
//public void ToString()
// {
// System.out.printIn("");
// System.out.printIn("This code " + code );
// System.out.printIn("This date " + Date);
// System.out.printIn("Trip Destination " + Destincation);
// System.out.printIn("Price" + Price);
// for (Booking obj : Bookings )
// {
// system.out.printIn(obj.ToString());
// system.out.printIn("");
//}
//}
//}
答案 0 :(得分:0)
说这个:
new Bookings(Code, noAdults, noChildren, cForename, cSurename, cNumber, booking_id);
您希望Bookings
类中存在以下构造函数签名:
Bookings(String, int, int, String, String, String, int)
找出哪个参数索引与构造函数声明不匹配。