Well, I'm relatively new to programming in Java! It is the following I have a Super Class of User name of which there are 2 subclasses Citizen and Autarchy, within the class Citizen I have created an ArrayList that will guard the Prizes of this citizen, those prizes will be inserted in this list by Autarchy being that I also have a class Prize of which I will create several instances of prizes to assign to the citizens how I must proceed so that the Autarchy can give the prizes to the Citizen?
package Users;
public class User {
private String name;
private String password;
private String email;
public User(String name, String password, String email) {
this.name = name;
this.password = password;
this.email = email;
}
//public receiveEmail(this.email) function to email a confirmation email to the user
public String getName() {
return name;
}
public String getPassword() {
return password;
}
public String getEmail() {
return email;
}
}
package Users;
import java.util.ArrayList;
public class Citizen extends User{
private ArrayList prizes = new ArrayList<>();
public Citizen(String name, String password, String email) {
super(name, password, email);
}
public ArrayList getPrizes() {
return this.prizes;
}
@Override
public String toString() {
return "Name: " + this.getName() + " | Password: " + this.getPassword() +" | E-mail: " + this.getEmail() + " | prizes: " + this.prizes;
}
package Users;
public class Prize{
private String name;
private String description;
private int value;
public Prize(String name, String description, int value) {
this.name = name;
this.description = description;
this.value = value;
}
@Override
public String toString() {
return "Achievment: " + this.name;
}