Minggu, 14 Oktober 2018

PBO A- Membuat EPARKIR

Nama: Ayu Mutiara Sari
NRP: 05111740000149
Kelas: PBO A

1. Source code EPARKIR

 /**  
  * Class EParkir ini digunakan untuk mengatur alur kerja  
  * dari sistem parkir elektronik  
  * @author Ayu Mutiara Sari  
  * @version 01.2018/10/15  
  */  
  import java.util.Scanner;    
  public class EParkir   
  {   
   private static int JKend,harga;  
   public static void main(String args[])   
   {   
   Scanner input= new Scanner(System.in);    
   kendaraan akend = new kendaraan();  
   System.out.println("SELAMAT DATANG DI TAMAN SEJAHTERA");  
   System.out.println("Biaya Parkir Rp 2000(MOBIL) Rp 500(MOTOR)");   
   System.out.println("Pilih Jenis Kendaraan Nada");   
   System.out.println("1.Mobil");   
   System.out.println("2.Motor");   
   JKend=input.nextInt();   
   switch (JKend){   
    case 1:   
    System.out.println("Masukkan Nopol kendaraan anda");   
    akend.getNopol();   
    System.out.println("Masukkan Durasi Parkir Anda (jam) : ");   
    akend.getDurasi();   
    harga = akend.getHarga(2000);   
    akend.print();  
    break;  
    case 2:    
    System.out.println("Masukkan Nomor Polisi kendaraan anda");   
    akend.getNopol();   
    System.out.println("Pilih Durasi parkir anda (jam) : ");   
    akend.getDurasi();   
    harga = akend.getHarga(500);    
    akend.print();  
    break;    
   }  
  }   
  }   


2. Source Code kendaraan


 /**  
  * Class kendaraan ini digunakan untuk mengatur alur kerja  
  * dari sistem parkir elektronik  
  * @author Ayu Mutiara Sari  
  * @version 02.2018/10/15  
  */    
  import java.util.Scanner;    
  public class kendaraan   
  {   
   private static int harga;   
   private static String nopol;   
   private static int durasi;  
   Scanner input= new Scanner(System.in);   
  public kendaraan (){   
   harga = 0;   
 }  
   public void getDurasi(){   
    durasi = input.nextInt();   
   }   
   public int getHarga(int biaya)   
   {   
    harga = biaya * durasi;   
    return harga;   
   }   
   public void getNopol(){   
    nopol = input.nextLine();   
   }   
   public void print(){   
    System.out.println("SELAMAT DATANG DI TAMAN SEJAHTERA");   
    System.out.println(" BERIKUT DATA KENDARAAN ANDA:");   
    System.out.println(" NoPol : "+nopol);   
    System.out.println(" Durasi : "+durasi+" Jam");   
    System.out.println(" Biaya: "+harga+"");   
    System.out.println(" Terima Kasih");   
   }   
  }   


Hasil:




PBO A- Support System Sederhana

Nama: Ayu Mutiara Sari
NRP: 05111740000149
Kelas: PBO A

1. Source Code Support System

 /**  
  * Class ini digunakan untuk membuat support system.  
  *  
  * @author (Ayu Mutiara Sari)  
  * @version 01.01(10/8/2018)  
  */  
  public class SupportSystem    
  {    
   private InputReader reader;    
   private Responder responder;    
   public SupportSystem(){    
   reader = new InputReader();    
   responder = new Responder();    
   }    
   public void start(){    
   boolean finished = false;    
   printWelcome();    
   while(!finished){    
    String input = reader.getInput();    
    if(input.startsWith("bye")) {    
    finished = true;    
    }    
    else {    
    String response = responder.generateResponse();    
    System.out.println(response);    
    }    
   }    
   printGoodbye();    
   }    
   private void printWelcome(){    
    System.out.println("Hello");    
    System.out.println("=============================");    
    System.out.println("Tell me something I don't know!");     
    System.out.println("Say 'bye' to exit"); }    
   private void printGoodbye(){    
    System.out.println("Good Bye!.");    
   }    
  }    

2. Source Code Responder

 /**  
  * Write a description of class Responder here.  
  *  
  * @author (Ayu Mutiara Sari)  
  * @version 01.02(10/08/2018)  
  */  
 public class Responder  
 {  
 /**  
 * Construct a Responder - nothing to do  
 */  
 public Responder()  
 {  
 }  
 /**  
 * Generate a response.  
 * @return A string that should be displayed as the  
 * response  
 */  
 public String generateResponse()  
 {  
 return "Wow! Cool!";  
 }  
 }  

3. Source Code InputReader

 /**  
  * Write a description of class input here.  
  *  
  * @author (Ayu Mutiara Sari)  
  * @version 01.02(10/08/2018)  
  */  
  import java.util.Scanner;   
  public class InputReader   
  {   
   public String getInput()   
   {   
    Scanner input = new Scanner(System.in);   
    String in = input.nextLine();   
    return in;   
   }   
  }   

Hasil:



Selasa, 09 Oktober 2018

PWeb C Form Tagihan

Nama: Ayu Mutiara Sari
NRP: 05111740000149
Kelas: PWEB C
Link: ini linknya

