import java.io.*; import java.util.*; public class ex10 { public static void mai
ID: 3611594 • Letter: I
Question
import java.io.*;
import java.util.*;
public class ex10
{
public static void main(String[] args) throws IOException
{
int[] age = null;
String[] name = null;
int total =0;
age = new int[total];
name = new String[total];
Scanner keyboard = new Scanner(System.in);
System.out.println("how many students are in yourclass? ");
total = keyboard.nextInt();
for(int i = 0; i < total; ++i)
{
System.out.println("[" +(i+1)+ "]"+ "people'sname is: ");
name[i] = keyboard.next();
System.out.println("["+ (i+1) +"]people's ageis: ");
age[i] = keyboard.nextInt();
}
for(int i = 0; i< total; ++i)
{
System.out.println(i);
}
}
}
Explanation / Answer
please rate - thanks import java.io.*; import java.util.*; public class ex10 { public static void main(String[] args) throws IOException { int[] age = null; String[] name = null; int total =0; Scanner keyboard = new Scanner(System.in); System.out.println("how many students are in yourclass? "); total = keyboard.nextInt(); age = new int[total]; name = new String[total]; for(int i = 0; iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.