0% found this document useful (0 votes)
7 views3 pages

Tugas Pemrograman OOP: Cek Grade

The document discusses two Java programs written by Tasya Indri Agustina Dano, a student in class XI RPL. The first program uses an 'if' statement to check a student's grade based on their score. It takes in a name and score as input, then outputs the grade. The second program uses a 'while' loop to print the iteration number from 0 to 10.

Uploaded by

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

Tugas Pemrograman OOP: Cek Grade

The document discusses two Java programs written by Tasya Indri Agustina Dano, a student in class XI RPL. The first program uses an 'if' statement to check a student's grade based on their score. It takes in a name and score as input, then outputs the grade. The second program uses a 'while' loop to print the iteration number from 0 to 10.

Uploaded by

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

Nama : Tasya Indri Agustina Dano

Kelas : XI RPL
No. Absen : 33

TUGAS PEMROGRAMAN BERORIENTASI OBJEK

#Application1 (menggunakan ‘if’)


package pertemuan2;

/**
*
* @author USER
*/
import [Link];

public class CekGradeNilai {


public static void main(String[] args) {

int nilai;
String nama, grade;

Scanner scan = new Scanner([Link]);

[Link]("Nama: ");
nama = [Link]();
[Link]("Nilai: ");
nilai = [Link]();

if ( nilai >= 90 ) {
grade = "A";
} else if ( nilai >= 80 ){
grade = "B+";
} else if ( nilai >= 70 ){
grade = "B";
} else if ( nilai >= 60 ){
grade = "C+";
} else if ( nilai >= 50 ){
grade = "C";
} else if ( nilai >= 40 ){
grade = "D";
} else {
grade = "E";
}

[Link]("Grade: " + grade);


}
}

Outputnya :
#application2 (menggunakan ‘while’)
package perulangan;

/**
*
* @author USER
*/
public class PerulanganDoWhile {
public static void main(String[] args) {

// membuat variabel
int i = 0;

do {
[Link]("perulangan ke-" + i);
i++;
} while ( i <= 10);

}
}
Outputnya:

You might also like