Kamis, 18 April 2019

PENGAPLIKASIAN ARRAY PADA JAVA




PENGAPLIKASIAN ARRAY PADA JAVA




NAMA                  : RIZQI YULIARTA
 NIM               : 12184867
KELAS          : 12.2H.30





SISTEM INFORMASI
UBSI PSDKU PONTIANAK 2019
A.    Pengertian Array

Array adalah sebuah variabel yang bisa menyimpan banyak data dalam satu variabel. Array menggunakan indeks untuk memudahkan akses terhadap data yang disimpannya. Indeks array selalu dimulai dari 0 dan juga tidak selalu dalam bentuk angka, bisa juga karakter atau teks.
B.     Array Dimensi 1
Array  dimensi 1 adalah sekelompok data yang memiliki nama variable dan tipe data yang sama yang dapat diakses menggunakan 1 buah index saja.  

Contoh pengaplikasian array dimensi 1 menggunakan java :
C. Array Dimensi 2
Array dimensi 2 adalah array yang memiliki dua index.
Array dua dimensi ini sering digunakan untuk merepresentasikan tabel dari nilai yang terdiri dari informasi yang diatur berdasarkan baris dan kolom.
Contoh pengaplikasian array dimensi 2 menggunakan java :
D.    Array Dimensi 3
Array dimensi 3 merupakan elemen array yang memiliki baris, kolom dan ukuran lebih banyak daripada Array dua dimensi, ini adalah array perluasan dari array dua dimensi dan dapat dikembangkan ke lebih dari dua dimensi.
Contoh pengaplikasian array dimensi 3 menggunakan java :

Selasa, 02 April 2019

Latihan Form

form_input.php

<!DOCTYPE html>
<html>
<head>
<title>DATA DIRI</title>
</head>
<body>
<form action="form_output.php" method="post">
<h2 align="center">DATA DIRI</h2>
<table border="2" align="center">
<tr>
<td>Name</td>
<td><input type="text" name="nama"></td>
</tr>
<tr>
<td>Gender</td>
<td><input type="radio" name="gender" value="Female">Female
<input type="radio" name="gender" value="Male">Male
</td>
</tr>
<tr>
<td>Place, DOB</td>
<td><input type="text" name="dob"></td>
</tr>
<tr>
<td>Address</td>
<td><textarea name="add"></textarea></td>
</tr>
<tr>
<td>Hobby</td>
<td><input type="checkbox" name="hobi1" value="Badminton">
Badminton <br>
<input type="checkbox" name="hobi2" value="Travelling">
Travelling <br>
<input type="checkbox" name="hobi3" value="Climbing">
Climbing
</td>
</tr>
<td colspan="2"><input type="submit" name="PROCESS">
<input type="reset" name="CANCEL">
</td>
</tr>
</table>
</form>
</body>
</html>

form_output.php

<?php

$name= $_POST["nama"];
$gen = $_POST["gender"];
$dob = $_POST["dob"];
$address = $_POST["add"];
$hobi1 = $_POST["hobi1"];
$hobi2 = $_POST["hobi2"];
$hobi3 = $_POST["hobi3"];

echo "Nama : $name <br>";
echo "Gender : $gen <br>";
echo "Place, DOB : $dob <br>";
echo "Address : $address <br>";
echo "Hobby : $hobi1 $hobi2 $hobi3";

?>







Kamis, 28 Maret 2019

the application of Array in Java

A. Definition of Arrays

An array is a variable that can store a lot of data in one variable. Arrays use indexes to facilitate access to the data they store. The array index always starts from 0 and also not always in the form of numbers, it can also be characters or text.

B. 1 Dimensional Array
1 dimensional array are of data that have variable names and the same data type that can be accessed using just one index.


An example of applying an array 1 dimensional  using java:
C. 2 dimensional array
2 dimensional arrays are arrays that have two indexes.
This two-dimensional array is often used to represent tables of values consisting of information arranged by rows and columns.

An example of applying a 2 dimensional array  using java:
D. 3 Dimensional Array 
3 dimensional arrays are elements that have more rows, columns and sizes than two-dimensional arrays, these are expansion arrays of two-dimensional arrays and can be expanded to more than two dimensions.

