Hey guys! I'm working on this project of mine and I can't seem to get it to work. It keeps saying that I haven't initialized the variables: name, address, email, contactNumber, numberOfVisits.
I currently have 3 classes in the package: PagamutanClinic, Clinic, and Patient.
Here's my Main:
import java.util.Scanner;
public class PagamutanClinic {
public static void main(String[] args) {
Clinic clinic = new Clinic();
Scanner s = new Scanner(System.in);
String dateOfVisit, nameOfDoctor, assessment;
String name, address, email, contactNumber;
int numberOfVisits;
int option;
System.out.println("Enter date of visit: ");
dateOfVisit = s.next();
System.out.println("Enter name of doctor: ");
nameOfDoctor = s.next();
System.out.println("Assessment Summary: ");
assessment = s.next();
clinic.addPatient(new Patient (name, address, email, contactNumber, numberOfVisits));
}
}
Here's my Clinic class:
import java.util.ArrayList;
public class Clinic {
private ArrayList <Patient> patients = new ArrayList<Patient>();
public void addPatient (Patient patient){
patients.add(patient);
}
}
And lastly, here's my Patient class:
public class Patient {
private String name;
private String address;
private String email;
private String contactNumber;
private int numberOfVisits;
public Patient(String name, String address, String email, String contactNumber, int numberOfVisits){
this.name = name;
this.address = address;
this.email = email;
this.contactNumber = contactNumber;
this.numberOfVisits = numberOfVisits;
}
public String getName(){
return name;
}
public void setName(String name){
this.name = name;
}
public String getAddress(){
return address;
}
public void setAddress(String address){
this.address = address;
}
public String getEmail(){
return email;
}
public void setEmail(String email){
this.email = email;
}
public String getContactNumber(){
return contactNumber;
}
public int getNumberOfVisits(){
return numberOfVisits;
}
public void setNumberOfVisits(int numberOfVisits){
this.numberOfVisits = numberOfVisits;
}
public void numberOfVisits(){
}
}
I'm kinda new to programming so please bear with me if it happens to be a simple fix. Thanks guys! :D