TUGAS INPUT ARRAY
CODDING :
/**
* @(#)arrayx.java
*
*
* @author
* @version 1.00 2015/4/19
*/
import java.util.*;
public class arrayx {
public static void main (String [] args){
Scanner input = new Scanner (System.in);
String y;
int x,z;
String npm[]= new String[100];
String nama[]= new String[100];
String nilai[]= new String[100];
System.out.print ("Banyaknya data : ");
x=input.nextInt();
y=input.nextLine ();
System.out.println ("-----------------------------");
for (z=0;z<x;z++)
{
System.out.print ("data ke "+(z+1)+"\n");
System.out.println ("-----------------------------");
System.out.print ("NPM : "); npm[z]=input.nextLine();
System.out.print ("NAMA : "); nama[z]=input.nextLine();
System.out.print ("NILAI : "); nilai[z]=input.nextLine();
System.out.println ("-----------------------------");
}
System.out.println ("NPM NAMA NILAI");
System.out.println ("");
for (z=0;z<x;z++)
{
System.out.print (""+npm[z]+" ");
System.out.print (""+nama[z]+" ");
System.out.println ("\t"+nilai[z]+"");
}
}
}
OUTPUT :
Tidak ada komentar:
Posting Komentar