An example of applying a 3 dimensional array using java:
E. Analysis
1. ";": semicolon as a sign of the end of a line
2. System.out.println: as a line of text, the contents of which will be run
3. Public Class Java Java Class Name ’{: Heading from a java application which if changed, the application will error or not run
4. Public Static Void Main (String [] args) {: a kind of introduction in the java / opening argument argument
5. (String [] args) {: String (all characters in it), args (argument)
6. Java programming has a high level of sensitivity to program errors so it needs precision in making the source code

7. To find out the location of the program error, the Netbeans IDE editor displays a red sign on the left side of the wrong code

Penerapan Array Pada Java



A.    Pengertian Array

Array adalah sebuah variabel yang bisa menyimpan banyak data dalam satu variabel. Array menggunakan indeks untuk memudahkan akses terhadap data yang disimpannya. Indeks array selalu dimulai dari 0 dan juga tidak selalu dalam bentuk angka, bisa juga karakter atau teks.
B.     Array Dimensi 1
Array  dimensi 1 adalah sekelompok data yang memiliki nama variable dan tipe data yang sama yang dapat diakses menggunakan 1 buah index saja.  

Contoh pengaplikasian array dimensi 1 menggunakan java :



C.    Array Dimensi 2
Array dimensi 2 adalah array yang memiliki dua index.
Array dua dimensi ini sering digunakan untuk merepresentasikan tabel dari nilai yang terdiri dari informasi yang diatur berdasarkan baris dan kolom.
Contoh pengaplikasian array dimensi 2 menggunakan java :

·        




D.    Array Dimensi 3
Array dimensi 3 merupakan elemen array yang memiliki baris, kolom dan ukuran lebih banyak daripada Array dua dimensi, ini adalah array perluasan dari array dua dimensi dan dapat dikembangkan ke lebih dari dua dimensi.
Contoh pengaplikasian array dimensi 3 menggunakan java :




E.     Analisis
1.      “;” : titik koma sebagai tanda berakhirnya suatu baris
2.      System.out.println : sebagai baris teks, yang isinya akan di jalankan
3.      Public Class ‘Nama Java Class’ { : Heading dari aplikasi java yang jika di ubah, maka aplikasi akan error atau tidak berjalan
4.      Public Static Void Main (String [] args) { : semacam pengantar dalam apliksi java / pembuka argument
5.      (String [] args) { : String (semua karakter dalam masuk ke dalamnya), args (argumen)
6.      Pemrograman java memiliki tingkat sensitifitas yang tiggi terhadap error program jadi butuh ketelitian dalam membuat source code
7.      Untuk mengetahui letak kesalahan program, editor IDE Netbeans menampilkan tanda merah pada sisi sebelah kiri code yang salah



Rabu, 27 Maret 2019

THE PROBLEM OF THE "GREEDY METHOD" ALGORITHM

"GREEDY METHOD"


A. Understanding the Greedy Method
The Greedy method is an algorithm that forms a step-by-step solution by looking for a temporary maximum value at each step. This temporary maximum value is known as local maximum. In most cases, this method will not produce the most optimal solution, but usually this method provides a solution that approaches the optimum value in a fairly fast time.

B. Main Principles of the Greedy Method
      The main principle of this method is "take what you can get now!". The purpose of the principle is that at each step in the greedy method, we take the most optimal decision for that step without regard to the consequences in the next step.

C. General Scheme of the Greedy Method
      The greedy method is composed by the following elements:
1. Association of candidates
      Contains the elements forming the solution.
2. Set of solutions
       Contains selected candidates as a solution to the problem
3. Selection function (selection function)
Choosing the most likely candidate to reach the optimal solution. Candidates who have been selected in a step are never considered again in the next step.
4. Feasible function
Checking whether a candidate has been chosen can provide a feasible solution, namely the candidate Together with the set of solutions that have been formed do not violate the solution, while the candidate who is not worth throwing away and never considered again.
5. Objective function
A function that maximizes or minimizes the value of a solution (eg Length of path, profit, etc.).

D. Problems that can be solved with the Greedy Method
The greedy method can be used to resolve the following problems:
1. Optimal Storage on Tapes Problems
How to optimize storage, so that the data stored can be optimally loaded.
      Example problem:
There are 3 programs that will be stored in the storage media with a length of 5, 10, and 3. What is the optimal storage process with the greedy method.
      Settlement:
1. Determine the value of length, time, and average time
There are 3 programs, for example the lengths L1, L2, and L3 with the value L1 = 5, L2 = 10, and L3 = 3
Time, here is not known, means that time does not affect the storage process, meaning there is no average time.
This means that in this case the effect is only the length of each data.
2. Sort storage by using factorial techniques according to the amount of data.
From the case it is known that the number of data (n) is 3, meaning that the combination required is n !, that is 3! = 3 * 2 * 1 = 6. So it takes 6 steps in the process of compiling it.

No
Order
D(L)
Total
1
1,2,3
5+(5+10)+(5+10+3)
38
2
1,3,2
5+(5+3)+(5+3+10)
31
3
2,1,3
10+(10+5)+(10+5+3)
43
4
2,3,1
10+(10+3)+(10+3+5)
41
5
3,1,2
3+(3+5)+(3+5+10)
29
6
3,2,1
3+(3+10)+(3+10+5)
34
Info. No:1 :   Order 1 = 5
                      Order 1, 2 =5+10
                      Order 1,2,3 = 5+10+3
So, Total Order 1,2,3 = 5+(5+10)+(5+10+3)

3. From the above values, the minimum value is obtained
a. The first smallest value is 29, which is for the 3rd position in the first position
b. The second smallest value is 31, i.e. for the 1st position in the first position
c. The third smallest value is not 34 and 38, because the storage sequence in the 3rd and 1st positions has been represented by 29 and 31, so that for the third order is 41.

2. Knapsack Problem
     How to determine the selection of goods from a set of goods where each item has its own weight and profit, so that from the selection of these items the maximum profit is obtained.

 Example problem:
It is known that 3 items will be stored in a place that has a maximum capacity of 20 kg. the weight of each item is 18 kg, 15 kg and 20 kg where each item has a profit of 25, 24 and 15 respectively.


                        Solution: M-W
            n = 3 -> objects (1,2,3) O 1 2 3 20-15 = 5
            M = 20 kg P 25 24 15 5- 5 = 0
            W = 18, 15, 10 W 18 15 10
            P = 25, 24, 15 P / W 1.39 1.6 1.5
            Probability 0 ≤ Xi ≤ 1 X 0 1 1/2
                                                                    (X1 X2 X3)
Limiting function:
∑Xi.Wi = 1.15 + 1 / 2.10 = 15 + 5 = 20
Purpose function:
∑ Pi. Xi = 24.1 + 15.1 / 2 = 24 + 7.5 = 31.5

3. Minimum Spanning Tree Problem
     A common problem with a minimum spanning tree is to look for the minimum cost of a spanning tree from each edge of a graph that forms a tree.

4. Shortest Path Problem
     Is the search for the shortest distance from one location to another.


Selasa, 26 Maret 2019

Latihan Praktikum Membuat User, hak akses, database dan tabel aplikasi basisdata

➢ Latihan Praktikum Membuat User, hak akses, database dan tabel
1. Buka aplikasi Command Prompt pada komputer anda. (Disarankan untuk membuka
dari tahap awal).
2. Masuklah kedalam MariaDB menggunakan user root.
3. Tampilkan daftar database yang ada pada MariaDB.
4. Tampilkan daftar user pada MariaDB.
5. Buat user baru pada localhost dengan nama “user_coba2” dengan password “12345”.
6. Buat user baru pada localhost dengan nama “user_cobalagi” tanpa password.
7. Tampilkan kembali daftar user pada MariaDB.
8. Masih didalam user root, Buat Database dengan nama “db_coba”.
9. Aktifkan database db_coba, lalu buat dua buah tabel didalamnya.
Tabel 1 dengan nama “buku”:
field
type
Size
Kd_buku
car
5
Judul
Varchar
40
Penulis
Varchar
35
Penerbit
Varchar
35
Tabel 2 dengan nama “katalog”
Field
Type
Size
Kode
Char
6
Nama
Varchar
30

10. Tampilkan daftar tabel yang ada pada database db_coba.
11. Tampilkan struktur tabel buku dan katalog. 
12. Beri hak akses penuh database db_coba kepada user “user_coba2”.
13. Hapus user “user_cobalagi”, lalu keluar dari root.
14. Masuk kedalam MariaDB menggunakan user “user_coba2”.
15. Tampilkan daftar database pada user_coba2.


Nama   : Rizqi Yuliarta
Nim     : 12184867
Kelas   : 12.2H.30




1.      Membuka aplikasi Command Prompt
  




2.      Masuk MariaDB menggunakan user root

3.      Menampilkan daftar database yang ada pada mysql        

4.      Menampilkan daftar user pada mysql

5.      Membuat user baru pada localhost dengan nama “12184867_coba2” dengan password “12345”

6.      Membuat user baru pada localhost dengan nama “12184867_cobalagi” tanpa password

7.      Menampilkan kembali daftar user pada mysql

8.      Masih didalam user root, membuat database dengan nama “db_12184867”

9.      Mengaktifkan database “db_12184867

lalu didalamnya membuat 2  buah tabel
·         Tabel1 dengan nama “buku”:
field
type
Size
Kd_buku
car
5
Judul
Varchar
40
Penulis
Varchar
35
Penerbit
Varchar
35

·         Tabel2 dengan nama “katalog”
Field
Type
Size
Kode
Char
6
Nama
Varchar
30

10.  Menampilkan daftar table yang ada pada database “db_12184867”

11.  Menampilkan struktur table buku dan katalog


12.  Memberi hak akses penuh “db_12184867” kepada “12184867_coba2”

13.  Menghapus user “12184867_cobalagi”

14.  Masuk kedalam MariaDB menggunakan user “12184867_coba2”

15.  Menampilkan daftar database pada “12184867_coba2”