Struttura base
This commit is contained in:
parent
d4f3794505
commit
c7a3d14a32
@ -2,7 +2,11 @@
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package appcomune;
|
||||
package appComune;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
import javax.swing.text.SimpleAttributeSet;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -10,4 +14,51 @@ package appcomune;
|
||||
*/
|
||||
public class Anagrafica {
|
||||
|
||||
String nome;
|
||||
String cognome;
|
||||
Date dataNascita;
|
||||
String luogoNascita;
|
||||
String sesso;
|
||||
String CF;
|
||||
|
||||
public Anagrafica(String nome, String cognome, Date dataNascita, String luogo, String sesso) {
|
||||
this.nome = nome;
|
||||
this.cognome = cognome;
|
||||
this.dataNascita = dataNascita;
|
||||
this.luogoNascita = luogo;
|
||||
this.sesso = sesso;
|
||||
this.CF = GestisciCodiceFiscale.CalcolaCodiceFiscale(nome, cognome, dataNascita, luogo, sesso);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
|
||||
String ritorno = "Nome: " + this.nome + "\nCognome: " + this.cognome + "\nData di nascita: "
|
||||
+ sdf.parse(this.dataNascita) + "\nLuogo di nascita: " + this.luogoNascita + "\nSesso: " + this.sesso
|
||||
+ "\nCodice fiscale: " + this.CF;
|
||||
return ritorno;
|
||||
}
|
||||
|
||||
public String getNome() {
|
||||
return nome;
|
||||
}
|
||||
|
||||
public String getCognome() {
|
||||
return cognome;
|
||||
}
|
||||
|
||||
public Date getDataNascita() {
|
||||
return dataNascita;
|
||||
}
|
||||
|
||||
public String getLuogoNascita() {
|
||||
return luogoNascita;
|
||||
}
|
||||
|
||||
public String getSesso() {
|
||||
return sesso;
|
||||
}
|
||||
|
||||
public String getCF() {
|
||||
return CF;
|
||||
}
|
||||
}
|
||||
@ -2,12 +2,43 @@
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package appcomune;
|
||||
package appComune;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Verde
|
||||
*/
|
||||
public class GestisciCodiceFiscale {
|
||||
public static String CalcolaCodiceFiscale(String nome, String cognome, Date dataNascita, String luogo,
|
||||
String sesso) {
|
||||
|
||||
}
|
||||
|
||||
static String CalcolaPrimaTerna(String cognome){
|
||||
|
||||
}
|
||||
|
||||
static String CalcolaSecondaTerna(String nome) {
|
||||
|
||||
}
|
||||
|
||||
static String CalcolaSettimoOttavo(Date dataNascita) {
|
||||
|
||||
}
|
||||
|
||||
static String CalcolaNono(Date dataNascita) {
|
||||
|
||||
}
|
||||
|
||||
static String CalcolaDecimoUndicesimo(Date dataNascita, String sesso) {
|
||||
|
||||
}
|
||||
|
||||
static String CalcolaFrom12To15(String luogoNascita) {
|
||||
|
||||
}
|
||||
|
||||
static String CalcolaSedicesimo() {
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,13 +0,0 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package appcomune;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Verde
|
||||
*/
|
||||
public class GestisciStringhe {
|
||||
|
||||
}
|
||||
@ -2,12 +2,58 @@
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package appcomune;
|
||||
package appComune;
|
||||
|
||||
import java.util.InputMismatchException;
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Verde
|
||||
*/
|
||||
public class MainComune {
|
||||
static Scanner sc = new Scanner(System.in);
|
||||
|
||||
public static void main(String[] args) {
|
||||
int scelta = -1;
|
||||
|
||||
do {
|
||||
System.out.println("Scegliere un'opzione:");
|
||||
System.out.println("1. Inserisci dati");
|
||||
System.out.println("2. Stampa dati");
|
||||
System.out.println("0. Esci");
|
||||
System.out.print("Opzione: ");
|
||||
|
||||
try {
|
||||
scelta = sc.nextInt();
|
||||
sc.nextLine();
|
||||
|
||||
switch (scelta) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
|
||||
pausa();
|
||||
break;
|
||||
case 2:
|
||||
|
||||
pausa();
|
||||
break;
|
||||
default:
|
||||
System.out.println("Opzione non valida.");
|
||||
pausa();
|
||||
break;
|
||||
}
|
||||
} catch (InputMismatchException _) {
|
||||
System.out.println("Errore: scelta non valida.");
|
||||
pausa();
|
||||
}
|
||||
} while (scelta != 0);
|
||||
}
|
||||
|
||||
public static void pausa() {
|
||||
System.out.println("Premere un tasto per continuare. . .");
|
||||
sc.nextLine();
|
||||
}
|
||||
|
||||
}
|
||||
43
src/utility/GestisciStringhe.java
Normal file
43
src/utility/GestisciStringhe.java
Normal file
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package utility;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Verde
|
||||
*/
|
||||
public class GestisciStringhe {
|
||||
public static int ContaOccorrenze(String testo, String testoDaCercare) {
|
||||
|
||||
}
|
||||
|
||||
public static int ContaOccorrenze(String testo, char tipo) {
|
||||
|
||||
}
|
||||
|
||||
public static int trovaPosizioneOccorrenza(String testo, String testoDaCercare) {
|
||||
|
||||
}
|
||||
|
||||
public static int trovaPosizioneOccorrenza(String testo, String testoDaCercare, int nrOccorrenza) {
|
||||
|
||||
}
|
||||
|
||||
public static char estraiCarattere(String testo, char tipo, int nrOccorrenza) {
|
||||
|
||||
}
|
||||
|
||||
public static boolean isVocale(char carattere) {
|
||||
|
||||
}
|
||||
|
||||
public static boolean isConsonante(char carattere) {
|
||||
|
||||
}
|
||||
|
||||
public static String rimuoviCarattere(String testo, String carattere) {
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user