Laporan Praktikum C++
NIM/ No. Reg.
|
:
|
49013055
|
Nama
|
:
|
Evi Septiyani
Suparno
|
email
|
:
|
evi_septiyani@ymail.com
|
Laporan
|
:
|
Tugas Akhir Kasir Makanan
|
Coding Kasir Makanan
|
Source
Code dan deskripsi singkat
|
projectevi.h
#pragma once
namespace projectevi {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// Summary for projectevi
/// </summary>
public ref class projectevi : public
System::Windows::Forms::Form
{
public:
projectevi(void)
{
InitializeComponent();
//
//TODO: Add the constructor code
here
//
}
protected:
/// <summary>
/// Clean up any resources being
used.
/// </summary>
~projectevi()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::GroupBox^
groupBox1;
protected:
private: System::Windows::Forms::Label^ label6;
private: System::Windows::Forms::TextBox^
textBox4;
private: System::Windows::Forms::Label^ label5;
private: System::Windows::Forms::ComboBox^
comboBox2;
private: System::Windows::Forms::Label^ label3;
private: System::Windows::Forms::TextBox^
textBox2;
private: System::Windows::Forms::TextBox^
textBox1;
private: System::Windows::Forms::Label^ label2;
private: System::Windows::Forms::Label^ label1;
private: System::Windows::Forms::ComboBox^
comboBox1;
private: System::Windows::Forms::Button^
button2;
private: System::Windows::Forms::Button^
button1;
private: System::Windows::Forms::TextBox^
textBox5;
private: System::Windows::Forms::Label^ label7;
private: System::Windows::Forms::Label^ label4;
private: System::Windows::Forms::TextBox^
textBox3;
private: System::Windows::Forms::Button^
button3;
protected:
private:
/// <summary>
/// Required designer variable.
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer
support - do not modify
/// the contents of this method
with the code editor.
/// </summary>
void InitializeComponent(void)
{
System::ComponentModel::ComponentResourceManager^
resources = (gcnew System::ComponentModel::ComponentResourceManager(projectevi::typeid));
this->groupBox1 = (gcnew System::Windows::Forms::GroupBox());
this->button3 = (gcnew System::Windows::Forms::Button());
this->button2 = (gcnew System::Windows::Forms::Button());
this->button1 = (gcnew System::Windows::Forms::Button());
this->textBox5 = (gcnew System::Windows::Forms::TextBox());
this->label7 = (gcnew System::Windows::Forms::Label());
this->label4 = (gcnew System::Windows::Forms::Label());
this->textBox3 = (gcnew System::Windows::Forms::TextBox());
this->label6 = (gcnew System::Windows::Forms::Label());
this->textBox4 = (gcnew System::Windows::Forms::TextBox());
this->label5 = (gcnew System::Windows::Forms::Label());
this->comboBox2 = (gcnew System::Windows::Forms::ComboBox());
this->label3 = (gcnew System::Windows::Forms::Label());
this->textBox2 = (gcnew System::Windows::Forms::TextBox());
this->textBox1 = (gcnew System::Windows::Forms::TextBox());
this->label2 = (gcnew System::Windows::Forms::Label());
this->label1 = (gcnew System::Windows::Forms::Label());
this->comboBox1 = (gcnew System::Windows::Forms::ComboBox());
this->groupBox1->SuspendLayout();
this->SuspendLayout();
//
// groupBox1
//
this->groupBox1->BackgroundImage = (cli::safe_cast<System::Drawing::Image^
>(resources->GetObject(L"groupBox1.BackgroundImage")));
this->groupBox1->Controls->Add(this->button3);
this->groupBox1->Controls->Add(this->button2);
this->groupBox1->Controls->Add(this->button1);
this->groupBox1->Controls->Add(this->textBox5);
this->groupBox1->Controls->Add(this->label7);
this->groupBox1->Controls->Add(this->label4);
this->groupBox1->Controls->Add(this->textBox3);
this->groupBox1->Controls->Add(this->label6);
this->groupBox1->Controls->Add(this->textBox4);
this->groupBox1->Controls->Add(this->label5);
this->groupBox1->Controls->Add(this->comboBox2);
this->groupBox1->Controls->Add(this->label3);
this->groupBox1->Controls->Add(this->textBox2);
this->groupBox1->Controls->Add(this->textBox1);
this->groupBox1->Controls->Add(this->label2);
this->groupBox1->Controls->Add(this->label1);
this->groupBox1->Controls->Add(this->comboBox1);
this->groupBox1->Location = System::Drawing::Point(12, 12);
this->groupBox1->Name = L"groupBox1";
this->groupBox1->Size = System::Drawing::Size(291, 317);
this->groupBox1->TabIndex = 7;
this->groupBox1->TabStop = false;
this->groupBox1->Text = L"Kasir Makanan";
//
// button3
//
this->button3->Location = System::Drawing::Point(219, 55);
this->button3->Name = L"button3";
this->button3->Size = System::Drawing::Size(56, 23);
this->button3->TabIndex = 25;
this->button3->Text = L"Cek";
this->button3->UseVisualStyleBackColor = true;
this->button3->Click += gcnew System::EventHandler(this, &projectevi::button3_Click);
//
// button2
//
this->button2->Location = System::Drawing::Point(191, 273);
this->button2->Name = L"button2";
this->button2->Size = System::Drawing::Size(75, 23);
this->button2->TabIndex = 24;
this->button2->Text = L"Hitung";
this->button2->UseVisualStyleBackColor = true;
this->button2->Click += gcnew System::EventHandler(this, &projectevi::button2_Click);
//
// button1
//
this->button1->Location = System::Drawing::Point(138, 143);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(75, 23);
this->button1->TabIndex = 23;
this->button1->Text = L"Total";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &projectevi::button1_Click);
//
// textBox5
//
this->textBox5->BackColor = System::Drawing::SystemColors::ScrollBar;
this->textBox5->Location = System::Drawing::Point(166, 234);
this->textBox5->Name = L"textBox5";
this->textBox5->Size = System::Drawing::Size(100, 20);
this->textBox5->TabIndex = 22;
//
// label7
//
this->label7->AutoSize = true;
this->label7->Location = System::Drawing::Point(67, 237);
this->label7->Name = L"label7";
this->label7->Size = System::Drawing::Size(30, 13);
this->label7->TabIndex = 21;
this->label7->Text = L"Sisa ";
//
// label4
//
this->label4->AutoSize = true;
this->label4->Location = System::Drawing::Point(67, 208);
this->label4->Name = L"label4";
this->label4->Size = System::Drawing::Size(66, 13);
this->label4->TabIndex = 20;
this->label4->Text = L"Pembayaran";
//
// textBox3
//
this->textBox3->Location = System::Drawing::Point(166, 207);
this->textBox3->Name = L"textBox3";
this->textBox3->Size = System::Drawing::Size(100, 20);
this->textBox3->TabIndex = 19;
//
// label6
//
this->label6->AutoSize = true;
this->label6->Location = System::Drawing::Point(67, 180);
this->label6->Name = L"label6";
this->label6->Size = System::Drawing::Size(93, 13);
this->label6->TabIndex = 18;
this->label6->Text = L"Total Pembayaran";
//
// textBox4
//
this->textBox4->Location = System::Drawing::Point(166, 180);
this->textBox4->Name = L"textBox4";
this->textBox4->Size = System::Drawing::Size(100, 20);
this->textBox4->TabIndex = 17;
//
// label5
//
this->label5->AutoSize = true;
this->label5->Location = System::Drawing::Point(8, 129);
this->label5->Name = L"label5";
this->label5->Size = System::Drawing::Size(102, 13);
this->label5->TabIndex = 16;
this->label5->Text = L"Pembayaran Melalui";
//
// comboBox2
//
this->comboBox2->FormattingEnabled = true;
this->comboBox2->Items->AddRange(gcnew cli::array< System::Object^
>(4) {L"Tunai", L"BCA", L"Mandiri", L"BNI"});
this->comboBox2->Location = System::Drawing::Point(11, 145);
this->comboBox2->Name = L"comboBox2";
this->comboBox2->Size = System::Drawing::Size(121, 21);
this->comboBox2->TabIndex = 15;
this->comboBox2->Text = L"Tunai";
this->comboBox2->SelectedIndexChanged += gcnew System::EventHandler(this, &projectevi::comboBox2_SelectedIndexChanged);
//
// label3
//
this->label3->AutoSize = true;
this->label3->Location = System::Drawing::Point(5, 92);
this->label3->Name = L"label3";
this->label3->Size = System::Drawing::Size(78, 13);
this->label3->TabIndex = 12;
this->label3->Text = L"Jumlah Orang :";
//
// textBox2
//
this->textBox2->Location = System::Drawing::Point(89, 89);
this->textBox2->Name = L"textBox2";
this->textBox2->Size = System::Drawing::Size(100, 20);
this->textBox2->TabIndex = 11;
//
// textBox1
//
this->textBox1->Location = System::Drawing::Point(89, 57);
this->textBox1->Name = L"textBox1";
this->textBox1->Size = System::Drawing::Size(121, 20);
this->textBox1->TabIndex = 10;
//
// label2
//
this->label2->AutoSize = true;
this->label2->Location = System::Drawing::Point(8, 60);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(72, 13);
this->label2->TabIndex = 9;
this->label2->Text = L"Harga
: ";
//
// label1
//
this->label1->AutoSize = true;
this->label1->Location = System::Drawing::Point(5, 25);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(77, 13);
this->label1->TabIndex = 8;
this->label1->Text = L"Paket Makan :";
//
// comboBox1
//
this->comboBox1->FormattingEnabled = true;
this->comboBox1->Items->AddRange(gcnew cli::array< System::Object^
>(3) {L"Makan
Sepuasnya", L"Makan Sepuasnya + Minum",
L"Makan Sepuasnya
(family)"});
this->comboBox1->Location = System::Drawing::Point(90, 25);
this->comboBox1->Name = L"comboBox1";
this->comboBox1->Size = System::Drawing::Size(186, 21);
this->comboBox1->TabIndex = 7;
this->comboBox1->Text = L"Makan Sepuasnya";
//
// projectevi
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->BackgroundImage = (cli::safe_cast<System::Drawing::Image^
>(resources->GetObject(L"$this.BackgroundImage")));
this->ClientSize = System::Drawing::Size(315, 341);
this->Controls->Add(this->groupBox1);
this->Name = L"projectevi";
this->Text = L"Restaurant Evi";
this->Load += gcnew System::EventHandler(this, &projectevi::projectevi_Load);
this->groupBox1->ResumeLayout(false);
this->groupBox1->PerformLayout();
this->ResumeLayout(false);
}
#pragma endregion
private: System::Void comboBox1_SelectedIndexChanged(System::Object^
sender, System::EventArgs^
e) {
}
private: System::Void projectevi_Load(System::Object^ sender, System::EventArgs^
e) {
}
private: System::Void comboBox2_SelectedIndexChanged(System::Object^
sender, System::EventArgs^
e) {
}
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^
e) {
double hasil;//deklarasi variabel hasil
int hargaA, hargaB;//deklarasi variabel hargaA dan hargaB
String^ banknya;//deklarasi pemilihan
hargaA = int::Parse(textBox1->Text);
hargaB = int::Parse(textBox2->Text);
banknya = comboBox2->Text;//variabel berdasarkan combobox2
yang dipilih
if (banknya == "Tunai")//jika
dipilih pembayaran tunai
hasil = Convert::ToDouble (hargaA*hargaB);//maka hanya membayar harga asli
tanpa diskon
else if (banknya == "BCA")//jika melalui bca
hasil = Convert::ToDouble
((hargaA*hargaB)-(hargaA*hargaB*0.5));//mendapatkan diskon sebesar 50%
else if (banknya == "Mandiri")//jika melalui mandiri
hasil = Convert::ToDouble
((hargaA*hargaB)-(hargaA*hargaB*0.3));//mendapatkan diskon sebesar 30%
else if (banknya == "BNI")//jika melalui BNI
hasil = Convert::ToDouble
((hargaA*hargaB)-(hargaA*hargaB*0.4));//mendapatkan diskon sebesar 40%
textBox4->Text = hasil.ToString ();
//hasilnya akan di taruh / ditampilkan pada textbox4
}
private: System::Void button3_Click(System::Object^ sender, System::EventArgs^
e) {int nilaiA, nilaiB;
double hasil;//deklarasi variabel hasil
String^ tipenya;//deklarasi variabel pemilihan
untuk combobox
tipenya = comboBox1->Text;//pemilihan pada combobox1
if (tipenya == "Makan Sepuasnya")//apabila memilih makan sepuasnya
hasil = 140000;//muncul harga 140000
else if (tipenya == "Makan Sepuasnya + Minum")//apabila memilih makan sepuasnya + minum
hasil = 160000;//muncul harga 160000
else if (tipenya == "Makan Sepuasnya
(family)")//apabila memilih makan
sepuasnya(family)
hasil = 150000;//muncul harga 150000
textBox1->Text = hasil.ToString ();//maka harga akan di ditampilkan pada textbox1
}
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^
e) {
double hasil;//deklarasi variabel hasil
int hargaA, hargaB;//deklarasi int hargaA dan hargaB
hargaA = int::Parse(textBox3->Text);//nilai yang ada pada textbox3 akan
disimpan dalam variabel hargaA
hargaB = int::Parse(textBox4->Text);//nilai yang ada pada textbox4 akan
disimpan dalam variabel hargaB
hasil = Convert::ToDouble (hargaA-hargaB);//hasil dari pengurangan
berdasarkan hargaA dan hargaB disimpan pada variabel hasil
textBox5->Text = hasil.ToString ();
//di taruh atau ditampilkan pada textbox5
}
};
}
projectevi.cpp
#include "projectevi.h"//nama librari project
using namespace System;
using namespace System::Windows::Forms;//untuk menjalankan windows form
[STAThread]
void main(array<String^>^args){//fungsi
main
Application::EnableVisualStyles();//me enable visual styles pada
visual studio
Application::SetCompatibleTextRenderingDefault(false);
projectevi::projectevi form;//memberi nama project dan nama
form
Application::Run(%form);//merun form yang dibuat
}
Rubah beberapa setting
1. klik kanan pada project, pilih
properties, kemudian pilih linkerà system à sub sistem, dan pilih Windows (/SUBSYSTEM:WINDOWS)
2. klik advanced à pada entry point ketikkan main
|
Hasil
|
Modul9-1.h[Design]
Ketika diklik menu makanan yang dipilih kemudian klik
button cek akan muncul harga
Harga 140000 itu untuk 1 orang, untuk
menambahkan jumlah orang tinggal mengisi pada form textbox yang ada, kemudian
klik hitung, maka harga makanan akan dikalikan sesuai banyaknya orang setelah
diklik button total. Total pembayaran pun akan ada pada form pembayaran. Dan
jika pembayaran melalui pembayaran tunai, maka pembeli akan membayar dengan
harga penuh tanpa mendapat diskon apapun.
Jika pembayaran melalui kartu atm bank BCA
maka akan mendapat potongan harga sebesar 50% setelah di klik tombol total,
maka akan ditampilkan pada textBox total pembayaran setelah harga mendapat
potongan.
Jika pembayaran melalui kartu atm bank
Mandiri maka akan mendapat potongan harga sebesar 30% setelah di klik tombol
total, maka akan ditampilkan pada textBox total pembayaran setelah harga
mendapat potongan.
Jika pembayaran melalui kartu atm bank BNI
maka akan mendapat potongan harga sebesar 40% setelah di klik tombol total,
maka akan ditampilkan pada textBox total pembayaran setelah harga mendapat
potongan.
Pada kolom pembayaran, untuk memasukkan jumlah
uang yang dibayarkan, pada textbox pembayaran akan dikurangi dengan textbox
total pembayaran setelah diklik button hitung. Jika mendapat kembalian maka
akan di simpan pada sisa.
|
Deskripsi Singkat dari Program TA mengenai Kasir Makanan:
Deskripsi
dari project kasir makanan yaitu program ini dibuat berdasarkan paket makanan,
apabila salah satu makanan dipilih maka saat dicek menggunakan tombol
"Cek" harga dari makanan yang dipilih akan muncul, misalnya saat
paket “Makan Sepuasnya dipilih” saat diklik tombol cek maka akan muncul harga
140000 pada textBox1. Kemudian cara pembayarannya yaitu apabili melalui tunai,
tidak mendapat diskon, sedangkan apabila menggunakan BCA akan mendapat diskon
50%, Mandiri 30% dan BNI diskon 40%, kemudian setelah diklik total maka akan
muncul harga total yang seharusnya dibayar, apabila mendapat diskon maka
potongannya pun sudah dilakukan. Setelah itu, apabila pada textBox pembayaran
diinputkan nilai, maka saat diklik tombol hitung, akan dikurangi dengan total yang
seharusnya dibayar.
Flowchart :
Berikut adalah video pembuatan tugas akhir kasir makanan
Part 1 :
Part 2 :
Tidak ada komentar:
Posting Komentar