Bagaimana Cara Membuat Looping input data mahasiswa dengan Java
contoh::
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package praktikumpbo;
import javax.swing.JOptionPane;
/**
*
* @author AN
*/
public class soal5 {
public static void main(String[] arg) {
String jmlkmpk = JOptionPane.showInputDialog(null, "Inputan Data mahasiswa ");
double a= Double.parseDouble(jmlkmpk);
for (int i = 0; i < a; i++) {
System.out.print("mahasiswa " + (i + 1) + " : ");
String nim=JOptionPane.showInputDialog("NIM");
String nama=JOptionPane.showInputDialog("masukkan nama");
System.out.println(nim+" "+nama);
}
}
}
contoh::
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package praktikumpbo;
import javax.swing.JOptionPane;
/**
*
* @author AN
*/
public class soal5 {
public static void main(String[] arg) {
String jmlkmpk = JOptionPane.showInputDialog(null, "Inputan Data mahasiswa ");
double a= Double.parseDouble(jmlkmpk);
for (int i = 0; i < a; i++) {
System.out.print("mahasiswa " + (i + 1) + " : ");
String nim=JOptionPane.showInputDialog("NIM");
String nama=JOptionPane.showInputDialog("masukkan nama");
System.out.println(nim+" "+nama);
}
}
}
Tidak ada komentar:
Posting Komentar