source code index.php:

 <?php  
  session_start();  
  $kodeErr = $no_pelErr = $namaErr ="";   
    $no_telp = $tipe = $alamat = $biaya_beban= $harga_perM3="";   
    $jumlah_pemakaian = $total_tagihan="";   
 ?>  
 <!DOCTYPE html>  
  <head>  
  <style type="text/css">  
  body  
  {  
    background:#DC143C;  
    font-family:courier;  
  }  
  #isitagihan  
  {  
    width:70%;  
    margin:3em auto;  
    padding:30px;  
    background:#DCDCDC;  
    box-shadow:0 0 15px #F8F8FF;  
  }  
  h1  
  {  
    margin:0;  
    padding:0;  
    font-size:2.5em;  
    font-weight:bold;  
  }  
  p  
  {  
    font-size:1em;  
    margin:0;  
  }  
  table  
  {  
    margin:2em 0 0 0;  
    border:1px solid #eee;  
    width:100%;  
    border-collapse: separate;  
    border-spacing:0;  
  }  
  table th  
  {  
    background:#fafafa;  
    border:none;  
    padding:20px ;  
    font-weight:normal;  
    text-align:left;  
  }  
  table td  
  {  
    background:#fff;   
    border:none;  
    padding:12px 20px;   
    font-weight:normal;  
    text-align:left;   
    border-top:1px solid #eee;  
  }  
  table tr.total td  
  {  
    font-size:1.5em;  
  }  
  .btnsubmit  
  {  
    display:inline-block;  
    padding:10px;  
    border:1px solid #ddd;  
    background:#eee;  
    color:#90EE90;  
    text-decoration:none;  
    margin:2em 0;  
  }  
  form  
  {  
    margin:2em 0 0 0;  
  }  
  label  
  {  
    display:inline-block;  
    width:12em;  
  }  
  input[type=text]  
  {  
    border:2px solid #bbb;  
    padding:10px;  
    width:30em;  
  }  
  textarea  
  {  
    border:2px solid #bbb;  
    padding:10px;  
    width:30em;  
    height:5em;  
    vertical-align:text-top;  
    margin:0.3em 0 0 0;  
  }  
  .submitbtn  
  {  
    font-size:1.5em;  
    display:inline-block;  
    padding:10px;  
    border:1px solid #ddd;  
    background:#90EE90;  
    color:#000;  
    text-decoration:none;  
    margin:0.5em 0 0 8em;  
  };  
  </style>  
  </head>  
  <body>  
  <div id="isitagihan">  
   <h1>PEMBAYARAN TAGIHAN PDAM</h1>  
   <script type="text/javascript">  
   function validasi_input(form)  
   {  
     pola_nopel=/^[0-9\_\-]{6,100}$/;  
           if (form.kode.value == "")  
     {  
       alert("Silahkan Pilih Kode yang Sesuai.");  
       form.nama_depan.focus();  
       return (false);  
     }  
           else if (!pola_nopel.test(form.no_pel.value))  
     {  
       alert ('Silahkan isi Nomor Pelanggan Anda dengan Benar');  
       form.no_pel.focus();  
       return false;  
     }  
     else if (form.nama.value == "")  
     {  
       alert("Silahkan Isi Nama Anda");  
       form.nama_depan.focus();  
       return (false);  
     }  
           else if (form.no_telp.value <=11 && form.no_telp.value >=13 )  
     {  
       alert("Silahkan Isi Nomor Telepon Anda dengan Benar");  
       form.no_telp.focus();  
       return (false);  
     }  
           else if (form.tipe.value == "")  
     {  
       alert("Silahkan Pilih Tipe Tagihan Anda dengan Benar");  
       form.tipe.focus();  
       return (false);  
     }  
     else if (form.alamat.value == "")  
     {  
       alert("Silahkan Isi Alamat Anda dengan Benar");  
       form.alamat.focus();  
       return (false);  
     }  
            else if (form.biaya_beban.value == "")  
     {  
       alert("Silahkan Isi Biaya Beban Anda dengan Benar");  
       form.biaya_beban.focus();  
       return (false);  
     }  
            else if (form.harga_perM3.value == "")  
     {  
       alert("Silahkan Isi Harga Per M3 dengan Benar");  
       form.harga_perM3.focus();  
       return (false);  
     }  
            else if (form.jumlah_pemakaian.value == "")  
     {  
       alert("Silahkan Isi Jumlah Pemakaian Anda dengan Benar");  
       form.jumlah_pemakaian.focus();  
       return (false);  
     }  
            else if (form.total_tagihan.value == "")  
     {  
       alert("Silahkan Isi Total Tagihan Anda dengan Benar");  
       form.total_tagihan.focus();  
       return (false);  
     }  
   return (true);  
   }  
   </script>  
   <form action="invoice.php" method="POST" onsubmit="return validasi_input(this)">  
  <div> <label>Kode</label>  
      <input type="text" name="kode" list="kode"/>    
         <datalist id="kode">    
         <option value="SBY_1"></option>    
         <option value="SBY_2"></option>    
         <option value="SBY_3"></option>    
         <option value="SBY_4"></option>    
         <option value="SBY_5"></option>    
         </datalist>   
  <div> <label>No Pelanggan </label>  
      <input type="text" name="no_pel" class="inputan" /> </div>  
  <div> <label>Nama </label>  
      <input type="text" name="nama" class="inputan" /> </div>  
      <div> <label>No Telp </label>  
      <input type="text" name="no_telp" class="inputan" /> </div>  
  <div>  
           <label>Tipe</label>  
      <input type="text" name="tipe" list="tipe"/>    
         <datalist id="tipe">    
          <option value="Rumah"></option>    
         <option value="Toko"></option>    
         <option value="Swalayan"></option>    
         <option value="Pabrik"></option>    
         <option value="Lainnya"></option>    
         </datalist>    
      </div>  
   <div> <label>Alamat </label>  
   <textarea name="alamat" class="textan"></textarea> </div>  
   <div> <label>Biaya Beban </label>  
      <input type="text" name="biaya_beban" class="inputan" /> </div>  
      <div> <label>Harga per M3</label>  
      <input type="text" name="harga_perM3" class="inputan" /> </div>  
      <div> <label>Jumlah Pemakaian</label>  
      <input type="text" name="jumlah_pemakaian" class="inputan" /> </div>  
      <div> <label>Total Tagihan</label>  
      <input type="text" name="total_tagihan" class="inputan" /> </div>  
   <input type="submit" name="Proses" value="Proses" class="submitbtn" />  
   </form>  
  </div>  
  </body>  
 </html>  


