Kamis, 26 Mei 2011
tugas 8
soal
Buatlah program menghitung nilai akhir perkuliahan pada suatu matakuliah,
dengan ketentuan sebagai berikut:
• Nilai Absensi * 10 %
• Nilai Tugas * 20 %
• Nilai U.T.S * 30 %
• Nilai U.A.S * 40 %
Untuk proses penilaian dilakukan didalam file header dan simpan nama file
header tersebut hitnilai.h.
Tampilan yang diinginkan:
Program Hitung Nilai Akhir Mata Kuliah
Masukkan Nilai Absensi : ……<di-input>
Masukkan Nilai Tugas : ……<di-input>
Masukkan Nilai U.T.S : ……<di-input>
Masukkan Nilai U.A.S : ……<di-input>
Nilai Murni Absensi = <data-inputan> * 10% = <hasil-proses>
Nilai Murni Tugas = <data-inputan> * 20% = <hasil-proses>
Nilai Murni U.T.S = <data-inputan> * 30% = <hasil-proses>
Nilai Murni U.A.S = <data-inputan> * 40% = <hasil-proses>
Nilai Akhir yang diperoleh sebesar : ….. <hasil-proses>
jawab
/*-----------------------------------*/
/*program dengan file header sendiri*/
/*----------------------------------*/
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
#include "hitnilai.h"
/*hitnilai.h
*/
mulai()
awal
int absen,tugas1,UTS1,UAS1,nilai,absensi,tugas2,UTS2,UAS2,nilaiakhir;
hapus();
warna(4);
tampil("\nPROGRAM MENGHITUNG NILAI AKHIR MATA KULIAH\n");
cout<<endl;
cout<<"Masukkan Nilai Absensi : ";cin>>absen;
cout<<"Masukkan Nilai Tugas : ";cin>>tugas1;
cout<<"Masukkan Nilai U.T.S : ";cin>>UTS1;
cout<<"Masukkan Nilai U.A.S : ";cin>>UAS1;
absensi = absen*10/100;
tugas2 = tugas1*20/100;
UTS2 = UTS1*30/100;
UAS2 = UAS1*40/100;
nilaiakhir = absensi+tugas2+UTS2+UAS2;
cout<<endl;
cout<<"----------------------------------------------------";
cout<<endl;
cout<<"\tNilai Murni Absensi = "<<absen;
cout<<" * 10% = "<<absensi<<endl;
cout<<"\tNilai Murni Tugas = "<<tugas1;
cout<<" * 20% = "<<tugas2<<endl;
cout<<"\tNilai Murni U.T.S = "<<UTS1;
cout<<" * 30% = "<<UTS2<<endl;
cout<<"\tNilai Murni U.A.S = "<<UAS1;
cout<<" * 40% = "<<UAS2;
cout<<endl;
cout<<"\tNilai Akhir yang diperoleh sebesar : "<<nilaiakhir;
cout<<endl;
cout<<"-----------------------------------------------------";
tahan;
akhir
catatan : kalo mou bisa di run anda harus ngeseve header y di include ----> BC5 (file kita saat mengintaal c++) ini dia header y
#define awal {
#define akhir }
#define mulai() main()
#define cetak cout
#define tampil cprintf
#define masuk scanf
#define hapus() clrscr()
#define jika if
#define warna textcolor
#define tahan getche()
download
Minggu, 22 Mei 2011
new tugas 7 ( kasir )
SOAL:
/*
bentuk input
----------------------------
Masukan nama Kasir :
Masukan Nama Pembeli :
input jumlah Data :
Data ke- 1
Input Kode Barang :
Input Jumlah Barang :
data ke-2
Input Kode Barang :
Input Jumlah Barang :
----------------------------
Bentuk Output
----------------------------
Kasir : Fadli No. Faktur : F-001
Pembeli : Asmara Jati Tanggal : 28-10-1981
-------------------------------------------------- --------------------------------------
No. Nama Harga Qty Jumlah
Urut Barang Satuan Harga
-------------------------------------------------- --------------------------------------
1. Pensil Rp. 500 5 Rp. 2.500
2. Pulpen Rp. 1.500 10 Rp. 15.000
-------------------------------------------------- ---------------------------------------
Total Bayar Rp. 17.500
Uang Bayar Rp. 20.000
Kembali Rp. 2.500
-------------------------------------------------- -----------------------------------------
T E R I M A K A S I H
-------------------------------------------------- -----------------------------------------
jawab
#include <iostream.h>
#include <stdio.h>
#include <conio.h>
#include <iomanip.h>
main()
{
char namap[50], namak[50], tgl[50], lanjut, ulangi;
char *namab[9];
long hasat[9], jumhar[9], totbar[9];
long bayar, kembali;
int jumbel[9], kode[9] = {1,2,3,4,5,6,7,8,9};
int x, y, z = 0;
clrscr();
cout<<"\n\n\t\tNama Kasir = ";gets(namak);
cout<<"\n\n\t\tTanggal Login [dd/mm/yyyy] = ";gets(tgl);
cout<<"\n\n\t\tKasir saat ini "<<namak;
cout<<"\n\n\n\t\tPress Anykey To Countinue . . .";
lanjut = getche();
if(lanjut == 'Q')
goto program;
else
goto program;
program:
clrscr();
cout<<"\n\t\tMasukan Nama Pembeli = ";gets(namap);
cout<<"\t\tJumlah Data = ";cin>>y;
totbar[y] = 0;
for (x = 1; x <= y; x++)
{
cout<<"\n\t\t----------------------";
cout<<"\n\t\tData Ke-"<<x;
cout<<"\n\n\t\tInput Kode Barang = ";cin>>kode[x];
if(kode[x] == 1)
{
namab[x] = "Buku";
hasat[x] = 3500;
}
else if (kode[x] == 2)
{
namab[x] = "Pensil";
hasat[x] = 2000;
}
else if (kode[x] == 3)
{
namab[x] = "Pulpen";
hasat[x] = 2500;
}
else if (kode[x] == 4)
{
namab[x] = "Penggaris";
hasat[x] = 2500;
}
else if (kode[x] == 5)
{
namab[x] = "Serutan";
hasat[x] = 2000;
}
else if (kode[x] == 6)
{
namab[x] = "Penghapus";
hasat[x] = 2000;
}
else if (kode[x] == 7)
{
namab[x] = "Tipe-x";
hasat[x] = 4000;
}
else if (kode[x] == 8)
{
namab[x] = "Spidol";
hasat[x] = 5000;
}
else if (kode[x] == 9)
{
namab[x] = "Stabilo";
hasat[x] = 3000;
}
else if (kode[x] < 1 || kode[x] > 9)
{
clrscr();
cout<<"\n\t\tKode yang ada Masukan Salah.\n";
cout<<"\n\t\tPress Anykey to Continue . . .";
ulangi = getche();
if (ulangi == 'Q')
goto program;
else
goto program;
}
cout<<"\t\tAnda Memilih = "<<namab[x];
cout<<"\n\t\tDengan Harga Satuan = "<<hasat[x]<<endl;
cout<<"\t\tInput Jumlah Beli = ";cin>>jumbel[x];
jumhar[x] = hasat[x] * jumbel[x];
totbar[y] = totbar[y] + hasat[x] * jumbel[x];
}
cout<<"\n\t\tAda Kesalahan? [Y/T] ";
ulangi = getche();
if (ulangi == 'Y' || ulangi == 'y')
goto program;
bill:
clrscr();
cout<<"\nKasir = "<<namak;
cout<<setiosflags(ios::right)<<setw(55)<<"No faktur : FN-00"<<z<<endl;
cout<<"Pembeli = "<<namap;
cout<<setiosflags(ios::right)<<setw(46)<<"Tanggal = "<<tgl<<endl;
cout<<"--------------------------------------------------------------------------------";
cout<<" No Nama Harga Qty Jumlah \n";
cout<<"Unit Barang Satuan Harga \n";
cout<<"--------------------------------------------------------------------------------";
for(x = 1; x <= y; x++)
{
cout<<setiosflags(ios::left)<<setw(11)<<x;
cout<<setiosflags(ios::left)<<setw(19)<<namab[x];
cout<<setiosflags(ios::left)<<setw(19)<<hasat[x];
cout<<setiosflags(ios::left)<<setw(17)<<jumbel[x];
cout<<setiosflags(ios::left)<<setw(10)<<jumhar[x]<<endl;
}
cout<<"--------------------------------------------------------------------------------\n";
cout<<setiosflags(ios::right)<<setw(66)<<"Total Bayar = "<<totbar[y]<<endl;
cout<<setiosflags(ios::right)<<setw(66)<<"Uang Bayar = ";cin>>bayar;
if(bayar >= totbar[y])
kembali = bayar - totbar[y];
else
goto bill;
cout<<setiosflags(ios::right)<<setw(66)<<"Kembalian = "<<kembali<<endl;
cout<<"\n\n--------------------------------------------------------------------------------";
cout<<"\n\t\t\t\tTERIMA KASIH";
cout<<"\n--------------------------------------------------------------------------------";
cout<<"\n\nAnda Ingin Input Lagi? [Y/T] ";
ulangi = getche();
if (ulangi == 'Y' || ulangi == 'y')
{
z++;
goto program;
}
else
goto akhir;
akhir:
getch();
}
/*
bentuk input
----------------------------
Masukan nama Kasir :
Masukan Nama Pembeli :
input jumlah Data :
Data ke- 1
Input Kode Barang :
Input Jumlah Barang :
data ke-2
Input Kode Barang :
Input Jumlah Barang :
----------------------------
Bentuk Output
----------------------------
Kasir : Fadli No. Faktur : F-001
Pembeli : Asmara Jati Tanggal : 28-10-1981
--------------------------------------------------
No. Nama Harga Qty Jumlah
Urut Barang Satuan Harga
--------------------------------------------------
1. Pensil Rp. 500 5 Rp. 2.500
2. Pulpen Rp. 1.500 10 Rp. 15.000
--------------------------------------------------
Total Bayar Rp. 17.500
Uang Bayar Rp. 20.000
Kembali Rp. 2.500
--------------------------------------------------
T E R I M A K A S I H
--------------------------------------------------
jawab
#include <iostream.h>
#include <stdio.h>
#include <conio.h>
#include <iomanip.h>
main()
{
char namap[50], namak[50], tgl[50], lanjut, ulangi;
char *namab[9];
long hasat[9], jumhar[9], totbar[9];
long bayar, kembali;
int jumbel[9], kode[9] = {1,2,3,4,5,6,7,8,9};
int x, y, z = 0;
clrscr();
cout<<"\n\n\t\tNama Kasir = ";gets(namak);
cout<<"\n\n\t\tTanggal Login [dd/mm/yyyy] = ";gets(tgl);
cout<<"\n\n\t\tKasir saat ini "<<namak;
cout<<"\n\n\n\t\tPress Anykey To Countinue . . .";
lanjut = getche();
if(lanjut == 'Q')
goto program;
else
goto program;
program:
clrscr();
cout<<"\n\t\tMasukan Nama Pembeli = ";gets(namap);
cout<<"\t\tJumlah Data = ";cin>>y;
totbar[y] = 0;
for (x = 1; x <= y; x++)
{
cout<<"\n\t\t----------------------";
cout<<"\n\t\tData Ke-"<<x;
cout<<"\n\n\t\tInput Kode Barang = ";cin>>kode[x];
if(kode[x] == 1)
{
namab[x] = "Buku";
hasat[x] = 3500;
}
else if (kode[x] == 2)
{
namab[x] = "Pensil";
hasat[x] = 2000;
}
else if (kode[x] == 3)
{
namab[x] = "Pulpen";
hasat[x] = 2500;
}
else if (kode[x] == 4)
{
namab[x] = "Penggaris";
hasat[x] = 2500;
}
else if (kode[x] == 5)
{
namab[x] = "Serutan";
hasat[x] = 2000;
}
else if (kode[x] == 6)
{
namab[x] = "Penghapus";
hasat[x] = 2000;
}
else if (kode[x] == 7)
{
namab[x] = "Tipe-x";
hasat[x] = 4000;
}
else if (kode[x] == 8)
{
namab[x] = "Spidol";
hasat[x] = 5000;
}
else if (kode[x] == 9)
{
namab[x] = "Stabilo";
hasat[x] = 3000;
}
else if (kode[x] < 1 || kode[x] > 9)
{
clrscr();
cout<<"\n\t\tKode yang ada Masukan Salah.\n";
cout<<"\n\t\tPress Anykey to Continue . . .";
ulangi = getche();
if (ulangi == 'Q')
goto program;
else
goto program;
}
cout<<"\t\tAnda Memilih = "<<namab[x];
cout<<"\n\t\tDengan Harga Satuan = "<<hasat[x]<<endl;
cout<<"\t\tInput Jumlah Beli = ";cin>>jumbel[x];
jumhar[x] = hasat[x] * jumbel[x];
totbar[y] = totbar[y] + hasat[x] * jumbel[x];
}
cout<<"\n\t\tAda Kesalahan? [Y/T] ";
ulangi = getche();
if (ulangi == 'Y' || ulangi == 'y')
goto program;
bill:
clrscr();
cout<<"\nKasir = "<<namak;
cout<<setiosflags(ios::right)<<setw(55)<<"No faktur : FN-00"<<z<<endl;
cout<<"Pembeli = "<<namap;
cout<<setiosflags(ios::right)<<setw(46)<<"Tanggal = "<<tgl<<endl;
cout<<"--------------------------------------------------------------------------------";
cout<<" No Nama Harga Qty Jumlah \n";
cout<<"Unit Barang Satuan Harga \n";
cout<<"--------------------------------------------------------------------------------";
for(x = 1; x <= y; x++)
{
cout<<setiosflags(ios::left)<<setw(11)<<x;
cout<<setiosflags(ios::left)<<setw(19)<<namab[x];
cout<<setiosflags(ios::left)<<setw(19)<<hasat[x];
cout<<setiosflags(ios::left)<<setw(17)<<jumbel[x];
cout<<setiosflags(ios::left)<<setw(10)<<jumhar[x]<<endl;
}
cout<<"--------------------------------------------------------------------------------\n";
cout<<setiosflags(ios::right)<<setw(66)<<"Total Bayar = "<<totbar[y]<<endl;
cout<<setiosflags(ios::right)<<setw(66)<<"Uang Bayar = ";cin>>bayar;
if(bayar >= totbar[y])
kembali = bayar - totbar[y];
else
goto bill;
cout<<setiosflags(ios::right)<<setw(66)<<"Kembalian = "<<kembali<<endl;
cout<<"\n\n--------------------------------------------------------------------------------";
cout<<"\n\t\t\t\tTERIMA KASIH";
cout<<"\n--------------------------------------------------------------------------------";
cout<<"\n\nAnda Ingin Input Lagi? [Y/T] ";
ulangi = getche();
if (ulangi == 'Y' || ulangi == 'y')
{
z++;
goto program;
}
else
goto akhir;
akhir:
getch();
}
mau liat file aslinya ??? klik di bawah ini.........ok
Langganan:
Postingan (Atom)