0
I’m trying to register users and put them on the list. Initially I just tried to register and test with print. (Still indicates errors) Does anyone know why it’s not working? The mistakes are:
cannot find Symbol on the client.setName(scanner.nextLine());
and
Constructor Clients in class Customers cannot be Applied to Given types;
required: java.lang.String
found: no Arguments
Reason: actual and formal Arguments lists differ in length
Code:
import java.util.ArrayList;
import java.util.Scanner;
public class CadastraUsuarios {
public void menu(){
Scanner entrada = new Scanner(System.in);
ArrayList<Clientes> listaDeUsuarios = new ArrayList<Clientes>();
Clientes cliente = new Clientes();
int op = 0;
char opcao;
System.out.printf("MENU DE ESCOLHAS");
System.out.printf("A- CADASTRAR CLIENTE");
System.out.printf("B- INSERIR O CADASTRO DE UM NOVO TIPO DE SEGURO");
System.out.printf("C- LISTAR TODOS OS SEGUROS CADASTRADOS");
System.out.printf("D- LISTAR TODOS OS CLIENTES CADASTRADOS");
System.out.printf("E- LISTAR OS SEGUROS CADASTRADOS PARA UM DETERMINADO CLIENTE");
System.out.printf("F- BUSCAR INFORMAÇÕES DE UM SEGURO PELO NÚMERO DE ÁPOLICE");
System.out.printf("S- SAIR");
switch(opcao){
case 'a': System.out.printf("Cadastro de Cliente:");
//cadastrar clientes
break;
case 'b': System.out.printf("");
//inserir o cadastro de um novo tipo de seguro
break;
case 'c' : System.out.printf("");
//listar todos os seguros cadastrados
break;
case 'd' : System.out.printf("");
//listar todos os clientes cadastrados
break;
case 'e' : System.out.printf("");
//listar os seguros cadastrados para um determinado cliente
break;
case 'f' : System.out.printf("");
//buscar as informações de um seguro pelo número de apólice
break;
case 's' : System.out.printf("saindo do programa");
//sair do programa
break;
}
}
public void cadastro(){
System.out.println("Bem vindo ao sistema de cadastros de usuários");
System.out.println("Digite o nome do usuário");
cliente.setNome(scanner.nextLine());
System.out.println(cliente.getNome());
}
}
Client class:
public class Clientes
{
String nome;
String cpf;
String data_de_nascimento;
String endereco;
public Clientes(String nome)
{
this.nome = nome ;
System.out.println("Construtor Funcionario");
}
public void setNome(String nome) {
this.nome = nome;
}
public String getNome()
{
return nome;
}
}
what errors are indicated?
– Guilherme Nascimento
really, what’s the mistake?
– M. Bertolazo
cannot find Symbol on the client.setNome(scanner.nextLine(); e Constructor Clients in class Clients cannot be Applied to Given types; required: java.lang.String found: no Arguments Reason: actual and formal Arguments lists differ in length
– Maurício Z.B