source code invoice.php:

 <!DOCTYPE html>   
  <html>   
  <head>   
 <style type="text/css">    
  body  
  {  
    background:#DC143C;  
    font-family:courier;  
  }  
  h1  
  {  
    margin:0;  
    padding:0;  
    font-size:2.5em;  
    font-weight:bold;  
   }  
   #content  
  {  
    width:70%;  
    margin:3em auto;  
    padding:30px;  
    background:#DCDCDC;  
    box-shadow:0 0 15px #F8F8FF;  
  }  
  table {  
   font-family: arial, sans-serif;  
   border-collapse: collapse;  
   width: 100%;  
 }  
 td, th {  
   border: 1px solid #dddddd;  
   text-align: left;  
   padding: 8px;  
 }  
 tr:nth-child(even) {  
   background-color: #dddddd;  
 }  
       </style>  
    <title>Bukti Pembayaran</title>   
  </head>   
  <body>   
    <h1>Pembayaran Tagihan PDAM</h1>    
    <div id="content" style="padding-left: 120px">   
       <table>  
  <tr>  
   <th>Kode</th>  
   <th>No_pel</th>  
   <th>Nama</th>  
      <th>No_telp</th>  
      <th>tipe</th>  
  </tr>  
  <tr>  
   <td><?php echo $_POST["kode"]; ?></td>  
   <td><?php echo $_POST["no_pel"]; ?></td>  
   <td><?php echo $_POST["nama"]; ?></td>  
      <td><?php echo $_POST["no_telp"]; ?></td>  
      <td><?php echo $_POST["tipe"]; ?></td>  
  </tr>  
       <br>  
       <br>  
       <tr>  
   <th>Alamat</th>  
   <th>Biaya Beban</th>  
   <th>Harga Per M3</th>  
      <th>Jumlah Pemakaian</th>  
      <th>Total Tagihan</th>  
  </tr>  
  <tr>  
   <td><?php echo $_POST["alamat"]; ?></td>  
   <td><?php echo $_POST["biaya_beban"]; ?></td>  
   <td><?php echo $_POST["harga_perM3"]; ?></td>  
      <td><?php echo $_POST["jumlah_pemakaian"]; ?></td>  
      <td><?php echo $_POST["total_tagihan"]; ?></td>  
  </tr>  
  </body>   
  </html>   


hasil:





Minggu, 07 Oktober 2018

PBO A- Auction

Nama: Ayu Mutiara Sari
NRP: 05111740000149
Kelas: PBO A
Membuat Program Lelang

1. Source code Auction

 /**  
  * Write a description of class auction here.  
  *  
  * @author (Ayu Mutiara Sari)  
  * @version (10.10)  
  */  
  import java.util.ArrayList;   
  import java.util.Iterator;   
  public class Auction   
  {   
   // The List of Lots in this auction.   
   private ArrayList<Lot> lots;   
   // The number that will be given to the next lot entered   
   // into this auction   
   private int nextLotNumber;   
   /**   
   * Create a new auction   
   */   
   public Auction()   
   {   
    lots = new ArrayList<Lot>();   
    nextLotNumber = 1;   
   }   
   /**   
   * Enter a new lot into the auction.   
   * @param description A description of the lot.   
   */   
   public void enterLot(String description)   
   {   
    lots.add(new Lot(nextLotNumber, description));   
    nextLotNumber++;   
   }   
   /***    
   * Show the full list of lots in this auction.   
   */   
   public void showLots()   
   {   
    for(Lot lot : lots){   
     System.out.println(lot.toString());   
    }   
   }   
   /**   
   * Bid for a lot.   
   * A message indicating whether the bid is succesful or not is printed.   
   * @param number The lot number being bid for.   
   * @param bidder The person bidding for the lot.   
   * param value The value of the bid.   
   */   
   public void bidFor(int lotNumber, Person bidder, long value)   
   {   
    Lot selectedLot = getLot(lotNumber);   
    if(selectedLot!=null){   
     boolean successful = selectedLot.bidFor(new Bid(bidder,value));   
     if (successful) {   
      System.out.println("The bid for lot number " + lotNumber +    
      " was successful.");   
     }   
     else {   
      //Report which bid is higher.   
      Bid highestBid = selectedLot.getHighestBid();   
      System.out.println("Lot number: " + lotNumber +    
      " already has a bid of: " + highestBid.getValue());   
     }   
    }   
   }   
   /**   
   * Return a list of the unsold lots.   
   */   
   public void close()   
   {   
    System.out.println("The auction is closed.");   
    for(Lot lot : lots) {   
     System.out.println(lot.getNumber() + ": " +lot.getDescription());   
     Bid bid = lot.getHighestBid();   
     if (bid==null){   
      System.out.println("(No Bids for this lot.)");   
     }   
     else {   
      System.out.println( "sold to " +    
      bid.getBidder().getName() + " for "    
      + bid.getValue());   
    }   
   }   
  }   
   /**    
   * Return the lot with the given number.    
   * Return null if a lot with this number does not exist.   
   * @param lotNumber The number of the lot to return.   
   */   
   public Lot getLot(int lotNumber)   
   {   
    if((lotNumber >= 1) && (lotNumber < nextLotNumber)) {   
     // The number seems to be reasonable.   
     Lot selectedLot = lots.get(lotNumber - 1);   
     // Include a confidence check to be sure we have the right lot.   
     if(selectedLot.getNumber() != lotNumber) {   
      System.out.println("Internal error: lot number " +   
      selectedLot.getNumber() + " was returned instead of " +    
      lotNumber);   
      // Don't return invalid lot.   
      selectedLot = null;   
      }   
      return selectedLot;   
     }   
    else {   
     System.out.println("lot number: " + lotNumber + " does not exist.");   
     return null;   
     }   
    }   
   }   

