I have a problem tracing the for loop in my program. In fact I do not know if based on the statement is doing the program correctly (if someone has another logic could help me). In the end the error is that I want to ask for the parameters client by client but when adding 4 clients to the array it does not ask me to provide the data of the first client but it is passed to the second one. I attach the statement and the exercise done so far. I appreciate beforehand if someone helps me with logic and solve my problem: (
/*
“El náufrago satisfecho” ofrece hamburguesas sencillas (S), dobles (D) y
triples (T),
las cuales tienen un costo de $2.0, $3.5 y $4.8 respectivamente.
La empresa acepta tarjetas de crédito con un cargo de 5 % sobre la compra.
Lea datos de los N clientes, el tipo de hamburguesa y cantidad,
la forma de pago (contado, tarjeta_crédito).
Cada cliente adquiere una hamburguesa, las cuales pueden ser de diferente
tipo,
realice un programa para determinar cuánto deben pagar cada uno, si hay N
clientes.
También calcule cuantos clientes compraron hamburguesas: sencillas, dobles y
triples.
Finalmente, presente el valor recaudado por la venta de las hamburguesas a
los N clientes.
*/
package hamburguesa;
import java.util.Scanner;
public class Hamburguesa {
public static void main(String[] args) {
int longitud=0;
double sencilla=2.0, doble=3.5, triple=4.8;
Scanner entrada=new Scanner(System.in);
System.out.println("¿Cuantos clientes desean comprar hamburguesa?: ");
longitud=entrada.nextInt();
String clientes[]=new String[longitud];
for(int i=0; i<clientes.length; i++){
System.out.println("Ingrese el nombre del cliente "+(i+1)+":");
clientes[i]=entrada.nextLine();
}
}
}