Kamis, 25 April 2019



FORM LOGIN



package com.example.sewabaju

import android.os.Bundle;

import android.app.Activity;

import android.content.Intent;

import android.view.Menu;

import android.view.View;

import android.widget.Button;

import android.widget.EditText;

import android.widget.Toast;



public class MainActivity extends Activity {

               

                private EditText username;

                private EditText pass;

               

                @Override

                protected void onCreate(Bundle savedInstanceState) {

                                super.onCreate(savedInstanceState);

                                setContentView(R.layout.activity_main);

                                username= (EditText) findViewById(R.id.Txtuser);

                                pass= (EditText) findViewById(R.id.Txtpassword);

                                Button login = (Button)findViewById(R.id.login);

                }



                public void Login(View view){

                                String Nm = username.getText().toString();

                                String psw = pass.getText().toString();

                                if (Nm.equals("admin") && psw.equals("1")){

                                                Intent i = new Intent (this,MenuActivity.class);

                                                startActivityForResult(i, 0);

                                }

                                else {

                                                Toast.makeText(getApplicationContext(),

                                                                                "Password Atau Username Salah, Silahkan Coba Lagi",

                                                                                Toast.LENGTH_LONG).show();

                                }

                }

               



}





FORM MENU

Saat pilihan menu hanya menambah kan onclik

<Button
        android:id="@+id/pria"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="20dp"
        android:layout_marginTop="32dp"
        android:text="Pria"
        android:onClick="Pria"/>

    <Button
        android:id="@+id/wanita"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/pria"
        android:layout_alignBottom="@+id/pria"
        android:layout_marginLeft="41dp"
        android:layout_toRightOf="@+id/pria"
        android:text="Wanita"
        android:onClick="Wanita" />

CARI TOTAL HARGA SEWA BAJU

package com.example.sewabaju;

import android.os.Bundle;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.Toast;
import android.widget.RadioGroup.OnCheckedChangeListener;

public class PriaActivity extends Activity implements android.widget.RadioGroup.OnCheckedChangeListener{
      RadioButton RB0,RB1;
      public static final String EXTRA_TEXT="com.example.EXTRA_TEXT";
       public static final String EXTRA_NUMBER="com.example.EXTRA_NUMBER";
       

       EditText editText1,editText2,editText3,editText4;
       Button pesan;
       RadioGroup radioGroup;
       String tujuan,varktp,varnama,vartlp;
       Integer harga, total, jumlah;
       
       
      @Override
      protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_pria);
           
           
            RB0 = (RadioButton)findViewById(R.id.radio0);
        RB1 = (RadioButton)findViewById(R.id.radio1);
       
        radioGroup=(RadioGroup)findViewById(R.id.radioGroup1);
        radioGroup.setOnCheckedChangeListener((OnCheckedChangeListener) this);
        editText1=(EditText)findViewById(R.id.editText1);
        editText2=(EditText)findViewById(R.id.editText2);
        editText3=(EditText)findViewById(R.id editText3.);
        editText4=(EditText)findViewById(R.id.editText4);
        pesan= (Button) findViewById(R.id.button1);
        pesan.setOnClickListener(new View.OnClickListener()
       
       
       
       
        {
      
                  @Override
                  public void onClick(View arg0) {
                        // TODO Auto-generated method stub
                       
                 
                  int h=Integer.parseInt(editText1.getText().toString());
                  int j=Integer.parseInt(editText2.getText().toString());
                  int total =h*j;
                  editText4.setText(""+total);
                  String alert1="anda memilih paket snack dengan isi "+editText3.getText();
                  String alert2="sebanyak "+editText2.getText()+" pcs";
                  String alert3="dengan harga/pcs "+editText1.getText();
                  String alert4="grand total "+editText4.getText();
                  String alert5="pesanan akan segera sampai di alamat anda";
                  String alert6="TERIMAKASIH";
                  AlertDialog.Builder builder = new AlertDialog.Builder(PriaActivity.this);
                  builder.setTitle("pembelian berhasil !!").setMessage
                  (alert1+ "\n" +alert2+ "\n" +alert3+"\n"+alert4+ "\n" +alert5+ "\n" +alert6).setNeutralButton("close", new DialogInterface.OnClickListener() {
                                   
                                    @Override
                                    public void onClick(DialogInterface dialog, int witch) {
                                          // TODO Auto-generated method stub
                                          dialog.cancel();
                                    }
                              }).show();
                  }
            });
       
      }

      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
            // Inflate the menu; this adds items to the action bar if it is present.
            getMenuInflater().inflate(R.menu.menu, menu);
            return true;
      }

      @Override
      public void onCheckedChanged(RadioGroup arg0, int arg1) {
            if(RB0.isChecked()){
                  Toast.makeText(this,"Snack original best of the best",Toast.LENGTH_LONG).show();
                  editText3.setText("french fries");
                  editText1.setText("12000");
                 
            }else if(RB1.isChecked()) {
                  Toast.makeText(this,"crispy chicken wings,tasteful",Toast.LENGTH_LONG).show();
                  editText3.setText("chicken wings");
                  editText1.setText("7000");

            }
      }

}
     





Sampai sini harusnya bisa di run tapi karna kendala laptop lemot dan kurang mendukung jadi ga bisa menampilkan hasil run














Kamis, 05 Juli 2018

Tugas UAS Algoritma ( Ahmad Dedy Setiawan )



Selamat malam kali ini saya membuat program tentang cuci steam menggunakan aplikasi visual studio 2013 dan database pada mc.acces , program ini memang sangat sederhana sekali karena memang masih dalam proses belajar dan semoga kedepannya akan di perbaiki dan lebih bagus lagi


Ini adalah hasil desain outputnya yang sederhana






Ini adalah hasil desain inputnya







ini adalah hasil input di websitenya



Ini adalah source codenya

Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.OleDb

Partial Class paket
    Inherits System.Web.UI.Page
    Dim transaksi As OleDbConnection
    Dim constring As String = ConfigurationManager.ConnectionStrings("cobalagiConnectionString").ConnectionString
    Dim oConn As New OleDbConnection(constring)
    'Dim oTbl As New DataTable
    Dim xReader As OleDbDataReader
    Dim Sql As String


    Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Response.Redirect("dbpaket.aspx")
    End Sub

    Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load

    End Sub

    Protected Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Dim sql As String = "INSERT INTO paketcucisteam VALUES ('" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "');"
        Dim oCmd As New OleDbCommand
        oConn.Open()
        oCmd.Connection = oConn
        oCmd.CommandText = sql
        oCmd.ExecuteNonQuery()

    End Sub

    Protected Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        If Not Len(TextBox2.Text) = 0 Then
            oConn.Close()
            oConn.Open()
            Dim ocmd As New OleDbCommand("SELECT * FROM paketcucisteam where namapaket='" + TextBox2.Text + "'", oConn)
            xReader = ocmd.ExecuteReader
            If xReader.HasRows Then
                xReader.Read()
                TextBox1.Text = xReader("codepaket")
                TextBox3.Text = xReader("harga")

            Else
                TextBox1.Text = "Nama paket Tidak ada"
                Exit Sub
            End If
            xReader.Close()

        End If
    End Sub

    Protected Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
        Dim sql As String = "DELETE FROM paketcucisteam where namapaket=('" & TextBox2.Text & "');"
        Dim oCmd As New OleDbCommand
        oConn.Open()
        oCmd.Connection = oConn
        oCmd.CommandText = sql
        oCmd.ExecuteNonQuery()

    End Sub
End Class


 flow chart