2. Source Code Lot

 /**  
  * Write a description of class Lot here.  
  *  
  * @author (Ayu Mutiara Sari)  
  * @version (01.01)  
  */  
 public class Lot   
  {   
   // A unique identifying number.   
   private final int number;   
   //A description of the lot.   
   private String description;   
   // The current highest bid for this lot.   
   private Bid highestBid;   
   /**   
   * Construct a Lot, setting its number and description.   
   * @param number The lot number.   
   * @param description A description of this lot.   
   */   
   public Lot(int number, String description)   
   {   
    this.number = number;   
    this.description = description;   
   }   
   /**   
   * Attempt to bid for this lot. A successful bid   
   * must have a value higher than any existing bid.   
   * @param bid A new bid.   
   * @return true if successful, false otherwise.   
   */   
   public boolean bidFor(Bid bid)   
   {   
    if((highestBid == null)||(bid.getValue() > highestBid.getValue()))   
    {   
     // This bid is the best so far   
     highestBid = bid;   
     return true;   
    }   
    else{   
     return false;   
    }   
   }   
   /**   
   * @return A string representation of this lot's details.   
   */   
   public String toString()   
   {   
    String details = number + ": " + description;   
    if(highestBid!=null) {   
     details+= " Bid: " +highestBid.getValue();   
    }   
    else {   
     details += " (No bid)";   
    }   
    return details;   
   }   
   /**   
   * @return The lot's number.   
   */   
   public int getNumber()   
   {   
    return number;   
   }   
   /**   
   * @return The lot's description.   
   */   
   public String getDescription()   
   {   
    return description;   
   }   
   /**   
   * @return The highest bid for this lot.   
   * This could be null if there is no current bid.   
   */   
   public Bid getHighestBid()   
   {   
    return highestBid;   
   }   
  }   

3. Source Code Person

 /**  
  * Write a description of class person here.  
  *  
  * @author (Ayu Mutiara Sari)  
  * @version (01.01)  
  */  
  public class Person   
  {   
   // The name of this person.   
   private final String name;   
   /**   
   * Create a new person with the given name.   
   * @param name The person's name.   
   */   
   public Person(String name)   
   {   
    this.name = name;   
   }   
   /**   
   * @return The Person's name*   
   */   
   public String getName()   
   {   
    return name;   
   }   
  }   

4. Source Code Bid

 /**  
  * Write a description of class bid here.  
  *  
  * @author (Ayu Mutiara Sari)  
  * @version (01.01)  
  */  
 public class Bid   
  {   
   // The person making the bid   
   private final Person bidder;   
   // The value of the bid. This could be a large number so the long type has been used   
   private final long value;   
   /**   
   * Create a bid   
   * @param bidder Who is bidding for the lot.   
   * @param value The value of the bid.   
   */   
   public Bid(Person bidder, long value)   
   {   
    this.bidder = bidder;   
    this.value = value;   
   }   
   /**   
   *@return The bidder.   
   */   
   public Person getBidder()   
   {   
    return bidder;   
   }   
   /**   
   * @return The value of the bid.   
   */   
   public long getValue()   
   {   
    return value;   
   }   
  }   

Hasil:



Selasa, 02 Oktober 2018

PWEBc- Tugas Berita dan Form Validasi

Nama: Ayu Mutiara Sari
NRP: 05111740000149
Kelas: PWEB C
link: klik di sini

