0% found this document useful (0 votes)
77 views4 pages

Program Penilaian Mahasiswa Java

This document contains the code for a Java program that allows a user to input student data including name, student ID, test scores, and calculates their final grade, comment, and status. The program stores up to 10 student entries in arrays, displays the results in a table, and allows the user to repeat the process or end the program.

Uploaded by

Samuel Ardiyanto
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views4 pages

Program Penilaian Mahasiswa Java

This document contains the code for a Java program that allows a user to input student data including name, student ID, test scores, and calculates their final grade, comment, and status. The program stores up to 10 student entries in arrays, displays the results in a table, and allows the user to repeat the process or end the program.

Uploaded by

Samuel Ardiyanto
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Tugas 8 Pemrograman Dasar 1

Samuel Ardiyanto
181-111-001
Script :
1. /*
2. * To change this license header, choose License Headers in Project Properties.
3. * To change this template file, choose Tools | Templates
4. * and open the template in the editor.
5. */
6. package javaapplication14;
7.
8. import [Link];
9.
10. /**
11. *
12. * @author USER
13. */
14. public class JavaApplication14 {
15.
16. /**
17. * @param args the command line arguments
18. */
19. public static void main(String[] args) {
20. int i, z;
21. Scanner in = new Scanner([Link]);
22. String OK;
23. String[] Nama = new String[10];
24. String[] NRP = new String[10];
25. String[] Komen = new String[10];
26. String[] Status = new String[10];
27. float[] NT1 = new float[10];
28. float[] NT2 = new float[10];
29. float[] TugasT = new float[10];
30. float[] NUT = new float[10];
31. float[] NUA = new float[10];
32. float[] NA = new float[10];
33. char[] Grade = new char[10];
34. boolean ulang = true;
35. do {
36. for (z = 0; z < [Link]; z++) {
37. [Link]("Nama : ");
38. Nama[z] = [Link]();
39. [Link]("NRP : ");
40. NRP[z] = [Link]();
41. [Link]("NIlai Tugas 1 : ");
42. NT1[z] = [Link]();
43. while ((NT1[z] > 100) || (NT1[z] < 0)) {
44. [Link]("ERROR Nilai Invalid");
45. [Link]("");
46. [Link]("Masukkan Nilai Tugas 1 : ");
47. NT1[z] = [Link]();
48. }
49. [Link]("NIlai Tugas 2 : ");
50. NT2[z] = [Link]();
51. while ((NT2[z] > 100) || (NT2[z] < 0)) {
52. [Link]("ERROR Nilai Invalid");
53. [Link]("");
54. [Link]("Masukkan Nilai Tugas 2 : ");
55. NT2[z] = [Link]();
56. }
57. [Link]("Nilai UTS : ");
58. NUT[z] = [Link]();
59. while ((NUT[z] > 100) || (NUT[z] < 0)) {
60. [Link]("ERROR Nilai Invalid");
61. [Link]("");
62. [Link]("Masukkan Nilai UTS : ");
63. NUT[z] = [Link]();
64. }
65. [Link]("Nilai UAS : ");
66. NUA[z] = [Link]();
67. while ((NUA[z] > 100) || (NUA[z] < 0)) {
68. [Link]("ERROR Nilai Invalid");
69. [Link]("");
70. [Link]("Masukkan Nilai UAS : ");
71. NUA[z] = [Link]();
72. }
73. if (NT1[z] > NT2[z]) {
74. TugasT = NT1;
75. } else {
76. TugasT[z] = NT2[z];
77. }
78. NA[z] = ([Link]((0.3f * TugasT[z]) + (0.3f * NUT[z]) + (0.4f * NUA[
z])));
79. if (NA[z] >= 56) {
80. Status[z] = "ANDA LULUS";
81. Komen[z] = " ";
82. if (NA[z] == 100) {
83. Status[z] = "ANDA LULUS";
84. Komen[z] = "NILAI SEMPURNA";
85. }
86. }
87. if (NA[z] == 0) {
88. Status[z] = "ANDA GAGAL";
89. Komen[z] = "PERLU BELAJAR LEBIH KERAS";
90. } else if (NA[z] < 56) {
91. Status[z] = "ANDA GAGAL";
92. Komen[z] = " ";
93. }
94. if (NA[z] >= 80) {
95. Grade[z] = 'A';
96. } else if (NA[z] >= 70) {
97. Grade[z] = 'B';
98. } else if (NA[z] >= 56) {
99. Grade[z] = 'C';
100. } else if (NA[z] >= 44) {
101. Grade[z] = 'D';
102. } else if (NA[z] < 44) {
103. Grade[z] = 'E';
104. }
105. }
106. [Link]("\n");
107. for (i = 0; i < [Link]; i++) {
108. [Link]("Nama" + "\t" + "\t" + "Nilai Akhir" + "\t" +
"\t" + "\t" + "Komentar" + "\t" + "\t" + "\t" + "\t" + "Grade" + "\t" + "\t" + "\t" +
"Status");
109. [Link](Nama[i] + "\t" + "\t" + NA[i] + "\t" + "\t" +
"\t" + Komen[i] + "\t" + "\t" + "\t" + "\t" + Grade[i] + "\t" + "\t" + "\t" + Status[i
]);
110. }
111. [Link]("\n");
112. [Link]("Apakah perlu diulang? [Y/N]?");
113. OK = [Link]();
114. if ("Y".equalsIgnoreCase(OK)) {
115. ulang = true;
116. } else if ("N".equalsIgnoreCase(OK)) {
117. ulang = false;
118. } else {
119. do {
120. [Link]("Ingin mengulang program : [Y/N] ?");
121. OK = [Link]();
122. } while (![Link]("Y") && ![Link]("N"))
;
123. if ("N".equalsIgnoreCase(OK)) {
124. ulang = false;
125. }
126. }
127. } while (ulang == true);
128. }
129. }

Hasil Output :

You might also like