Postingan lainnya
bagaimana mengubah program java biasa menjari array
public class Tugas1 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Scanner input = new Scanner (System.in);
String nim ,nama , grade ;
double uts , uas , rata ;
System.out.println("Data Nilai Mahasiswa");
System.out.println("NIM");
nim =input.next();
System.out.println("NAMA");
nama =input.next();
System.out.println("NILAI UTS");
uts =input.nextDouble();
System.out.println("NILAI UAS");
uas =input.nextDouble();
rata = (uts+uas)/2;
if(rata<50)
grade = "E";
else if(rata<60)
grade = "D";
else if(rata<70)
grade = "C";
else if(rata<80)
grade = "B";
else
grade = "A";
System.out.println("==============================================================");
System.out.println("NIM\tNama\tUTS\tUAS\tN.Rata\tGrade");
System.out.println("==============================================================");
System.out.println(nim + "\t" + nama + "\t" + uts +"\t" + uas +"\t" + rata +"\t" + grade);
System.out.println("==");
System.out.println("==");
}
}
0
Tanggapan
Pertanyaan kamu tidak jelas, coba dijelaskan lebih baik
2 Jawaban:
<div>ya dikasih array aja bang,<br><br>misal</div><pre> String nama = ['Arif', 'farhan', 'aditya']; int nilai = [78 , 89 ,90];</pre><div><br><br>btw,maaf kalau gk sesuai sama jawaban yg lu mau :D<br>perbaiki dulu pertanyaanmu ya!</div>
0
<div>pertama harus tentuin dlu mana yg mau dijadiin array misalnya nama yauda di deklarasi sekaligus inisialisasi,misalnya<br>String [] namaArray={"budi","nia","wawan"};<br>kalo mau bkin array nilai tinggal bkin lg arraynya,kurang lebih gitu sih,semoga bermanfaat</div>
0