Олимпиадный тренинг

Задача . 37345


Задача

Темы:
Question refer to the Ticket and Transaction classes below.
public class Ticket
{
    private String row;
    private int seat;
    private double price;
    
    //constructor
    public Ticket(String aRow, int aSeat, double aPrice)
    {
       row = aRow;
       seat = aSeat;
       price = aPrice;
    }
    //accessors getRow(), getSeat(), and getPrice()
      ...
}
public class Transaction
{
     private int numTickets;
     private Ticket[] tickList;
     
     //constructor
     public Transaction(int numTicks)
     {
         numTickets = numTicks;
         tickList = new Ticket[numTicks];
         String theRow;
         int theSeat;
         double thePrice;
         for (int i = 0; i < numTicks; i++)
         {
              < read user input for theRow, theSeat, and thePrice >
               ...
             /* more code */
         }
     }
     
     /** @return total amount paid for this transaction */
     public double totalPaid()
     {
        double total = 0.0;
        /* code to calculate amount */
        return total;
     }
}
Which of the following correctly replaces /* more code */ in the Transaction constructor to initialize the tickList array?

(A) tickList[i] = new Ticket(getRow(), getSeat(), getPrice());
(B) tickList[i] = new Ticket(theRow, theSeat, thePrice);
(C) tickList[i] = new tickList(getRow(), getSeat(), getPrice());
(D) tickList[i] = new tickList(theRow, theSeat, thePrice);
(E) tickList[i] = new tickList(numTicks);

time 1000 ms
memory 32 Mb
Правила оформления программ и список ошибок при автоматической проверке задач

Статистика успешных решений по компиляторам
Комментарий учителя