Follow Us @soratemplates

Selasa, 31 Mei 2016

CONTOH SOAL PROGRAM RUBY SEQUENTIAL

SOAL


  1. Buatlah program untuk memasukkan 4 nilai tiga mata kuliah dan persentase presensi, kemudian menampilkan jumlah masing-masing mata kuliah, total seluruhnya, rata-rata, dan total persentase.

SOURCE CODE

puts "NILAI 3 MATA KULIAH dan PERSENTASE PRESENSI"
puts "-------------------------------------"
print "masukkan nilai UTS Kalkulus \t: "
UTS_Kalkulus=gets.to_f
print "masukkan nilai UAS Kalkulus \t: "
UAS_Kalkulus=gets.to_f
print "masukkan nilai Quis Kalkulus \t: "
Quis_Kalkulus=gets.to_f
print "masukkan nilai Tugas Kalkulus \t: "
Tugas_Kalkulus=gets.to_f
puts "-------------------------------------"
print "masukkan nilai UTS KWN \t\t: "
UTS_KWN=gets.to_f
print "masukkan nilai UAS KWN \t\t: "
UAS_KWN=gets.to_f
print "masukkan nilai Quis KWN \t: "
Quis_KWN=gets.to_f
print "masukkan nilai Tugas KWN \t: "
Tugas_KWN=gets.to_f
puts "-------------------------------------"
print "masukkan nilai UTS Oarkom \t: "
UTS_Oarkom=gets.to_f
print "masukkan nilai UAS Oarkom \t: "
UAS_Oarkom=gets.to_f
print "masukkan nilai Quis Oarkom \t: "
Quis_Oarkom=gets.to_f
print "masukkan nilai Tugas Oarkom \t: "
Tugas_Oarkom=gets.to_f
puts "-------------------------------------"
print "masukkan presensi kehadiran (%) \t: "
Presensi=gets.to_f
puts "-------------------------------------"
TotalKalkulus=UTS_Kalkulus+UAS_Kalkulus+Quis_Kalkulus+Tugas_Kalkulus
TotalKWN=UTS_KWN+UAS_KWN+Quis_KWN+Tugas_KWN
TotalOarkom=UTS_Oarkom+UAS_Oarkom+Quis_Oarkom+Tugas_Oarkom
Total=TotalKalkulus+TotalKWN+TotalOarkom
RataRata=Total/3
Persentase=Presensi/100*RataRata
puts "Total Nilai Kalkulus \t\t= "+TotalKalkulus.to_s
puts "Total Nilai KWN \t\t= "+TotalKWN.to_s
puts "Total Nilai Oarkom \t\t= "+TotalOarkom.to_s
puts "Total 3 Matkul \t\t\t= "+Total.to_s
puts "Rata-Rata \t\t\t= "+RataRata.to_s
puts "Total Persentase \t\t= "+Persentase.to_s
puts "-------------------------------------"



OUTPUT





Tidak ada komentar:

Posting Komentar