Sunday, 22 May 2016

FINAL PROJECT PEMROGRAMAN TERSTRUKTUR



TUGAS FINAL PROJECT PEMROGRAMAN TERSTRUKTUR
Oleh:
Dita Tri Utami                              15.02.9165
Lailiya Husna Hijriati                    15.02.9163
Maya Illa Fihim                            15.02.9166
Safitah Yuliana                             15.02.9167
Anis Kurlilah                                15.02.9123

STMIK AMIKOM YOGYAKARTA


PROGRAM KRS OFFLINE

#include <iostream>
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <string.h>
using namespace std;

int login();//perkenalkan fungsi login
int signin();//perkenalkan fungsi signin
int krsfungsi();//perkenalkan fungsi krs

static struct {//struktur data mahasiswa dan elemen yg mengisi
char nama[50];
char jurusan[3];
char kelas[3];
char nim[20];
char jjg[5];
int smt, th;
char dw[50];
}data_mhs;

static struct {//structure data krs dan elemen yg mengisi
char kode[10];
int key;
char mt_kuliah[50];
int sks;
} krs[10]={
            {"DM012",9404, "Lingkungan Bisnis                                    ",2},
            {"DM013",9400, "Bahasa Inggris II                          ",2},
            {"DM017",9402, "Komputer Grafis                           ",2},
            {"DM018",9405, "Pemrograman Terstruktur             ",4},
            {"DM019",9409, "Statistik                                         ",4},
            {"DM021",9407, "Pengelolaan Instalasi Komputer   ", 2},
            {"DM054",9403, "Komunikasi Data                          ", 2},
            {"DM055",9406, "Pemrograman Web                                    ", 2},
            {"DM056",9401, "Kecakapan Antar Personal                        ", 2},
            {"DM057",9408, "Praktikum Akuntansi                    ", 2}
};
char j, user[50], pass[50];//variabel global j=jawab, username dan password
int main()
{
while(j!='a'||j!='b'||j!='c')//syarat pengulangan jika input bukan keyword a/b/c
{
            cout<<"--------------------------------------------------------\n";
            cout<<"           SYSTEM KRS OFFLINE STMIK AMIKOM YOGYAKARTA   \n";
            cout<<"--------------------------------------------------------\n";
            cout<<"a. Login\n";
            cout<<"b. Sign In\n";
            cout<<"c. Log Out\n";
            cout<<"::\n";
            scanf("%c",&j);
            switch(j)//memeriksa input data variabel j, jika a/b/c maka dijalankan
            {
                        case 'a':
                        login();//jika pilih a maka akan memanggil funsi login
                        break;
                        case 'b':
                        signin();
                        break;
                        case 'c'://jika pilihan c maka akan mengakhiri program
                        cout<<"\n\nThanks For Use This System\n\n";
                        system("pause");
                        return 0;
            }
}
system("cls");//clear screen
getch();
}

int signin()//funsi sign in krs offline
{
            do{//menjalankan perintah dibawahnya dan mengulang bila memenuhi syarat
                        cout<<"---Create Your Account KRS Offline STMIK AMIKOM YOGYAKARTA---\n\n";
                       
                        cout<<"Masukkan Data Dengan Benar dan Lengkap\n";
                        cout<<"Nama Lengkap                                   :"; fflush(stdin); gets(data_mhs.nama);
                        cout<<"NIM                                       :";cin>>data_mhs.nim;
                        cout<<"Username                               :";cin>>user;
                        cout<<"Password                                :";cin>>pass;
                        cout<<"Jurusan (TI/S1/MI/BCIT/BCIS)        :";cin>>data_mhs.jurusan;
                        cout<<"Jenjang(S1/D3)                                  :";cin>>data_mhs.jjg;
                        cout<<"Semester                                 :";cin>>data_mhs.smt;
                        cout<<"Tahun Akademis                                :";cin>>data_mhs.th;
                        cout<<"Dosen Wali                            :";
fflush(stdin); gets(data_dw);
                        cout<<"Ingin Mengubah Data yang Telah Diinputkan ? (Y/N):\n\n";cin>>j;
            }
            while(j=='y'||j=='Y');//syarat pengulangan kembali ke do
            system("cls");
            cout<<"\n\nCongratulation Your Registration is Success, Your Account is Activated !!";
            cout<<"\nLogin Now ?(Y/N) : ";cin>>j;
            if(j=='Y'||j=='y')
            {//memanggil fungsi login
                        login();
            }
            else
            {
            cout<<"\n\nThanks For Joining Us in System KRS Offline STMIK AMIKOM YOGYAKARTA";         
            }
            getch();
            }
           

int login()//fungsi login krs offline
{
system("cls");
cout<<"---Login Now !---\n";
int y;//variabel lokal fungsi login
char loginuser[50];
char loginpass[50];
cout<<"\nUSER                      : ";cin>>loginuser;
cout<<"\nPASSWORD          : ";cin>>loginpass;
if(strcmp(loginuser,user)==0&&strcmp(loginpass,pass)==0)
{
            cout<<"\nLogin Success";
            cout<<"Press (Y) to print your KRS !\n";
            scanf("%d",&y);
            system("cls");
            krsfungsi();//memanggil fungsi KRS
}
else{//jika tidak memenuhi syarat
            cout<<"Username/Password Incorrect, or your account is not activated.\n";
            cout<<"\na. Login Again\nb. Registration Now\n ::";cin>>j;
                        if(j=='a'||j=='A')
                        {
                                    login();//memanggil fungsi login
                        }
                        else if(j=='b'||j=='B')
                        {
                                    signin();//memanggil fungsi sign in
                        }
}
}

int krsfungsi()//fungsi krs(print KRS)
{
int i, totalsks;//variabel lokal
totalsks=0;//nilai awal variabel total sks
cout<<"\t\tKARTU RENCANA STUDY (KRS)\n\n";
cout<<"\nNama Mahasiswa    : "<<data_mhs.nama;
cout<<"\nNIM                        : "<<data_mhs.nim;
cout<<"\nJenjang                    : "<<data_mhs.jjg;
cout<<"\nTahun Akademis     : "<<data_mhs.th;
cout<<"\nSemester      : "<<data_mhs.smt;
cout<<"\nJurusan                    : "<<data_mhs.jurusan;
cout<<"\n---------------------------------------------------------------\n";
cout<<"  NO |  KODE | KEY  |          MATA KULIAH                   |SKS|";
cout<<"\n---------------------------------------------------------------\n";
for(i=0;i<10;i++)
{
cout<<"\n| "<<i+1<<" | "<<krs[i].kode<<" | "<<krs[i].key<<" | "<<krs[i].mt_kuliah<<" | "<<krs[i].sks<<" |";
totalsks+=krs[i].sks;//mencari total smt
}
cout<<"\n---------------------------------------------------------------\n";
cout<<"\n|                   Total SKS yang Diambil                                 | "<<totalsks<<"|";
cout<<"\n---------------------------------------------------------------\n";
return 0;
}
Output





No comments:

Post a Comment