1. Source Code HTML

 <!DOCTYPE html>   
  <html>   
  <head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252">   
    <title>Tech in Asia</title>   
    <link rel="stylesheet" href="yeay.css"/>   
  </head>   
  <body>   
    <div class="header">   
    <div class="menu">   
       <ul>   
         <li><a href="#">NEWS</a></li>   
         <li><a href="#">JOBS</a></li>   
         <li><a href="#">COMPANIES</a></li>   
         <li><a href="#">EVENT</a></li>   
         <li><a href="#">ABOUT</a></li>   
         <li><a href="#">ADVERTISE</a></li>   
       </ul>   
    </div>   
    <div class="menu1">   
       <ul>   
         <li><a href="#">CATEGORIES</a></li>   
         <li><a href="#">MARKETS</a></li>   
         <li><a href="#">WRITERS</a></li>  
           <div id="akun">  
        <li><a href="#"><li>LOG IN</00000000li></a>  
        <li><a href="form.htm"><li>SIGN UP</li></a>  
       </div>   
       </ul>   
    </div>   
    </div>   
    <div class="content">   
       <div class="jarak">   
         <!-- kiri -->   
         <div class="kiri">   
         <!-- blog -->   
         <div class="border">   
            <div class="jarak">   
              <img src="web1.jpg" style=" float: left; width: 280px;height: 200px;">   
              <h3>How one Silicon Valley investor helps US startups enter Japan</h3>   
              <p>Hire the right country manager.</p>   
              <button class="btn">Read More..</button>   
            </div>   
         </div>   
         <!-- end blog-->   
         <!-- blog -->   
         <div class="border">   
            <div class="jarak">   
              <img src="web3.jpg" style="float: left;width: 300px;height: 200px;">   
              <h3>I oversee government digital services at GovTech. Ask me anything!</h3>   
              <p>Before GovTech, Parimal was director of technology at DreamWorks Animation. Ask him anything!</p>   
              <button class="btn">Read More..</button>   
            </div>   
         </div>   
         <!-- end blog-->   
         <!-- blog -->   
         <div class="border">   
            <div class="jarak">   
              <img src="web2.jpg" style="float: left;width: 300px;height: 200px;">   
              <h3>Singapore introduces new rules for bike-share users, fines for abusers</h3>   
              <p>The rules are part of the Land Transport Authority’s new licensing regime for bike-sharing services.</p>   
              <button class="btn">Read More..</button>   
            </div>   
         </div>   
         <!-- end blog-->   
         </div>   
         <!-- kiri-->   
         <!-- kanan -->   
         <div class="kanan">   
            <div class="jarak">   
              <h2>LATEST JOBS</h2>   
                 <img src="job1.png" style="float: left;width: 34px;height: 34px;">   
                 <h1>Software Engineer-Backend</h1>   
                 <p>Jakarta, Indonesia</p>   
                 <img src="job2.png" style="float: left;width: 34px;height: 34px;">   
                 <h1>Graphic Designer</h1>   
                 <p>Singapore, Singapore</p>   
                 <img src="job3.png" style="float: left;width: 34px;height:34px;">   
                 <h1>Senior NodeJs Developer</h1>   
                 <p>Singapore, Singapore</p>    
            </div>   
            <div class="footer" >   
              <h2>Copyright 2018 PwebC</h2>   
            </div>   
         </div>   
         <!-- kanan -->   
       </div>   
    </div>   
  </body>   
  </html>  

2. Source Code CSS

 body{   
    background: #FF7F50;   
    color: #333;   
  /*   width: 100% ;   
    height: 100%;*/   
    font-family: "lato", cursive, sans-serif;   
    /*margin: 0 auto;*/   
  }   
  .content{   
    width: 88%;   
    margin: auto;   
    /*height: 420px;*/   
    padding: 0.1px;   
    background: #FFF8DC;   
    color: #333;   
  }   
  .header{   
    margin: 0;   
    background: #FFF8DC;   
  }   
  .kiri{   
    width: 70%;   
    float: left;   
    margin: auto;   
    background: #FFF8DC;   
    /*height: 420px;*/   
  }   
  .kanan{   
    width: 25%;   
    float: left;   
    margin: auto;   
    background: #FFF8DC;   
    /*height: 420px;*/   
  }   
  .border{   
    /*border: 2px solid #000;*/   
    height: 200px;   
    margin-top: 1pc;   
    padding-bottom: 3pc;   
    padding-right: 2pc;   
  }   
  .undecor{   
    text-decoration: none;   
  }   
  .footer{   
    /*width: 90%;*/   
    margin: auto;   
    height: 40px;   
    line-height: 40px;   
    background: #F0EEEE;   
  }   
  .menu{   
    background-color: #F0EEEE;   
    height: 50px;   
    line-height: 50px;   
    /*position: relative;*/   
    /*width: 90%;*/   
    /*margin: 0;*/   
    /*padding:0;*/   
  }   
  .menu1{   
    background-color: #F0EEEE;   
    height: 60px;   
    line-height: 60px;   
    /*position: relative;*/   
    /*width: 90%;*/   
    margin: 0;   
    /*padding:0 auto;*/   
 .akun{  
  float: right;  
  border-left: 3px solid #ffffff;  
  }  
  }   
  .jarak{   
    padding: 0 2pc;   
  }   
  .menu ul{   
    list-style: none;   
  }   
  .menu ul li a{   
    float: left;   
    width: 14%;   
    display: block;   
    text-align: center;   
    color: #A4A4A4;   
    text-decoration: none;   
  }   
  .menu ul li a:hover{   
    background-color: #DDDCDC;   
    display:block;   
  }   
  .menu1 ul{   
    list-style: none;   
  }   
  .menu1 ul li a{   
    float: left;   
    width: 14%;   
    display: block;   
    text-align: center;   
    color: #A4A4A4;   
    text-decoration: none;   
  }   
  .menu1 ul li a:hover{   
    background-color: #FAF9F9;   
    display:block;   
  }   
  .kanan p{   
    font-size: 12px;   
    margin: 0;   
    text-align:center;   
    margin: 10px;    
    color:#D9D8D8;   
  }   
  h3{   
    font-family: "Lucida Console";   
    font-weight: bold;   
    font-size: 24px;   
  }   
  p{   
    font-family: "Verdana";   
    font-size: 14px;   
    font-weight: lighter;   
    color: #ADACAC;   
  }   
  h1{   
    font-family: "Verdana";   
    font-size: 13px;   
    font-weight: bold;   
    text-align: center;   
    padding-top: 10px;   
  }   
  h2{   
    font-family: "Lucida Console";   
    font-weight: lighter;   
    font-size: 12px;   
  }  

Hasil:

