Hi, im having trouble to read from the keyboard the number of employees the user wants and in allowing the user to input up to 10 employees.

package application;
import dataStructures.*;
import java.util.Scanner;



     /* this is the list of employees * */
private LinkedList<String> employeeList; 

    /* constructor */

public TrainingCourses(){

employeeList = new LinkedList<String>();
    }

     /*1.
     * Main method,
      * allowing user to input employees up to 10
      * but first asking the user the number of employees
      */ 

public static void main(String[] args){

Scanner scan = new Scanner(System.in);
System.out.println("Enter the number of employees:  ");
  int n = scan.nextInt();

  employeeList.add(n)
    }

First of all, you are missing class declearation in your file!!!!

try using for loop to print out the values of the LinkedList? Also, why do u need the linkedlist if its just a number keep it only as int n then you could
System.out.println("The user entered number of employees: " +n);

Edited 2 Years Ago by Slavi

I'm missing here only i actually have it in my file.

No the linked list is an employee list for a company. But first im asking the user how many employees does he want to put in the list, i can allow the user to input up to 10.

I'm lost and dont know how to make the number of employees that the user will enter equal to the linkedlist and at the same time allow up to 10 employees only.

This article has been dead for over six months. Start a new discussion instead.