Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Date;
- import java.math.BigDecimal;
- import javax.swing.JOptionPane;
- public class CreateTicketList{
- private ArrayObj aObj;
- public CreateTicketList() {
- aObj = new ArrayObj(5);
- }
- public void add (Ticket t) {
- if(!aObj.add(t)) {
- JOptionPane.showMessageDialog(null, "The list is full.");
- } else {
- aObj.add(t);
- }
- }
- public void print() {
- for (int i=0; i<aObj.getsize(); i++) {
- Ticket rt = (Ticket) aObj.findAtIndex(i);
- System.out.println(rt.toString());
- }
- }
- public static void main(String[] args) {
- Date d1 = new Date();
- BigDecimal c1 = new BigDecimal(100);
- String descript1 = ("Food");
- Ticket t1 = new Ticket (d1, c1, descript1);
- CreateTicketList ct = new CreateTicketList();
- ct.add(t1);
- ct.print();
- }
- }
Add Comment
Please, Sign In to add comment