QuickFix
This commit is contained in:
@ -53,5 +53,13 @@ public class Main {
|
||||
|
||||
System.out.println("Name: " + student.name);
|
||||
System.out.println("Age: " + student.getAge());
|
||||
|
||||
String movie = read.nextLine();
|
||||
int row = read.nextInt();
|
||||
int seat = read.nextInt();
|
||||
Ticket ticket = new Ticket(movie, row, seat);
|
||||
System.out.println("Movie: " + ticket.getMovie());
|
||||
System.out.println("Row: " + ticket.getRow());
|
||||
System.out.println("Seat: " + ticket.getSeat());
|
||||
}
|
||||
}
|
26
ClassesAndObjects/src/main/java/com/example/Ticket.java
Normal file
26
ClassesAndObjects/src/main/java/com/example/Ticket.java
Normal file
@ -0,0 +1,26 @@
|
||||
package com.example;
|
||||
|
||||
public class Ticket {
|
||||
private String movie;
|
||||
private int row;
|
||||
private int seat;
|
||||
|
||||
//complete the constructor
|
||||
public Ticket(String movies, int rows, int seats) {
|
||||
movie = movies;
|
||||
row = rows;
|
||||
seat = seats;
|
||||
}
|
||||
|
||||
public String getMovie() {
|
||||
return movie;
|
||||
}
|
||||
|
||||
public int getRow() {
|
||||
return row;
|
||||
}
|
||||
|
||||
public int getSeat() {
|
||||
return seat;
|
||||
}
|
||||
}
|
@ -5,7 +5,13 @@ public class Vehicle {
|
||||
int wheels;
|
||||
String color;
|
||||
double fuelCapacity;
|
||||
|
||||
Vehicle() {
|
||||
this.setColor("Red");
|
||||
}
|
||||
Vehicle(String c) {
|
||||
this.setColor(c);
|
||||
}
|
||||
|
||||
void horn() {
|
||||
System.out.println("Beep!");
|
||||
}
|
||||
@ -18,5 +24,6 @@ public class Vehicle {
|
||||
// Setter
|
||||
public void setColor(String c) {
|
||||
this.color = c;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Binary file not shown.
BIN
ClassesAndObjects/target/classes/com/example/Ticket.class
Normal file
BIN
ClassesAndObjects/target/classes/com/example/Ticket.class
Normal file
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user