3. Source Code HTML

 <!DOCTYPE html>  
 <html>  
 <head>  
      <title>Sign Up</title>  
      <link rel="stylesheet" type="text/css" href="style1.css">  
 </head>  
 <body>  
      <center><h2>SIGN UP FOR FREE</h2></center>  
      <div class="login">  
           <form action="#" method="POST" onSubmit="validasi()">  
                <div>  
                     <label>Nama Lengkap:</label>  
                     <input type="text" name="nama" placeholder="Enter Your Name" id="nama" maxlength="50" required />  
                </div>  
                <div>  
                     <label>Alamat:</label>  
                     <textarea cols="40" rows="5" name="alamat" placeholder="Enter Your Address" id="alamat" required ></textarea>  
                </div>  
                <div>  
                     <label>Email:</label>  
                     <input type="email" name="email" placeholder="Enter E-mail"id="email" required />  
                </div>  
                <div>  
                     <label>No Hp:</label>  
                     <input type="phone" name="phone" placeholder="Enter Your Phone Number" id="phone" min="11" max="13" required/>  
                </div>  
                <div>  
                     <label>Jenis Kelamin: </label> <br/>  
                     <input type="radio" name="gender" value="male" /> L <br/>  
                     <input type="radio" name="gender" value="female" /> P <br/>  
                </div>  
                <div>  
     <label>Tanggal Lahir:</label>  
     <input type="date" id="birthday" name="birthday" id="birthday"  
         min="01-01-1900" max="31-12-2018" required />  
   </div>  
      <div>  
                     <label>Kolom Favorit:</label>  
                     <input type="text" name="fav" list="fav" placeholder="Teknologi,Olahraga, etc" required/>    
         <datalist id="fav">    
          <option value="Teknologi"></option>    
         <option value="Olahraga"></option>    
         <option value="Politik"></option>    
         <option value="Ekonomi"></option>    
         <option value="Lainnya"></option>    
         </datalist>    
                </div>  
                <div>  
                <label>Password:</label>  
                 <input type="text" placeholder="Enter Password" name="pass" required>   
                 </div>  
                <div>  
                     <input type="submit" value="Sign Up" class="tombol">  
                </div>  
           </form>  
      </div>  
 </body>  
 <script type="text/javascript">  
      function validasi() {  
           var nama = document.getElementById("nama").value;  
           var alamat = document.getElementById("alamat").value;  
           var email = document.getElementById("email").value;  
           var phone = document.getElementById("phone").value;  
           var gender = document.getElementById("gender").value;  
           var birthday = document.getElementById("birthday").value;  
           var fav = document.getElementById("fav").value;  
           var maxhuruf = 50;  
           pola_email=/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;  
      if (!pola_email.test(form.email.value)){  
   alert ('Penulisan Email tidak benar');  
   form.email.focus();  
   return false;  
  }  
           if (form.nama.value.length > maxhuruf){  
   alert("Batas Maksimal adalah 50 Karakter");  
   form.nama.focus();  
   return (false);  
           }  
           if (nama = "" || email="" || alamat ="" || phone ="" || gender ="" || birthday ="" || fav ="") {  
                alert('Anda harus mengisi data dengan lengkap !');  
                return (false);}  
  }  
      }  
 </script>  
 </html>  

4. Source Code CSS

 body {  
  background: #FF7F50;  
  font-family: "lato", cursive, sans-serif;  
 }  
 h2 {  
  color: #fff;  
 }  
 .login {  
  padding: 1em;  
  margin: 2em auto;  
  width: 17em;  
  background: #fff;  
  border-radius: 3px;  
 }  
 label {  
  font-size: 10pt;  
  color: #555;  
 }  
 input[type="text"],  
 input[type="email"],  
 input[type="phone"],  
 input[type="date"],  
 textarea {  
  padding: 8px;  
  width: 95%;  
  background: #efefef;  
  border: 0;  
  font-family: "lato", cursive, sans-serif;  
  font-size: 10pt;  
  margin: 6px 0px;  
 }  
 .tombol {  
  background: #FF7F50;  
  color: #fff;  
  border: 0;  
  padding: 5px 8px;  
 }  
Hasil:

Sabtu, 29 September 2018

PBO A-Tugas Latihan Membuat Jam

Nama: Ayu Mutiara Sari
NRP: 05111740000149
Kelas: PBO A

1. Source Code NumberDisplay


 /**  
  * Write a description of class NumberDisplay here.  
  *  
  * @author (Ayu Mutiara Sari)  
  * @version (24.01)  
  */  
 public class NumberDisplay    
  {    
   private int limit;    
   private int nilai;    
   public NumberDisplay(int Maksimal)    
   {    
   limit = Maksimal;    
   nilai = 0;    
   }    
   public int getValue()    
   {    
   return nilai;    
   }    
   public void increment()    
   {    
   nilai = (nilai + 1) % limit;    
   }    
   public String getDisplayValue()    
   {    
   if(nilai < 10)    
   {    
    return "0" + nilai;    
   }    
   else    
   {    
    return "" + nilai;    
   }    
   }    
   public void setValue(int replacementValue)    
   {    
   if((replacementValue >= 0) && (replacementValue < limit))    
   {    
    nilai = replacementValue;    
   }    
   }    
  }    

2. Source Code ClockDisplay


 /**  
  * Write a description of class ClockDisplay here.  
  *  
  * @author (Ayu Mutiara Sari)  
  * @version (24.01)  
  */  
 public class ClockDisplay    
  {    
   private NumberDisplay jam;    
   private NumberDisplay menit;    
   private String displayString;   
   public ClockDisplay()    
   {    
   jam = new NumberDisplay(24);    
   menit = new NumberDisplay(60);    
   updateDisplay();    
   }    
   public ClockDisplay(int hour, int minute)    
   {    
   jam = new NumberDisplay(24);    
   menit = new NumberDisplay(60);    
   setTime(hour,minute);    
   }    
   public void timeTick()    
   {    
   menit.increment();    
   if(menit.getValue() == 0)    
   {    
    jam.increment();    
   }    
   updateDisplay();    
   }    
   public void setTime(int hour, int minute)    
   {    
   jam.setValue(hour);    
   menit.setValue(minute);    
   updateDisplay();    
   }    
   public String getTime()    
   {    
   return displayString;    
   }    
   private void updateDisplay()    
   {    
   displayString = jam.getDisplayValue() + ":" + menit.getDisplayValue();    
   }    
  }    

