The program is for a rental of bicycles, I enter the time desired by the client and his name to authorize the rent, and in the other class I send to print the variables of the time, the name of the client and the total amount of income The main class is this:
package bicicletas;
public class Bicicletas {
public static void main (String[] args ) {
System.out.println("Bienvenido a rentas Bayka");
Renta R = new Renta();
R.Datos();
}
public static void despliegue () {
Renta instancia1 = new Renta();
Renta instancia2 = new Renta();
Renta instancia3 = new Renta();
System.out.println("El tiempo de renta es: "+instancia1.tiempo);
System.out.println("Su nombre es: "+instancia2.nombre);
System.out.println("El precio de la renta es: "+instancia3.total);
System.out.println("Gracias por su renta :) ");
}
}
The second class is this:
package bicicletas;
import java.util.Scanner;
public class Renta {
int total;
int tiempo;
String nombre;
public static void Datos() {
int precio=30;
Scanner teclado = new Scanner (System.in);
System.out.println("Ingrese el tiempo que le gustaria rentar (en horas): ");
tiempo = teclado.nextInt();
System.out.println("Ingrese su nombre: ");
nombre = teclado.next();
total = tiempo * precio;
Bicicletas D = new Bicicletas();
D.despliegue();
}
}