Skip to content

Instantly share code, notes, and snippets.

View LordNairu's full-sized avatar

Niall Collins LordNairu

  • Liberty Information Technology
  • Belfast, N. Ireland
View GitHub Profile
package uk.ac.qub.programming1p1;
// Importing scanner for user input
import java.util.Scanner;
public class DingDongNumberPractical {
// Declaring constants which limit user input and control output
public static final int MIN_INPUT = 50;
public static final int MAX_INPUT = 100;
public void locateTransactionTickets(int transactionID) {
for (Ticket ticket : this.ticketHandler.getSoldTicketsList()) {
if (ticket.getTransactionID() == transactionID) {
ticket.setIsRefunded(true);
refundTransaction(ticket);
this.getTicketHandler().getSoldTicketsList().remove(ticket);
}
}
}
package gui;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import javax.swing.BorderFactory;
import javax.swing.JFrame;
package gui.alt;
import java.awt.GridBagConstraints;
import java.awt.GridLayout;
import java.text.ParseException;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextArea;
package gui.alt;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
public class App {
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
package gui.alt;
import java.awt.Dimension;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
public class CinemaMenuBar extends JMenuBar {
private static final long serialVersionUID = 7547972873689811372L;
public String getSimpleStartTime(){
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:mm");
this.simpleStartTime = simpleDateFormat.format(this.getStartTime());
return simpleStartTime;
}
/**
* Gets the current performance based on system time.
*
* @param performanceHandler - the Performance handler to be iterated through.
* @return currentPerformance - the current performance
* @throws ParseException - throws a parse exception (placeholder)
*/
public Performance getCurrentPerformance() throws ParseException {
// Initialise performance handler and add perfs to list
public Date calculateEndTime (Film film) {
calendar.setTime(film.getStartTime());
calendar.add(Calendar.MINUTE, film.getRunTimeInMinutes());
return calendar.getTime();
}
package test;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
import cinema.Film;
public class testFilm {