0

There are some arrays that require input from the user and those should also be printed out on demand by him. There is this issue, that the inputs -at least one of them- are not visible when they get printed out.

An example (where the value of the array "name" gets printed out):

The Number: 3
The Description: A3
The time: 12
name: 
surname: jiji

It's always this "name" array that doesn't show the input from the user. The following are "some input-demand methods for the user" so you have the overview, how i structured them.

for (int i = 0; i < number.length; i++) {
    System.out.println("The name please: ");
                name[i] = sc.nextLine();
                sc.nextLine();
                System.out.println("The surname please: ");
                surname[i] = sc.nextLine();
}

Second one:

for (int i = 0; i < number.length; i++) {
            if (index -1 == i) {
                System.out.println("Give the name please: ");
                name[i] = sc.nextLine();
                sc.nextLine();
                System.out.println("Give the surname please: ");
                surname[i] = sc.nextLine();
                System.out.println("The time please: (hh)");
                time[i]= sc.nextInt();
                reserved[i] = "one hour";
                while (time[i] < 8 || time[i] > 20) {
                    System.out.println("Give a time between 8 and 20 ");
                    time[i] = sc.nextInt();
                }

Third one:

for (int i = 0; i < name.length-1; i++) {
            System.out.println("Number : " + number{i]);
            System.out.println("the description: " + description[i]);
            System.out.println("time: " + time[i]);
            System.out.println("name: " + name{i]);
            System.out.println("surname: " + surnamei]);
            System.out.println("Reservation: " + reservation[i] + "\n");
        }

Fourth one:

for (int i = 0; i < time.length; i++) {
            while (iput.equalsIgnoreCase(description[i])) {
                System.out.println("Please enter the name ");
                name[i] = sc.nextLine();
                System.out.println("Please enter the surname: ");
                nachname[i] = sc.nextLine();
                System.out.println("This has been for the reserved for the whole day");
                reservation[i] = "Whole day";
                break;
            }
    }

You need more info? Let me know. Every small hint is appreciable.

Jwan
  • 51
  • 6

0 Answers0