Creation of simple classes #7

Merged
schrom01 merged 4 commits from creation_of_simple_classes into main 2022-04-29 10:41:39 +02:00
8 changed files with 177 additions and 0 deletions
Showing only changes of commit a399f9321b - Show all commits

6
.gitignore vendored
View File

@ -21,3 +21,9 @@
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid* hs_err_pid*
# Ignore Gradle project-specific cache directory
.gradle
# Ignore Gradle build output directory
build

View File

@ -0,0 +1,47 @@
package ch.zhaw.projekt2.turnierverwaltung;
public class Game {
private int participant1, Participant2;
private int points1, points2;
private Location location;
public Location getLocation() {
return location;
}
public void setLocation(Location location) {
this.location = location;
}
public int getPoints1() {
return points1;
}
public void setPoints1(int points1) {
this.points1 = points1;
}
public int getPoints2() {
return points2;
}
public void setPoints2(int points2) {
this.points2 = points2;
}
public int getParticipant1() {
return participant1;
}
public void setParticipant1(int participant1) {
this.participant1 = participant1;
}
public int getParticipant2() {
return Participant2;
}
public void setParticipant2(int participant2) {
Participant2 = participant2;
}
}

View File

@ -0,0 +1,17 @@
package ch.zhaw.projekt2.turnierverwaltung;
public class Location {
private String name;
public Location(String name){
setName(name);
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

View File

@ -0,0 +1,6 @@
package ch.zhaw.projekt2.turnierverwaltung;
public interface Participant {
String getName();
void setName(String name);
}

View File

@ -0,0 +1,37 @@
package ch.zhaw.projekt2.turnierverwaltung;
public class Person {
private String name;
private String firstName;
private String phoneNumber;
public Person(String firstName, String name, String phoneNumber){
setFirstName(firstName);
setName(name);
setPhoneNumber(phoneNumber);
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
}

View File

@ -0,0 +1,10 @@
package ch.zhaw.projekt2.turnierverwaltung;
public class Player extends Person{
public Player(String firstName, String name, String phoneNumber){
super(firstName, name, phoneNumber);
}
}

View File

@ -0,0 +1,37 @@
package ch.zhaw.projekt2.turnierverwaltung;
import java.util.ArrayList;
import java.util.List;
public class Team implements Participant {
private String name;
private List<Player> players;
private Person contactPerson;
public Team(String name){
setName(name);
players = new ArrayList<>();
}
public void addPlayer(Player player){
players.add(player);
}
@Override
public String getName() {
return name;
}
@Override
public void setName(String name) {
this.name = name;
}
public Person getContactPerson() {
return contactPerson;
}
public void setContactPerson(Person contactPerson) {
this.contactPerson = contactPerson;
}
}

View File

@ -0,0 +1,17 @@
package ch.zhaw.projekt2.turnierverwaltung;
public abstract class Tournament {
private String name;
public Tournament(String name){
setName(name);
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}