-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCompania.java
70 lines (50 loc) · 1.77 KB
/
Compania.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package alquilerbarco;
import java.util.ArrayList;
/**
*
* @author Fabio
*/
public class Compania {
private ArrayList<Alquiler> miAlquiler;
public Compania() {
miAlquiler = new ArrayList<Alquiler>();
}
@SuppressWarnings("deprecation")
public int crearAlquiler(Alquiler alquiler, int tipo ){
int dias= 0;
int valorModulo=0;
int valorAlquiler=0;
if (tipo==1) {
valorModulo=alquiler.getVelero().getEslora()*alquiler.getFechaDia()*10;
valorAlquiler=valorModulo*alquiler.getVelero().VALORVELERO;
}
if (tipo==2) {
valorModulo=alquiler.getYate().getEslora()*alquiler.getFechaDia()*10;
valorAlquiler=valorModulo*alquiler.getYate().VALORYATE;
}
if (tipo==3) {
valorModulo=alquiler.getEmbarcacionesMotor().getEslora()*alquiler.getFechaDia()*10;
valorAlquiler=valorModulo*alquiler.getEmbarcacionesMotor().VALOREMBARCACION;
}
return valorAlquiler;
}
public static void main(String args[]){
Compania compania = new Compania();
// Crear un cliente
Cliente cliente = new Cliente("Juan Pérez", 12345678);
// Crear un velero
Velero velero = new Velero("Velero1", 10, 1999, 2);
// Crear un alquiler de velero
Alquiler alquiler = new Alquiler(1, 20240712, velero, cliente);
// Calcular el valor del alquiler
int valorAlquiler = compania.crearAlquiler(alquiler, 1);
// Mostrar el valor del alquiler
System.out.println("Valor del alquiler: " + valorAlquiler);
System.out.println("Nombre del cliente: " + cliente.getNombre());
}
}