I'm trying to write a class that stores an array list and has multiple methods












-1














I have to write a program that interacts with the user and to add and review airline reservations. I'm writing this class here call ReservationSystem and I need to create the following methods:
addReservation() that takes as input first name, last name, price, seat number, and seat letter and creates a Reservation with this info, then I need to add the reservation to the list of reservations. Next I need to create another addReservation() method that prompts the user for the info needed to make a new reservation and add this reservation to the list of reservations. Next I need to create a method viewReservations() that prints all reservations using System.out and I have to use my toString() method provided by Reservation class. For some reason it's not seeing my String firstName variable as a
String in my viewReservations() method. Also how do I combine all my inputs into one variable, in this code I've just been using + to combine the inputs, not sure if that's correct.



ReservationSystem class:

package finalproject;
import java.util.*;

public class ReservationSystem {

ArrayList<String> reservations = new ArrayList<>();


public String addReservation(String firstName, String lastName, String
price, String seatNumber, String seatLetter){

String reservation = firstName + lastName + price + seatNumber +
seatLetter;
reservations.add(reservation);

return reservation;
}

public void addReservation(){

Scanner s = new Scanner(System.in);
System.out.print("Enter new reservation: ");
String reservation = s.nextLine();

reservations.add(reservation);
}

public void viewReservation(){

Reservation res = new Reservation(String firstName, String lastName,
String price, String seatNumber, String seatLetter);

res.toString(firstName, lastName, String, seatNumber, seatNumber);
}




}


Reservation Class:



package finalproject;

public class Reservation {

private String firstName;
private String lastName;
private String price;
private String seatNumber;
private String seatLetter;

public Reservation(String firstName, String lastName){

this.firstName = firstName;
this.lastName = lastName;
}

/**
*
* @param price
*/
public Reservation(String price){

this.price = price;
}

public Reservation(String seatNumber){

this.seatNumber = seatNumber;
}

public Reservation(String seatLetter){

this.seatLetter = seatLetter;
}

/**
*
* @param firstName
* @param lastName
* @param price
* @param seatNumber
* @param seatLetter
* @return
*/
public String toString(String firstName, String lastName, String price,
String seatNumber, String seatLetter){

String info = firstName + lastName + price + seatNumber + seatLetter;
return info;

}

/**
*
* @param price
* @return
*/
public String getPrice(String price){

return price;
}

}