3. Source Code


 /**  
  * Write a description of class TestClockDisplay here.  
  *  
  * @author (Ayu Mutiara Sari)  
  * @version (24.01)  
  */  
 public class TestClockDisplay    
  {    
   public TestClockDisplay()    
   {    
   }    
   public void test()    
   {    
   ClockDisplay clock = new ClockDisplay();    
   clock.setTime(00,06);    
   System.out.println(clock.getTime());    
   clock.setTime(04,30);    
   System.out.println(clock.getTime());  
   clock.setTime(12,10);    
   System.out.println(clock.getTime());  
   clock.setTime(22,59);    
   System.out.println(clock.getTime());   
   }    
  }    

4. Source Code Clock


 /**  
  * Write a description of class Clock here.  
  *  
  * @author (Ayu Mutiara Sari)  
  * @version (24.01)  
  */  
 import java.awt.*;    
  import java.awt.event.*;    
  import javax.swing.*;    
  import javax.swing.border.*;    
  public class Clock    
  {    
   private JFrame frame;    
   private JLabel label;    
   private ClockDisplay clock;    
   private boolean clockOn = false;    
   private TimerThread timerThread;    
   public void Clock()    
   {    
   makeFrame();    
   clock = new ClockDisplay();    
   }    
   private void start()    
   {    
   clockOn = true;    
   timerThread = new TimerThread();    
   timerThread.start();    
   }    
   private void stop()    
   {    
   clockOn = false;    
   }    
   private void step()    
   {    
   clock.timeTick();    
   label.setText(clock.getTime());    
   }    
   private void showAbout()    
   {    
   JOptionPane.showMessageDialog (frame, "Clock Version 0.1\n" +    
   "Membuat jam digital simpel dengan Java.",    
   "About Clock",    
   JOptionPane.INFORMATION_MESSAGE);    
   }    
   private void quit()    
   {    
   System.exit(0);    
   }    
   private void makeFrame()    
   {    
   frame = new JFrame("Clock");    
   JPanel contentPane = (JPanel)frame.getContentPane();    
   contentPane.setBorder(new EmptyBorder(1,60,1,60));    
   makeMenuBar(frame);    
   contentPane.setLayout(new BorderLayout(12,12));    
   label = new JLabel("00:00", SwingConstants.CENTER);    
   Font displayFont = label.getFont().deriveFont(96.0f);    
   label.setFont(displayFont);    
   contentPane.add(label, BorderLayout.CENTER);    
   JPanel toolbar = new JPanel();    
   toolbar.setLayout(new GridLayout(1,0));    
   JButton startButton = new JButton("Start");    
   startButton.addActionListener(e->start());    
   toolbar.add(startButton);    
   JButton stopButton = new JButton("Stop");    
   stopButton.addActionListener(e->stop());    
   toolbar.add(stopButton);    
   JButton stepButton = new JButton("Step");    
   stepButton.addActionListener(e->step());    
   toolbar.add(stepButton);    
   JPanel flow = new JPanel();    
   flow.add(toolbar);    
   contentPane.add(flow, BorderLayout.SOUTH);    
   frame.pack();    
   Dimension d = Toolkit.getDefaultToolkit().getScreenSize();    
   frame.setLocation(d.width/2 - frame.getWidth()/2, d.height/2 - frame.getHeight()/2);    
   frame.setVisible(true);    
   }    
   private void makeMenuBar(JFrame frame)    
   {    
   final int SHORTCUT_MASK =    
   Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();    
   JMenuBar menubar = new JMenuBar();    
   frame.setJMenuBar(menubar);    
   JMenu menu;    
   JMenuItem item;    
   menu = new JMenu("File");    
   menubar.add(menu);    
   item = new JMenuItem("About Clock...");    
    item.addActionListener(e->showAbout());    
   menu.add(item);    
   menu.addSeparator();    
   item = new JMenuItem("Quit");    
    item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q,SHORTCUT_MASK));    
    item.addActionListener(e->quit());    
   menu.add(item);    
   }    
   class TimerThread extends Thread    
   {    
   public void run()    
    {    
    while(clockOn)    
    {    
     step();    
     pause();    
    }    
    }    
    private void pause()    
    {    
    try    
    {    
     Thread.sleep(900);    
    }    
    catch(InterruptedException exc)    
    {    
    }    
   }    
   }    
  }   

Hasil:



Selasa, 25 September 2018

PWEBC- TUGAS BERITA

Nama: Ayu Mutiara Sari
NRP: 05111740000149
Kelas: PWEB C
source: www.techinasia.com

