I have a question about how to proceed, there are syntax errors as you can see. But my knowledge is basic and I'm trying to improve. I have the following program. A Register of Flights, only with number, origin, destination and number of places.
I created a Class
package aeroporto;
public class aviao {
aviao[] voo = new voo[i];
int numero;
String origem;
String destino;
int vagas;
for(int i=0; i<5; i++)
void Cadastrar(int numero,String origem,String destino, int vagas)
{
voo[i].numero = numero;
voo[i].origem = origem;
voo[i].destino = destino;
voo[i].vagas = vagas;
}
}
and the main program is this
package aeroporto;
import java.util.Scanner;
public class Aeroporto {
public static void main(String[] args) {
Scanner teclado = new Scanner(System.in);
int numero,vagas,i=0;
String origem,destino;
int op;
do{
System.out.println("****Menu Aeroporto****");
System.out.println("1. Cadastro de vôo");
System.out.println("2. Consultar vôo");
System.out.println("3. Reservar Passagem");
System.out.println("5. Sair");
//ler entrada
op =teclado.nextInt();
if(op==4)
{
System.exit(1);
}
switch(op){
case 1:
for(i=0 ; i<5 ; i++){
System.out.print ("Número do voo: ");
numero =teclado.nextInt();
System.out.print("Origem : ");
origem = teclado.next();
System.out.print("Destino : ");
destino = teclado.next();
System.out.print("Número de vagas : ");
vagas = teclado.nextInt();
aviao.Cadastrar (numero, origem, destino,vagas);
}
break;
}
}while(true);
}
}
I would ask the gentlemen and gentlemen available to point out my mistakes and how to proceed. Note: I'm trying to make this object vector instead of using Arraylist, because I have no idea how it does.