0

I am confused on how to instantiate the array using input from the user, the spot where i believe it should be is next to the comment right here import java.util.Scanner;

public class Sales
{
  public static void main(String[] args)
  {
    int[] sales;

    sales = getSales();
    printSales(sales);
    printSummary(sales);
  }

  private static int[] getSales()
  {
    Scanner input = new Scanner(System.in);
    int[] temp;

    System.out.print("Enter the number of salespeople: ");
    temp = _____________;   // RIGHT HERE  
1
  • What's confusing you? The instantiation, taking the input? Commented Apr 5, 2016 at 16:16

1 Answer 1

2

You should write something like:

temp = new int[input.nextInt()];
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.