Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Created by Istquai on 28.07.2017.
- */
- public class Patient {
- private String firstName;
- private String lastName;
- private String pesel;
- public String getFirstName() {
- return firstName;
- }
- public void setFirstName(String firstName) {
- this.firstName = firstName;
- }
- public String getLastName() {
- return lastName;
- }
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
- public String getPesel() {
- return pesel;
- }
- public void setPesel(String pesel) {
- this.pesel = pesel;
- }
- public Patient(String firstName, String lastName, String pesel) {
- this.firstName = firstName;
- this.lastName = lastName;
- this.pesel = pesel;
- }
- }
- /**
- * Created by Istquai on 28.07.2017.
- */
- import java.util.Scanner;
- public class Hospital {
- Patient[] tab = new Patient[200];
- public void dopisz() {
- Scanner reader = new Scanner(System.in);
- int i = 0;
- String firstName, lastName, pesel;
- System.out.println("Podaj imię: ");
- firstName = reader.nextLine();
- System.out.println("Podaj nazwisko");
- lastName = reader.nextLine();
- System.out.println("Podaj pesel");
- pesel = reader.nextLine();
- tab[i] = new Patient(firstName, lastName, pesel);
- i++;
- return;
- }
- public void wyswietl() {
- for (Patient tmp : tab) {
- System.out.println(tab);
- }
- }
- }
- /**
- * Created by Istquai on 28.07.2017.
- */
- import java.util.Scanner;
- public class HospitalApp {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- Hospital app = new Hospital();
- int select = 3;
- int licznikDodawania = 0;
- while (select != 0) {
- System.out.println("Co chcesz zrobić?");
- System.out.println("0 - wyjście z programu");
- System.out.println("1 - dopisanie pacjenta");
- System.out.println("2 - wyświetlenie listy zapisanych pacjentów");
- select = input.nextInt();
- if (select == 1) licznikDodawania++;
- if (licznikDodawania < 11) {
- switch (select) {
- case 0:
- break;
- case 1:
- app.dopisz();
- case 2:
- app.wyswietl();
- }
- }
- else {
- System.out.println("NA DZISIAJ KONIEC ZAPISYWANIA!");
- System.out.println("");
- }
- }
- input.close();
- return;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement