Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Michael Martins
- import java.util.Scanner;
- public class UsaData {
- public static void main(String args[]) {
- int dias = 0;
- Scanner leia = new Scanner(System.in);
- Data data[] = new Data[2];
- for(int i=0; i<2; i++) {
- data[i] = new Data();
- System.out.print("\nDia: ");
- data[i].setDia(leia.nextInt());
- System.out.print("Mes: ");
- data[i].setMes(leia.nextInt());
- System.out.print("Ano: ");
- data[i].setAno(leia.nextInt());
- }
- if(data[0].getDias() > data[1].getDias()) {
- dias = data[0].getDias() - data[1].getDias();
- } else {
- dias = data[1].getDias() - data[0].getDias();
- }
- if(dias != 0){
- System.out.print("\nDiferenca de dias entre data 1 e data 2 eh: " + dias + " dias.");
- } else {
- System.out.print("\nEh a mesma data.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement