Bagi sobat duniaku yang kuliah di Stikom Prak. PBD ini adalah mata
kuliah di semester 3. monggo di pelajari source code jawaban pertemuan 3
:
begin
declare cMhs cursor for select nim,nama from mahasiswa
declare @nama varchar(100), @nim varchar(11)
open cMhs
fetch next from cMhs into @nim, @nama
while @@fetch_status = 0
begin
print 'Nim : '+@nim
print 'Nama : '+@nama
declare cNilai cursor for (select kode_mk, uts*0.3+uas*0.3+tugas*0.4 as nilai_akhir from nilai where nim = @nim)
declare @kode_mk varchar(6), @nilai_akhir numeric(30,2), @nh varchar(1), @bobot numeric(30,2), @ipmk numeric(30,2), @sks int, @ipk numeric(30,2), @ipx numeric(30,2), @jsks numeric(30,2)
set @jsks = 0
set @ipx = 0
open cNilai
fetch next from cNilai into @kode_mk, @nilai_akhir
while @@fetch_status = 0
begin
set @sks = (select sks from mk where kode_mk = @kode_mk)
if @nilai_akhir <= 44
begin
set @nh='E'
set @bobot=0
end
else if @nilai_akhir <=54
begin
set @nh='D'
set @bobot=1
end
else if @nilai_akhir <=59
begin
set @nh='C'
set @bobot=2
end
else if @nilai_akhir <=64
begin
set @nh='C+'
set @bobot=2.5
end
else if @nilai_akhir <=74
begin
set @nh='B'
set @bobot=3
end
else if @nilai_akhir <=79
begin
set @nh='B+'
set @bobot=3.5
end
else
begin
set @nh='A'
set @bobot=4
end
set @jsks = @jsks+@sks
set @ipmk = @bobot*@sks
set @ipx = @ipx+@ipmk
fetch next from cNilai into @kode_mk, @nilai_akhir
end
close cNilai
deallocate cNilai
set @ipk = @ipx/@jsks
print 'IPK : '+convert(varchar,@ipk)
print ''
fetch next from cMhs into @nim, @nama
end
close cMhs
deallocate cMhs
end
SEMOGA BERMANFAAT
Langganan:
Posting Komentar (Atom)







Tidak ada komentar:
Posting Komentar