code HTML:

 <!DOCTYPE html>   
  <html>   
  <head>   
    <title>Tech in Asia</title>   
    <link rel="stylesheet" href="yeay.css"/>   
  </head>   
  <body>   
    <div class="header">   
    <div class="menu1">   
       <ul>   
         <li><a href="#">NEWS</a></li>   
         <li><a href="#">JOBS</a></li>   
         <li><a href="#">COMPANIES</a></li>   
         <li><a href="#">EVENT</a></li>   
         <li><a href="#">ABOUT</a></li>   
         <li><a href="#">ADVERTISE</a></li>   
       </ul>   
    </div>   
    <div class="menu2">   
       <ul>   
         <li><a href="#">CATEGORIES</a></li>   
         <li><a href="#">MARKETS</a></li>   
         <li><a href="#">WRITERS</a></li>   
       </ul>   
    </div>   
    </div>   
    <div class="isi">   
       <div class="jarak">    
         <div class="kiri">  
         <div class="border">   
            <div class="jarak">   
              <img src="web1.jpg" style=" float: left; width: 280px;height: 200px;">   
              <h3>How one Silicon Valley investor helps US startups enter Japan</h3>   
              <p>Hire the right country manager.</p>   
              <button class="btn">Read More..</button>   
            </div>   
         </div>   
            <div class="border">   
            <div class="jarak">   
              <img src="web3.jpg" style="float: left;width: 280px;0height: 200px;">   
              <h3>I oversee government digital services at GovTech. Ask me anything!</h3>   
              <p>Before GovTech, Parimal was director of technology at DreamWorks Animation. Ask him anything!</p>   
              <button class="btn">Read More..</button>   
            </div>   
         </div>  
         <div class="border">   
            <div class="jarak">   
              <img src="web2.jpg" style="float: left;width: 280px;height: 200px;">   
              <h3>Singapore introduces new rules for bike-share users, fines for abusers</h3>   
              <p>The rules are part of the Land Transport Authority’s new licensing regime for bike-sharing services.</p>   
              <button class="btn">Read More..</button>   
            </div>   
         </div>    
         </div>     
         <div class="job">   
            <div class="jarak">   
              <h2>LATEST JOBS</h2>   
                 <img src="job1.png" style="float: left;width: 34px;height: 34px;">   
                 <h1>Software Engineer-Backend</h1>   
                 <p>Jakarta, Indonesia</p>   
                 <img src="job2.png" style="float: left;width: 34px;height: 34px;">   
                 <h1>Graphic Designer</h1>   
                 <p>Singapore, Singapore</p>   
                 <img src="job3.png" style="float: left;width: 34px;height:34px;">   
                 <h1>Senior NodeJs Developer</h1>   
                 <p>Singapore, Singapore</p>    
            </div>   
            <div class="footer" >   
              <h2>Copyright 2018 PwebC</h2>   
            </div>   
         </div>   
       </div>   
    </div>   
  </body>   
  </html>  

code css:
 body{   
    background: #FF7F50;   
    color: #333;   
  /*   width: 100% ;   
    height: 100%;*/   
    font-family: "lato", cursive, sans-serif;   
    /*margin: 0 auto;*/   
  }   
  .isi{   
    width: 88%;   
    margin: auto;   
    /*height: 420px;*/   
    padding: 0.1px;   
    background: #FFF8DC;   
    color: #333;   
  }   
  .header{   
    margin: 0;   
    background: #FFF8DC;   
  }   
  .kiri{   
    width: 70%;   
    float: left;   
    margin: auto;   
    background: #FFF8DC;   
    /*height: 420px;*/   
  }   
  .job{   
    width: 25%;   
    float: left;   
    margin: auto;   
    background: #FFF8DC;   
    /*height: 420px;*/   
  }   
  .border{   
    /*border: 2px solid #000;*/   
    height: 200px;   
    margin-top: 1pc;   
    padding-bottom: 3pc;   
    padding-right: 2pc;   
  }   
  .undecor{   
    text-decoration: none;   
  }   
  .footer{   
    /*width: 90%;*/   
    margin: auto;   
    height: 40px;   
    line-height: 40px;   
    background: #F0EEEE;   
  }   
  .menu1{   
    background-color: #F0EEEE;   
    height: 50px;   
    line-height: 50px;   
    /*position: relative;*/   
    /*width: 90%;*/   
    /*margin: 0;*/   
    /*padding:0;*/   
  }   
  .menu2{   
    background-color: #F0EEEE;   
    height: 60px;   
    line-height: 60px;   
    /*position: relative;*/   
    /*width: 90%;*/   
    margin: 0;   
    /*padding:0 auto;*/   
  }   
  .jarak{   
    padding: 0 2pc;   
  }   
  .menu1 ul{   
    list-style: none;   
  }   
  .menu1 ul li a{   
    float: left;   
    width: 14%;   
    display: block;   
    text-align: center;   
    color: #A4A4A4;   
    text-decoration: none;   
  }   
  .menu1 ul li a:hover{   
    background-color: #DDDCDC;   
    display:block;   
  }   
  .menu2 ul{   
    list-style: none;   
  }   
  .menu2 ul li a{   
    float: left;   
    width: 14%;   
    display: block;   
    text-align: center;   
    color: #A4A4A4;   
    text-decoration: none;   
  }   
  .menu2 ul li a:hover{   
    background-color: #FAF9F9;   
    display:block;   
  }   
  .job p{   
    font-size: 12px;   
    margin: 0;   
    text-align:center;   
    margin: 10px;    
    color:#D9D8D8;   
  }   
  h3{   
    font-family: "Lucida Console";   
    font-weight: bold;   
    font-size: 24px;   
  }   
  p{   
    font-family: "Verdana";   
    font-size: 14px;   
    font-weight: lighter;   
    color: #ADACAC;   
  }   
  h1{   
    font-family: "Verdana";   
    font-size: 13px;   
    font-weight: bold;   
    text-align: center;   
    padding-top: 10px;   
  }   
  h2{   
    font-family: "Lucida Console";   
    font-weight: lighter;   
    font-size: 12px;   
  }  

Hasil: