Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added ProjetoOO/bin/TFoo/Acesso.class
Binary file not shown.
Binary file added ProjetoOO/bin/TFoo/Cadastro.class
Binary file not shown.
Binary file added ProjetoOO/bin/TFoo/Data.class
Binary file not shown.
Binary file added ProjetoOO/bin/TFoo/Diurno.class
Binary file not shown.
Binary file added ProjetoOO/bin/TFoo/Duracao.class
Binary file not shown.
Binary file added ProjetoOO/bin/TFoo/Estacionamento.class
Binary file not shown.
Binary file added ProjetoOO/bin/TFoo/Evento.class
Binary file not shown.
Binary file added ProjetoOO/bin/TFoo/Fracao.class
Binary file not shown.
Binary file added ProjetoOO/bin/TFoo/HoraCheia.class
Binary file not shown.
Binary file added ProjetoOO/bin/TFoo/Horario.class
Binary file not shown.
Binary file added ProjetoOO/bin/TFoo/Mensalista.class
Binary file not shown.
Binary file added ProjetoOO/bin/TFoo/Noturno.class
Binary file not shown.
Binary file added ProjetoOO/bin/TFoo/Principal.class
Binary file not shown.
43 changes: 43 additions & 0 deletions ProjetoOO/src/TFoo/Acesso.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package TFoo;

public abstract class Acesso {


public long duracao;
protected String din,
hin,
dout,
hout,
placa;

public Acesso() {}
public Acesso(String din, String hin, String dout, String hout, String placa) {
this.duracao= new Duracao(din, hin,dout, hout).calcularDiferencaTempo();
this.din=din;
this.dout=dout;
this.hin=hin;
this.hout=hout;
}

public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null || getClass() != obj.getClass())
return false;
Acesso outroAcesso = (Acesso) obj;
return placa.equals(outroAcesso.placa);
}


public String getHin() {return hin;}
public String getHout() {return hout;}
public String getDin() {return din;}
public String getDout() {return dout;}
public String getPlaca() {return placa;}
public abstract float calcularAcesso();
public abstract float getValor();




}
5 changes: 5 additions & 0 deletions ProjetoOO/src/TFoo/Cadastro.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package TFoo;

public class Cadastro {

}
16 changes: 16 additions & 0 deletions ProjetoOO/src/TFoo/Data.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package TFoo;

public class Data{

private int dia;
private int mes;

private Data() {}
public Data(int mes, int dia) {
this.mes=mes;
this.dia=dia;
}
public int getDia() {return dia;}
public int getMes() {return mes;}

}
17 changes: 17 additions & 0 deletions ProjetoOO/src/TFoo/Diurno.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package TFoo;

public class Diurno extends Acesso{

@Override
public float calcularAcesso() {

return 0;
}

@Override
public float getValor() {
// TODO Auto-generated method stub
return 0;
}

}
84 changes: 84 additions & 0 deletions ProjetoOO/src/TFoo/Duracao.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
package TFoo;
import java.time.*;
import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.Period;
import java.time.format.DateTimeFormatter;
import java.util.Scanner;
public class Duracao {



/* Data dataEntrada, dataSaida;
Horario horarioEntrada , horarioSaida;*/

private String dataEntrada,
dataSaida,
horaEntrada,
horaSaida;

DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("AAAA-MM-dd");
DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("HH:mm");
private Duracao() {}
public Duracao(String dataEntrada, String horarioEntrada, String dataSaida, String horarioSaida) {
this.dataEntrada=dataEntrada;
this.dataSaida=dataSaida;
this.horaEntrada=horarioEntrada;
this.horaSaida=horarioSaida;
}

int[] computeTime(String date){ // metodo para reduzir cada parcela da data a um inteiro
int[] data = new int[3];
int i=0;
for(String str : date.split("/"))
data[i++]=Integer.parseInt(str);


return data;

}
int[] computeHour(String horario){ // transforma a string horario em um vetor de int com as horas e os minutos
int[] horas = new int[3];
int i=0;
for(String buffer : horario.split(":"))
horas[i++] = Integer.parseInt(buffer);
return horas;
}

/* // Calcula a diferença entre a entrada e a saída
Duration diferenca = calcularDiferencaTempo(dataEntrada, horarioEntrada, dataSaida, horarioSaida);

// Exibe a diferença em dias, horas e minutos
*/


public long calcularDiferencaTempo() {
LocalDate entradaData = LocalDate.parse(dataEntrada, dateFormatter);
LocalTime entradaHora = LocalTime.parse(horaEntrada, timeFormatter);
LocalDateTime entrada = LocalDateTime.of(entradaData, entradaHora);

LocalDate saidaData = LocalDate.parse(dataSaida, dateFormatter);
LocalTime saidaHora = LocalTime.parse(horaSaida, timeFormatter);
LocalDateTime saida = LocalDateTime.of(saidaData, saidaHora);

// Calcula a diferença de tempo entre entrada e saída
Duration duracao = Duration.between(entrada, saida);
Period periodo = Period.between(entradaData, saidaData);

// Imprime a diferença de tempo
long anos = periodo.getYears();
long meses = periodo.getMonths();
long dias = periodo.getDays();
long horas = duracao.toHours();
if((horas/24) < 1) {
dias = 0;
}
horas = horas - 24*(horas/24);
long minutos = duracao.toMinutesPart();

long tempo= (525600*anos)+(43800*meses)+(1440*dias)+(60*horas)+ minutos;
return tempo;
}
}
54 changes: 54 additions & 0 deletions ProjetoOO/src/TFoo/Estacionamento.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package TFoo;
import java.util.*;
public class Estacionamento {

private int comecoNoite;
private int fimNoite ;
private String NOME;
private int capacidade;
private float valorFracao,
valorHoraCheia,
valorDiaria,
valorNoturna,
acessoMensalista,
valorEvento,
valorRetorno;
private Horario horarioAbertura,
horarioFechamento;



private LinkedList<Acesso> list = new LinkedList<>();

public Estacionamento(String NOME, int capacidade, int comecoNoite, int fimNoite,
float valorFracao, float valorMensalista, float valorEvento, float valorRetorno,
float valorNoturno, float valorDiaria, float valorHoraCheia, String horarioAbertura, String horarioFechamento) {
this.NOME=NOME;
this.fimNoite=fimNoite;
this.capacidade=capacidade;
this.comecoNoite=comecoNoite;
this.valorFracao=valorFracao;
this.valorDiaria=valorDiaria;
this.valorEvento=valorEvento;
this.valorNoturna=valorNoturno;
this.valorRetorno=valorRetorno;
this.valorHoraCheia=valorHoraCheia;
this.acessoMensalista=valorMensalista;
this.horarioAbertura=new Horario(horarioAbertura);
this.horarioFechamento=new Horario(horarioFechamento);
}

public boolean isFull() {return capacidade==list.size();}
public int getValorRetorno() {return 0;}//ajustar o metodo para calcular o valor q será pago a empresa contratante
public boolean setAcesso(Acesso novo) {
if(isFull()) {
return false;
}
list.add(novo);
return true;
}

public boolean temVaga() {return !isFull();}


}
17 changes: 17 additions & 0 deletions ProjetoOO/src/TFoo/Evento.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package TFoo;

public class Evento extends Acesso{

@Override
public float calcularAcesso() {
// TODO Auto-generated method stub
return 0;
}

@Override
public float getValor() {
// TODO Auto-generated method stub
return 0;
}

}
17 changes: 17 additions & 0 deletions ProjetoOO/src/TFoo/Fracao.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package TFoo;

public class Fracao extends Acesso{

@Override
public float calcularAcesso() {
// TODO Auto-generated method stub
return 0;
}

@Override
public float getValor() {
// TODO Auto-generated method stub
return 0;
}

}
17 changes: 17 additions & 0 deletions ProjetoOO/src/TFoo/HoraCheia.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package TFoo;

public class HoraCheia extends Acesso {

@Override
public float calcularAcesso() {
// TODO Auto-generated method stub
return 0;
}

@Override
public float getValor() {
// TODO Auto-generated method stub
return 0;
}

}
17 changes: 17 additions & 0 deletions ProjetoOO/src/TFoo/Horario.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package TFoo;

public class Horario {

private int hora,
minuto;
public Horario(String tempo) {
String[] parte= tempo.split(":");
this.hora= Integer.parseInt(parte[0]);
this.minuto=Integer.parseInt(parte[1]);
}



public int getHora() {return hora;}
public int getMinuto() {return minuto;}
}
17 changes: 17 additions & 0 deletions ProjetoOO/src/TFoo/Mensalista.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package TFoo;

public class Mensalista extends Acesso {

@Override
public float calcularAcesso() {

return 0;
}

@Override
public float getValor() {
// TODO Auto-generated method stub
return 0;
}

}
17 changes: 17 additions & 0 deletions ProjetoOO/src/TFoo/Noturno.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package TFoo;

public class Noturno extends Acesso {

@Override
public float calcularAcesso() {
// TODO Auto-generated method stub
return 0;
}

@Override
public float getValor() {
// TODO Auto-generated method stub
return 0;
}

}
Loading