This commit is contained in:
2024-09-15 20:29:56 +02:00
parent 113fcbc694
commit 71f10f2644
6 changed files with 43 additions and 2 deletions

View File

@ -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());
}
}

View 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;
}
}

View File

@ -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;
}
}
}