share|improve this question






















  • You should have a List<Reservation> instead of ArrayList<String> and add the Reservation objects, which need to have a constructor that takes all the parameters (the code here won't even compile). The toString() shouldn't take any parameters; it should assemble the result from the fields. It's fine to concatenate them with + but you probably want to put spaces between them.
    – David Conrad
    Nov 19 '18 at 19:52
















-1














I have to write a program that interacts with the user and to add and review airline reservations. I'm writing this class here call ReservationSystem and I need to create the following methods:
addReservation() that takes as input first name, last name, price, seat number, and seat letter and creates a Reservation with this info, then I need to add the reservation to the list of reservations. Next I need to create another addReservation() method that prompts the user for the info needed to make a new reservation and add this reservation to the list of reservations. Next I need to create a method viewReservations() that prints all reservations using System.out and I have to use my toString() method provided by Reservation class. For some reason it's not seeing my String firstName variable as a
String in my viewReservations() method. Also how do I combine all my inputs into one variable, in this code I've just been using + to combine the inputs, not sure if that's correct.



ReservationSystem class:

package finalproject;
import java.util.*;

public class ReservationSystem {

ArrayList<String> reservations = new ArrayList<>();


public String addReservation(String firstName, String lastName, String
price, String seatNumber, String seatLetter){

String reservation = firstName + lastName + price + seatNumber +
seatLetter;
reservations.add(reservation);

return reservation;
}

public void addReservation(){

Scanner s = new Scanner(System.in);
System.out.print("Enter new reservation: ");
String reservation = s.nextLine();

reservations.add(reservation);
}

public void viewReservation(){

Reservation res = new Reservation(String firstName, String lastName,
String price, String seatNumber, String seatLetter);

res.toString(firstName, lastName, String, seatNumber, seatNumber);
}




}


Reservation Class:



package finalproject;

public class Reservation {

private String firstName;
private String lastName;
private String price;
private String seatNumber;
private String seatLetter;

public Reservation(String firstName, String lastName){

this.firstName = firstName;
this.lastName = lastName;
}

/**
*
* @param price
*/
public Reservation(String price){

this.price = price;
}

public Reservation(String seatNumber){

this.seatNumber = seatNumber;
}

public Reservation(String seatLetter){

this.seatLetter = seatLetter;
}

/**
*
* @param firstName
* @param lastName
* @param price
* @param seatNumber
* @param seatLetter
* @return
*/
public String toString(String firstName, String lastName, String price,
String seatNumber, String seatLetter){

String info = firstName + lastName + price + seatNumber + seatLetter;
return info;

}

/**
*
* @param price
* @return
*/
public String getPrice(String price){

return price;
}

}









share|improve this question






















  • You should have a List<Reservation> instead of ArrayList<String> and add the Reservation objects, which need to have a constructor that takes all the parameters (the code here won't even compile). The toString() shouldn't take any parameters; it should assemble the result from the fields. It's fine to concatenate them with + but you probably want to put spaces between them.
    – David Conrad
    Nov 19 '18 at 19:52














-1












-1








-1







I have to write a program that interacts with the user and to add and review airline reservations. I'm writing this class here call ReservationSystem and I need to create the following methods:
addReservation() that takes as input first name, last name, price, seat number, and seat letter and creates a Reservation with this info, then I need to add the reservation to the list of reservations. Next I need to create another addReservation() method that prompts the user for the info needed to make a new reservation and add this reservation to the list of reservations. Next I need to create a method viewReservations() that prints all reservations using System.out and I have to use my toString() method provided by Reservation class. For some reason it's not seeing my String firstName variable as a
String in my viewReservations() method. Also how do I combine all my inputs into one variable, in this code I've just been using + to combine the inputs, not sure if that's correct.



ReservationSystem class:

package finalproject;
import java.util.*;

public class ReservationSystem {

ArrayList<String> reservations = new ArrayList<>();


public String addReservation(String firstName, String lastName, String
price, String seatNumber, String seatLetter){

String reservation = firstName + lastName + price + seatNumber +
seatLetter;
reservations.add(reservation);

return reservation;
}

public void addReservation(){

Scanner s = new Scanner(System.in);
System.out.print("Enter new reservation: ");
String reservation = s.nextLine();

reservations.add(reservation);
}

public void viewReservation(){

Reservation res = new Reservation(String firstName, String lastName,
String price, String seatNumber, String seatLetter);

res.toString(firstName, lastName, String, seatNumber, seatNumber);
}




}


Reservation Class:



package finalproject;

public class Reservation {

private String firstName;
private String lastName;
private String price;
private String seatNumber;
private String seatLetter;

public Reservation(String firstName, String lastName){

this.firstName = firstName;
this.lastName = lastName;
}

/**
*
* @param price
*/
public Reservation(String price){

this.price = price;
}

public Reservation(String seatNumber){

this.seatNumber = seatNumber;
}

public Reservation(String seatLetter){

this.seatLetter = seatLetter;
}

/**
*
* @param firstName
* @param lastName
* @param price
* @param seatNumber
* @param seatLetter
* @return
*/
public String toString(String firstName, String lastName, String price,
String seatNumber, String seatLetter){

String info = firstName + lastName + price + seatNumber + seatLetter;
return info;

}

/**
*
* @param price
* @return
*/
public String getPrice(String price){

return price;
}

}









share|improve this question













I have to write a program that interacts with the user and to add and review airline reservations. I'm writing this class here call ReservationSystem and I need to create the following methods:
addReservation() that takes as input first name, last name, price, seat number, and seat letter and creates a Reservation with this info, then I need to add the reservation to the list of reservations. Next I need to create another addReservation() method that prompts the user for the info needed to make a new reservation and add this reservation to the list of reservations. Next I need to create a method viewReservations() that prints all reservations using System.out and I have to use my toString() method provided by Reservation class. For some reason it's not seeing my String firstName variable as a
String in my viewReservations() method. Also how do I combine all my inputs into one variable, in this code I've just been using + to combine the inputs, not sure if that's correct.



ReservationSystem class:

package finalproject;
import java.util.*;

public class ReservationSystem {

ArrayList<String> reservations = new ArrayList<>();


public String addReservation(String firstName, String lastName, String
price, String seatNumber, String seatLetter){

String reservation = firstName + lastName + price + seatNumber +
seatLetter;
reservations.add(reservation);

return reservation;
}

public void addReservation(){

Scanner s = new Scanner(System.in);
System.out.print("Enter new reservation: ");
String reservation = s.nextLine();

reservations.add(reservation);
}

public void viewReservation(){

Reservation res = new Reservation(String firstName, String lastName,
String price, String seatNumber, String seatLetter);

res.toString(firstName, lastName, String, seatNumber, seatNumber);
}




}


Reservation Class:



package finalproject;

public class Reservation {

private String firstName;
private String lastName;
private String price;
private String seatNumber;
private String seatLetter;

public Reservation(String firstName, String lastName){

this.firstName = firstName;
this.lastName = lastName;
}

/**
*
* @param price
*/
public Reservation(String price){

this.price = price;
}

public Reservation(String seatNumber){

this.seatNumber = seatNumber;
}

public Reservation(String seatLetter){

this.seatLetter = seatLetter;
}

/**
*
* @param firstName
* @param lastName
* @param price
* @param seatNumber
* @param seatLetter
* @return
*/
public String toString(String firstName, String lastName, String price,
String seatNumber, String seatLetter){

String info = firstName + lastName + price + seatNumber + seatLetter;
return info;

}

/**
*
* @param price
* @return
*/
public String getPrice(String price){

return price;
}

}






java arrays class






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 19 '18 at 19:47









Matt L.Matt L.

278




278












  • You should have a List<Reservation> instead of ArrayList<String> and add the Reservation objects, which need to have a constructor that takes all the parameters (the code here won't even compile). The toString() shouldn't take any parameters; it should assemble the result from the fields. It's fine to concatenate them with + but you probably want to put spaces between them.
    – David Conrad
    Nov 19 '18 at 19:52


















  • You should have a List<Reservation> instead of ArrayList<String> and add the Reservation objects, which need to have a constructor that takes all the parameters (the code here won't even compile). The toString() shouldn't take any parameters; it should assemble the result from the fields. It's fine to concatenate them with + but you probably want to put spaces between them.
    – David Conrad
    Nov 19 '18 at 19:52
















You should have a List<Reservation> instead of ArrayList<String> and add the Reservation objects, which need to have a constructor that takes all the parameters (the code here won't even compile). The toString() shouldn't take any parameters; it should assemble the result from the fields. It's fine to concatenate them with + but you probably want to put spaces between them.
– David Conrad
Nov 19 '18 at 19:52




You should have a List<Reservation> instead of ArrayList<String> and add the Reservation objects, which need to have a constructor that takes all the parameters (the code here won't even compile). The toString() shouldn't take any parameters; it should assemble the result from the fields. It's fine to concatenate them with + but you probably want to put spaces between them.
– David Conrad
Nov 19 '18 at 19:52












1 Answer
1






active

oldest

votes


















1














Reservation class



public class Reservation {

private String firstName;
private String lastName;
private float price;
private int seatNumber;
private char seatLetter;

// Constructor. Aligns values to the fields.
public Reservation(String firstName, String lastName,
float price, int seatNumber, char seatLetter){
this.firstName = firstName;
this.lastName = lastName;
this.price = price;
this.seatNumber = seatNumber;
this.seatLetter = seatLetter;
}

// Returns a string with the values of the fields.
public String toString(){
return firstName + " " + lastName
+ "nPrice: " + price
+ "nSeat: " + seatLetter + seatNumber;
}

// Returns the value of seatLetter
public char getSeatLetter() {
return seatLetter;
}
// Returns the value of seatNumber
public int getSeatNumber() {
return seatNumber;
}
}


ReservationSystem class



import java.util.ArrayList;
import java.util.List;

public class ReservationSystem {

List<Reservation> reservations = new ArrayList<>();

//Adds a Reservation object to the list
public void addReservation(Reservation reservation){
reservations.add(reservation);
}
// Prints a Reservation from the list based on seat number and seat letter
public void viewReservation(int seatNumber, char seatLetter){
for(Reservation res : reservations){
// if seat number and seat letter dont match continue to the next reservation
if(res.getSeatNumber() != seatNumber && res.getSeatLetter() != seatLetter){ continue; }
System.out.println(res.toString());
return;
}
}
// Prints all the Reservation objects of the list
public void viewAllReservations(){
for(Reservation res : reservations){
System.out.println(res.toString() + "n");
}
}
}


in your Main class



public static void main(String args) {

ReservationSystem resSystem = new ReservationSystem();
//Getting the values for a new reservation from user
Scanner sc = new Scanner(System.in);
System.out.println("Enter First Name: ");
String firstName = sc.nextLine();
System.out.println("Enter Last Name: ");
String lastName = sc.nextLine();
System.out.println("Enter Price: ");
float price = sc.nextFloat();
System.out.println("Enter Seat Number: ");
int seatNumber = sc.nextInt();
System.out.println("Enter Seat Letter: ");
char seatLetter = sc.next().charAt(0);
sc.close();
// Adding new reservation object to the list
resSystem.addReservation(new Reservation(firstName, lastName, price, seatNumber, seatLetter));

// Printing All the reservations from the list
resSystem.viewAllReservations();
}





share|improve this answer























  • Please improve your answer by explaining what you have done in words. Just dumping some code isn’t very helpful
    – Joakim Danielson
    Nov 19 '18 at 21:54











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53381640%2fim-trying-to-write-a-class-that-stores-an-array-list-and-has-multiple-methods%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














Reservation class



public class Reservation {

private String firstName;
private String lastName;
private float price;
private int seatNumber;
private char seatLetter;

// Constructor. Aligns values to the fields.
public Reservation(String firstName, String lastName,
float price, int seatNumber, char seatLetter){
this.firstName = firstName;
this.lastName = lastName;
this.price = price;
this.seatNumber = seatNumber;
this.seatLetter = seatLetter;
}

// Returns a string with the values of the fields.
public String toString(){
return firstName + " " + lastName
+ "nPrice: " + price
+ "nSeat: " + seatLetter + seatNumber;
}

// Returns the value of seatLetter
public char getSeatLetter() {
return seatLetter;
}
// Returns the value of seatNumber
public int getSeatNumber() {
return seatNumber;
}
}


ReservationSystem class



import java.util.ArrayList;
import java.util.List;

public class ReservationSystem {

List<Reservation> reservations = new ArrayList<>();

//Adds a Reservation object to the list
public void addReservation(Reservation reservation){
reservations.add(reservation);
}
// Prints a Reservation from the list based on seat number and seat letter
public void viewReservation(int seatNumber, char seatLetter){
for(Reservation res : reservations){
// if seat number and seat letter dont match continue to the next reservation
if(res.getSeatNumber() != seatNumber && res.getSeatLetter() != seatLetter){ continue; }
System.out.println(res.toString());
return;
}
}
// Prints all the Reservation objects of the list
public void viewAllReservations(){
for(Reservation res : reservations){
System.out.println(res.toString() + "n");
}
}
}


in your Main class



public static void main(String args) {

ReservationSystem resSystem = new ReservationSystem();
//Getting the values for a new reservation from user
Scanner sc = new Scanner(System.in);
System.out.println("Enter First Name: ");
String firstName = sc.nextLine();
System.out.println("Enter Last Name: ");
String lastName = sc.nextLine();
System.out.println("Enter Price: ");
float price = sc.nextFloat();
System.out.println("Enter Seat Number: ");
int seatNumber = sc.nextInt();
System.out.println("Enter Seat Letter: ");
char seatLetter = sc.next().charAt(0);
sc.close();
// Adding new reservation object to the list
resSystem.addReservation(new Reservation(firstName, lastName, price, seatNumber, seatLetter));

// Printing All the reservations from the list
resSystem.viewAllReservations();
}





share|improve this answer























  • Please improve your answer by explaining what you have done in words. Just dumping some code isn’t very helpful
    – Joakim Danielson
    Nov 19 '18 at 21:54
















1














Reservation class



public class Reservation {

private String firstName;
private String lastName;
private float price;
private int seatNumber;
private char seatLetter;

// Constructor. Aligns values to the fields.
public Reservation(String firstName, String lastName,
float price, int seatNumber, char seatLetter){
this.firstName = firstName;
this.lastName = lastName;
this.price = price;
this.seatNumber = seatNumber;
this.seatLetter = seatLetter;
}

// Returns a string with the values of the fields.
public String toString(){
return firstName + " " + lastName
+ "nPrice: " + price
+ "nSeat: " + seatLetter + seatNumber;
}

// Returns the value of seatLetter
public char getSeatLetter() {
return seatLetter;
}
// Returns the value of seatNumber
public int getSeatNumber() {
return seatNumber;
}
}


ReservationSystem class



import java.util.ArrayList;
import java.util.List;

public class ReservationSystem {

List<Reservation> reservations = new ArrayList<>();

//Adds a Reservation object to the list
public void addReservation(Reservation reservation){
reservations.add(reservation);
}
// Prints a Reservation from the list based on seat number and seat letter
public void viewReservation(int seatNumber, char seatLetter){
for(Reservation res : reservations){
// if seat number and seat letter dont match continue to the next reservation
if(res.getSeatNumber() != seatNumber && res.getSeatLetter() != seatLetter){ continue; }
System.out.println(res.toString());
return;
}
}
// Prints all the Reservation objects of the list
public void viewAllReservations(){
for(Reservation res : reservations){
System.out.println(res.toString() + "n");
}
}
}


in your Main class



public static void main(String args) {

ReservationSystem resSystem = new ReservationSystem();
//Getting the values for a new reservation from user
Scanner sc = new Scanner(System.in);
System.out.println("Enter First Name: ");
String firstName = sc.nextLine();
System.out.println("Enter Last Name: ");
String lastName = sc.nextLine();
System.out.println("Enter Price: ");
float price = sc.nextFloat();
System.out.println("Enter Seat Number: ");
int seatNumber = sc.nextInt();
System.out.println("Enter Seat Letter: ");
char seatLetter = sc.next().charAt(0);
sc.close();
// Adding new reservation object to the list
resSystem.addReservation(new Reservation(firstName, lastName, price, seatNumber, seatLetter));

// Printing All the reservations from the list
resSystem.viewAllReservations();
}





share|improve this answer























  • Please improve your answer by explaining what you have done in words. Just dumping some code isn’t very helpful
    – Joakim Danielson
    Nov 19 '18 at 21:54














1












1








1






Reservation class



public class Reservation {

private String firstName;
private String lastName;
private float price;
private int seatNumber;
private char seatLetter;

// Constructor. Aligns values to the fields.
public Reservation(String firstName, String lastName,
float price, int seatNumber, char seatLetter){
this.firstName = firstName;
this.lastName = lastName;
this.price = price;
this.seatNumber = seatNumber;
this.seatLetter = seatLetter;
}

// Returns a string with the values of the fields.
public String toString(){
return firstName + " " + lastName
+ "nPrice: " + price
+ "nSeat: " + seatLetter + seatNumber;
}

// Returns the value of seatLetter
public char getSeatLetter() {
return seatLetter;
}
// Returns the value of seatNumber
public int getSeatNumber() {
return seatNumber;
}
}


ReservationSystem class



import java.util.ArrayList;
import java.util.List;

public class ReservationSystem {

List<Reservation> reservations = new ArrayList<>();

//Adds a Reservation object to the list
public void addReservation(Reservation reservation){
reservations.add(reservation);
}
// Prints a Reservation from the list based on seat number and seat letter
public void viewReservation(int seatNumber, char seatLetter){
for(Reservation res : reservations){
// if seat number and seat letter dont match continue to the next reservation
if(res.getSeatNumber() != seatNumber && res.getSeatLetter() != seatLetter){ continue; }
System.out.println(res.toString());
return;
}
}
// Prints all the Reservation objects of the list
public void viewAllReservations(){
for(Reservation res : reservations){
System.out.println(res.toString() + "n");
}
}
}


in your Main class



public static void main(String args) {

ReservationSystem resSystem = new ReservationSystem();
//Getting the values for a new reservation from user
Scanner sc = new Scanner(System.in);
System.out.println("Enter First Name: ");
String firstName = sc.nextLine();
System.out.println("Enter Last Name: ");
String lastName = sc.nextLine();
System.out.println("Enter Price: ");
float price = sc.nextFloat();
System.out.println("Enter Seat Number: ");
int seatNumber = sc.nextInt();
System.out.println("Enter Seat Letter: ");
char seatLetter = sc.next().charAt(0);
sc.close();
// Adding new reservation object to the list
resSystem.addReservation(new Reservation(firstName, lastName, price, seatNumber, seatLetter));

// Printing All the reservations from the list
resSystem.viewAllReservations();
}





share|improve this answer














Reservation class



public class Reservation {

private String firstName;
private String lastName;
private float price;
private int seatNumber;
private char seatLetter;

// Constructor. Aligns values to the fields.
public Reservation(String firstName, String lastName,
float price, int seatNumber, char seatLetter){
this.firstName = firstName;
this.lastName = lastName;
this.price = price;
this.seatNumber = seatNumber;
this.seatLetter = seatLetter;
}

// Returns a string with the values of the fields.
public String toString(){
return firstName + " " + lastName
+ "nPrice: " + price
+ "nSeat: " + seatLetter + seatNumber;
}

// Returns the value of seatLetter
public char getSeatLetter() {
return seatLetter;
}
// Returns the value of seatNumber
public int getSeatNumber() {
return seatNumber;
}
}


ReservationSystem class



import java.util.ArrayList;
import java.util.List;

public class ReservationSystem {

List<Reservation> reservations = new ArrayList<>();

//Adds a Reservation object to the list
public void addReservation(Reservation reservation){
reservations.add(reservation);
}
// Prints a Reservation from the list based on seat number and seat letter
public void viewReservation(int seatNumber, char seatLetter){
for(Reservation res : reservations){
// if seat number and seat letter dont match continue to the next reservation
if(res.getSeatNumber() != seatNumber && res.getSeatLetter() != seatLetter){ continue; }
System.out.println(res.toString());
return;
}
}
// Prints all the Reservation objects of the list
public void viewAllReservations(){
for(Reservation res : reservations){
System.out.println(res.toString() + "n");
}
}
}


in your Main class



public static void main(String args) {

ReservationSystem resSystem = new ReservationSystem();
//Getting the values for a new reservation from user
Scanner sc = new Scanner(System.in);
System.out.println("Enter First Name: ");
String firstName = sc.nextLine();
System.out.println("Enter Last Name: ");
String lastName = sc.nextLine();
System.out.println("Enter Price: ");
float price = sc.nextFloat();
System.out.println("Enter Seat Number: ");
int seatNumber = sc.nextInt();
System.out.println("Enter Seat Letter: ");
char seatLetter = sc.next().charAt(0);
sc.close();
// Adding new reservation object to the list
resSystem.addReservation(new Reservation(firstName, lastName, price, seatNumber, seatLetter));

// Printing All the reservations from the list
resSystem.viewAllReservations();
}






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 19 '18 at 22:37

























answered Nov 19 '18 at 21:01









oskozachoskozach

6615




6615












  • Please improve your answer by explaining what you have done in words. Just dumping some code isn’t very helpful
    – Joakim Danielson
    Nov 19 '18 at 21:54


















  • Please improve your answer by explaining what you have done in words. Just dumping some code isn’t very helpful
    – Joakim Danielson
    Nov 19 '18 at 21:54
















Please improve your answer by explaining what you have done in words. Just dumping some code isn’t very helpful
– Joakim Danielson
Nov 19 '18 at 21:54




Please improve your answer by explaining what you have done in words. Just dumping some code isn’t very helpful
– Joakim Danielson
Nov 19 '18 at 21:54


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53381640%2fim-trying-to-write-a-class-that-stores-an-array-list-and-has-multiple-methods%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

MongoDB - Not Authorized To Execute Command

in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith

How to fix TextFormField cause rebuild widget in Flutter