Messaggi di successo
This commit is contained in:
parent
8a46ba8cfd
commit
7af3899270
@ -108,6 +108,8 @@ public class ereditarieta {
|
||||
|
||||
} while (error);
|
||||
|
||||
ritorno = new Persona[numeroPersone];
|
||||
|
||||
for (int i = 0; i < numeroPersone; i++) {
|
||||
System.out.print("Inserire il nome della persona: ");
|
||||
nome = sc.nextLine();
|
||||
@ -134,12 +136,14 @@ public class ereditarieta {
|
||||
System.out.println("Influencer");
|
||||
System.out.print("Inserire la professione: ");
|
||||
professione = sc.nextLine().toLowerCase();
|
||||
sc.nextLine();
|
||||
//sc.nextLine();
|
||||
|
||||
try {
|
||||
switch (professione) {
|
||||
case "nessuna":
|
||||
ritorno[i] = new Persona(nome, cognome, sesso, età);
|
||||
error = false;
|
||||
System.out.println("Persona inserita con successo.");
|
||||
break;
|
||||
case "studente":
|
||||
System.out.print("Inserire la classe: ");
|
||||
@ -150,6 +154,8 @@ public class ereditarieta {
|
||||
indirizzoDiStudio = sc.nextLine();
|
||||
sc.nextLine();
|
||||
ritorno[i] = new Studente(nome, cognome, sesso, età, classe, indirizzoDiStudio);
|
||||
error = false;
|
||||
System.out.println("Studente inserito con successo.");
|
||||
break;
|
||||
case "calciatore":
|
||||
System.out.print("Inserire la squadra: ");
|
||||
@ -160,6 +166,8 @@ public class ereditarieta {
|
||||
numeroMaglia = sc.nextLine();
|
||||
sc.nextLine();
|
||||
ritorno[i] = new Calciatore(nome, cognome, sesso, età, squadra, numeroMaglia);
|
||||
error = false;
|
||||
System.out.println("Calciatore inserito con successo.");
|
||||
break;
|
||||
case "influencer":
|
||||
System.out.print("Inserire il numero di follower: ");
|
||||
@ -170,6 +178,8 @@ public class ereditarieta {
|
||||
handle = sc.nextLine();
|
||||
sc.nextLine();
|
||||
ritorno[i] = new Influencer(nome, cognome, sesso, età, numeroFollower, handle);
|
||||
error = false;
|
||||
System.out.println("Influencer inserito con successo.");
|
||||
break;
|
||||
default:
|
||||
System.out.println("Opzione non valida.");
|
||||
@ -189,6 +199,7 @@ public class ereditarieta {
|
||||
static void MostraPersone(Persona[] p_persone) {
|
||||
for (Persona persona : p_persone) {
|
||||
persona.MostraPersona();
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user