write a class called LotteryTicket will have double winning

write a class called LotteryTicket will have double winning, a string numbers played and an integer serial number. include in this class a method to copy ticket and a method to compare the ticket with another object of the Lottery ticket class to see if they are same



Need an answer in java language

Solution


public class LotteryTicket {

   /**
   * @param args
   */
   double winnings;
   String numbers;
   int serialNumber;
   public void copyTicket(LotteryTicket l)
   {
       winnings = l.winnings;
       numbers = l.numbers;
       serialNumber = l.serialNumber;
   }
   public boolean compareTicket(LotteryTicket l)
   {
       if((winnings == l.winnings) && (numbers == l.numbers) && (serialNumber == l.serialNumber))
       {
           return true;
       }
       return false;
   }
}

write a class called LotteryTicket will have double winning, a string numbers played and an integer serial number. include in this class a method to copy ticket

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site