Could you help me out?? I do want that getting input from the user and print out
ID: 3618686 • Letter: C
Question
Could you help me out??
I do want that getting input from the user and print out to thefile which is data.txt
Could you help me out?
------------------------------------------------------------------------------------------
import java.util.Scanner;
public class Assign3_2 {
public void loadArray(int num)
{
int[] number =new int[num];
Scanner keyboard =new Scanner(System.in);
System.out.println("Enter each integer to ..");
for(int index = 0;index < num; index++)
{
System.out.println("The number[" + (index+1) + "]: " );
number[index] = keyboard.nextInt();
}
}
public voidoutput(int num)
{
Assign3_2 box = new Assign3_2();
int index = 0;
while(index < num)
{
System.out.println(number[index]);
index++;
}
}
public static void main(String[] args)
{
Scanner keyboard =new Scanner(System.in);
Assign3_2 box = newAssign3_2();
System.out.println("How many integers would like to go: ");
int num =keyboard.nextInt();
box.loadArray(num);
box.output(num);
}
}