Senin, 14 Januari 2013

Java OOP 2

Membuat aplikasi pengaturan suhu AC, ini sederhana banget dan ribet mungkin, hehe

public class AturSuhu{
    private static String A = "a";
    private static String B = "b";
    private static Integer ta,tb,tc,cs1,cs2,cs3;
    private static Integer Suhu;
    private static double jam;
       
public static  void  main (String args[])throws IOException
{
    BufferedReader bufferedReader = new BufferedReader (new InputStreamReader (System.in));
   
    ta = 1;
    tb = 2;
    tc = 3;
    cs1 = 3;
    cs2 = 5;
    cs3 = 7;
    jam = 9.25;
       
    System.out.println("Welcome in Electro Factory AC App \nBy Dewi Setiarini 1112091000037");
    System.out.println("Date : January 7, 2013 \nTime : "+jam);
    System.out.println("Menu :\n[a] Turn On \n[b] Turn Off");
    System.out.print("Chose Menu : ");
   
    String input1 = bufferedReader.readLine();
   
  
    if (input1.equals(A))
    {
      
       System.out.println("Air Conditioner is On");
      
       System.out.print("Insert Temperature that You Want : ");
       Integer suhu = Integer.parseInt(bufferedReader.readLine());
       System.out.println("The Current Temperature is "+suhu+" Degrees Celcius");
      
       System.out.println("Comfort Sleep :\n[1] 3 Hours \n[2] 5 Hours \n[3] 7 Hours");
       System.out.print("Chose Comfort Sleep's Time : ");
      
       Integer input2 = Integer.parseInt(bufferedReader.readLine());
         
        if (input2.equals(ta))
        {
            suhu=suhu+cs1/2+cs1/2;
            System.out.println("Comfort Sleep is "+cs1+" Hours \nAC will be turn off in "+suhu+" Degrees Celcius at "+(jam+cs1)+"\nThank You, Enjoy Your Day :)");
        }
        else if(input2.equals(tb))
        {
            suhu=suhu+cs2/2+cs2/2;
            System.out.println("Comfort Sleep is "+cs2+" Hours \nAC will be turn off in "+suhu+" Degrees Celcius at "+(jam+cs2)+"\nThank You, Enjoy Your Day :)");
        }
        else if(input2.equals(tc))
        {
            suhu=suhu+cs3/2+cs3/2;
            System.out.println("Comfort Sleep is "+cs3+" Hours \nAC will be turn off in "+suhu+" Degrees Celcius at "+(jam+cs3)+"\nThank You, Enjoy Your Day :)");
        }
        else
        {
            System.out.println("Sorry, Your input is Wrong, You must insert 1, 2, or 3.");
            System.exit(0);
        }
    }
   
   
    else if(input1.equals(B))
    {
       System.out.println("Air Conditioner is Off, Thank You :)");
    }
    else
    {
        System.out.println("Sorry, Your input is Wrong, You must insert a or b.");
        System.exit(0);
    }
   
}   
}








Selamat mencoba ^_^

Java OOP 1

Ini tugas UAS DDP Praktikum. Dengan soal :
  1. Buatlah sebuah aplikasi yang inputnya adalah sebuah bilangan bulat positif (misalkan n). Aplikasi akan menghitung keluaran berupa sebuah nilai integer hasil dari (2n2 + n + 3).
  2. Buatlah sebuah aplikasi untuk mengubah sebuah nilai input menjadi bentuk tanggal. Contoh, misalnya user memasukkan : 9102012, maka aplikasi akan memberi keluaran : 9 Oktober 2012.
  3. Sebuah perusahaan akan memasang umbul-umbul di sepanjang jalan untuk sebuah event. Peraturan pemerintah menyatakan bahwa jarak antara 2 umbul-umbul yang dipasang haruslah 2 meter, dan umbul-umbul pertama diletakkan pada titik 0 meter. Perusahaan tersebut kesulitan dalam menghitung jumlah umbul-umbul yang harus disediakan. Buatlah sebuah aplikasi yang dapat membantu menghitung jumlah umbul-umbul yang harus disediakan oleh perusahaan tersebut. Pengguna akan memasukkan sebuah bilangan integer (misalkan n) yang merupakan panjang jalan yang akan dipasangi umbul-umbul, lalu aplikasi akan menampilkan jumlah umbul-umbul yang harus disediakan. Contoh masukan : 3 , Contoh Keluaran : umbul-umbul yang harus disediakan adalah sejumlah 2 buah.
  4. Diketahui sebuah deret bilangan fibonacci : 1,2,3,5,8,13, dst... Kita ketahui bahwa bilangan fibonacci ke n adalah jumlah dari bilangan ke n-1 ditambah dengan bilangan ke n-2. Contoh pada deret 1,2,3,5,8,13 , bilangan ke 3 adalah penjumlahan dari bilangan ke-1 dan ke-2 (5 = 2+3) , atau bilangan ke 2 adalah penjumlahan bilangan ke-0 dan ke-1 (3=1+2). Buatlah sebuah aplikasi untuk menghitung bilangan fibonacci ke-5 dari inputan yang diberikan user. User akan memberikan 2 buah inputan berupa bilangan integer yang merupakan bilangan pertama dan kedua dari deret fibonacci. Contoh masukan : 1 2 , Contoh keluaran : Bilangan ke-5 adalah 13.

Dengan script java :

public class Soal1 {
    void hitung (){   
    Scanner scan = new Scanner(System.in);
        System.out.println("\t------------Welcome to---------------");
        System.out.println("\tAplikasi hitung nilai dari (2n^2+n+3)");
        System.out.println("\t-------------------------------------");
        int n;
        int hasil;
        int pangkat;
       
        System.out.print("\nMasukkan bilangan yang akan diasumsikan sebagai n: ");
        n = scan.nextInt();
        if (n>0){
            pangkat = n*n;
            hasil = (2*pangkat)+n+3;
            System.out.println("\nHasil dari (2n^2+n+3) adalah "+hasil);
            System.out.println("Terima kasih Anda telah menggunakan program ini ^_^");
        }
        else{
            System.out.println("\nBilangan n itu bilangan positif coy -_-");
        }
    }
}
-------------------------------------------------------------------------------------------------------------
public class Soal2 {
    void tanggal(){   
    Scanner scan = new Scanner(System.in);
        System.out.println("\t----------Welcome to----------");
        System.out.println("\t-----Program tanggal lahir----");
        System.out.println("\t------------------------------");
        String angka;
        do{
        System.out.print("\nMasukkan tanggal lahir Anda dengan format (ddmmyyyy): ");
        angka = scan.next();
        }while(angka.length()!=8);
        String tanggal = angka.substring(0,2);
        String bulan = angka.substring(2,4);
        String tahun = angka.substring(4,8);
       
        switch (bulan){
            case "01":
                bulan = "Januari";
                break;
            case "02":
                bulan = "Februari";
                break;
            case "03":
                bulan = "Maret";
                break;
            case "04":
                bulan = "April";
                break;
            case "05":
                bulan = "Mei";
                break;
            case "06":
                bulan = "Juni";
                break;
            case "07":
                bulan = "Juli";
                break;
            case "08":
                bulan = "Agustus";
                break;
            case "09":
                bulan = "September";
                break;
            case "10":
                bulan = "Oktober";
                break;
            case "11":
                bulan = "November";
                break;
            case "12":
                bulan = "Desember";
                break;
            default :
                System.out.println("Maaf angka yang Anda masukkan salah");
       
       
    }
        System.out.println("\nAnda lahir pada "+tanggal+" "+bulan+" "+tahun);
        System.out.println("\nTerima kasih telah menggunakan program ini ^_^");
       
    }

}
--------------------------------------------------------------------------------------------------------------
public class Soal3 {
    void umbul(){   
    int umbul2;
        System.out.println("\t----- Welcome to -----");
        System.out.println("\t Umbul-Umbul Counter");
        System.out.println("\t----------------------");
        System.out.print("Masukan Panjang Jalan : ");
        System.out.print("");
        Scanner input = new Scanner(System.in);
        int panjang = input.nextInt();
        umbul2=panjang/2;
        umbul2=umbul2+1;
        System.out.println("Result");
        System.out.println("******");
       
        System.out.println("Panjang jalan : "+panjang+" meter");
        System.out.println("Jumlah umbul-umbul yang diperbolehkan :  ");
        System.out.println(umbul2+" umbul-umbul");
        System.out.println("Terima kasih telah menggunakan program ini ^_^");
    }
}
---------------------------------------------------------------------------------------------------------
public class Soal4 {
    void fibonacci(){   
    Scanner scan = new Scanner(System.in);
        int a,b,c,d,e,f,i,k;
       
        System.out.println("\t-----------------Welcome to----------------");
        System.out.println("\t-------Program bilangan Fibonacci ke-5-----");
        System.out.println("\t-------------------------------------------");
        System.out.print("\nMasukkan bilangan pertama :");
        a = scan.nextInt();
        System.out.print("\nMasukkan bilangan kedua :");
        b = scan.nextInt();
        k=(a+b);
        c=a+b;
        d=c+b;
        e=d+c;
        f=e+d;
        System.out.println("\n");
         System.out.println("Deret yang akan ditampilkan adalah");
    System.out.println();
    System.out.print(a +" " +b +" " +k +" ");
   
   
    for(i=a; i<=5; i++){
        k=k+b;
        b=k-b;
       
        System.out.print(k +" ");
    }
    System.out.println();
    System.out.println();
  
  
  
   System.out.println("Bilangan kelima dari deret tersebut adalah " +f);
    }
}
--------------------------------------------------------------------------------------------------------
public class Main {
    public static Integer menu1 = 1;
    public static Integer menu2 = 2;
    public static Integer menu3 = 3;
    public static Integer menu4 = 4;
    public static Integer keluar = 0;
   
    public static void main (String[] args){
       
    Scanner scan = new Scanner(System.in);
    String nama;
    Integer menu;
   
    System.out.println("\t****** Selamat Datang di Aplikasi Kelompok 3 ******");  
    System.out.println("\tDewi Setiarini, M.Ashari, Rionaldy, Wisnu Ari Mukti");
    System.out.println("\t  ********** Teknik Informatika 2012 **********\n\n");
    System.out.print("Masukkan Nama Anda : ");
    nama = scan.next();
    System.out.println("Hai "+nama+" Silahkan Pilih Menu di Aplikasi Kelompok 3");
    System.out.println("Menu :\n[1] Aplikasi Hitung nilai (2n^2+n+3)\n[2] Program Tanggal Lahir\n[3] Umbul-umbul Counter\n[4] Program bilangan Fibonacci ke-5\n[0] Keluar");
    System.out.print("Menu yang dipilih: ");
    menu = scan.nextInt();
    do{
    if (menu.equals(menu1))
    {
        Soal1 method1 = new Soal1();
        method1.hitung();
    }
    else if (menu.equals(menu2))
    {
        Soal2 method2 = new Soal2();
        method2.tanggal();
    }
    else if (menu.equals(menu3))
    {
        Soal3 method3 = new Soal3();
        method3.umbul();
    }
    else if (menu.equals(menu4))
    {
        Soal4 method4 = new Soal4();
        method4.fibonacci();
    }
    else
    {
        System.out.println("Terima Kasih "+nama+" Telah Menggunakan Aplikasi Kelompok 3 ^_^");
        System.exit(0);
    }
    System.out.print("\nPilih Menu Lain : ");
    menu = scan.nextInt();
    }while(menu!=5 );
   
   
}
}

Semoga Bermanfaat :)

Rabu, 22 Februari 2012

HIV AIDS

HIV AIDS you know? Acquired Immunodeficiency Syndrome or Acquired Immune Deficiency Syndrome (AIDS abbreviated) is a collection of symptoms and infections (or: syndrome) arising out of damage to the human immune system caused by HIV infection or infection with other viruses that attack similar to other species (SIV, FIV , etc.).Own virus called Human Immunodeficiency Virus (HIV for short) is the virus that weakens the immunity in the human body. People who are exposed to this virus will become susceptible to opportunistic infections or tumor prone. Although there has been handling that can slow the rate of progression of the virus, but this disease can not be cured completely.HIV and similar viruses are generally transmitted through direct contact between the skin layer (mucous membrane) or the bloodstream with a bodily fluid containing HIV, such as blood, semen, vaginal fluid, preseminal, and breast milk. Transmission can occur through sexual intercourse (vaginal, anal, or oral), blood transfusion, contaminated hypodermic needles, between mother and infant during pregnancy, childbirth, or breastfeeding, as well as other forms of contact with body fluids.Scientists generally think that AIDS originated from Sub-Saharan Africa. Now, AIDS has become a plague. AIDS has infected an estimated 38.6 million people around the world. On January 2006, UNAIDS in collaboration with the WHO estimate that AIDS has caused the deaths of more than 25 million people since it was first recognized on June 5, 1981. Thus, this disease is one of the deadliest plague in history. AIDS has claimed the cause of death by 2.4 to 3.3 million lives in 2005 alone, and more than 570,000 people of whom are children. One third of these deaths occur in Sub-Saharan Africa, thus slowing economic growth and destroy the power of human resources there. Antiretroviral treatment can actually reduce the mortality rate and severity of HIV infection, but access to treatment is not available in all countries. Social penalties for people with HIV / AIDS, are generally more severe when compared with patients with other deadly diseases. Sometimes the social punishment is also tertimpakan to health workers or volunteers, are involved in caring for people living with HIV / AIDS (PLWHA).

Kamis, 15 Desember 2011

Understanding The Aging

Being a parent is a natural process that must occur pasa everyone. No one can stop the aging process. Aging is characterized by starting to decline in various functions of the organs. Because after reaching adulthood naturally all components of the body can not grow anymore. The aging process is not only related to physical factors, but also psychological and social. The aging process itself can cover any changes in the tissues of the body to change the mechanisms at the cellular level.Many factors cause each person to grow old through the aging process. Basically these various factors can be grouped into internal factors and external factors. Several internal factors are free radicals, decreased hormone levels, the process of glycosylation, which decreases the body's immune system as well as genetic factors. While external factors is unhealthy lifestyle, unhealthy diet, wrong habits of life, environmental pollution, ultraviolet light, stress, and other social causes such as poverty. These two factors are interrelated and have a big role in the causation process yag penuaanmeningkat amount.Our bodies form a complex chemical reaction forms a chemically unstable molecules called free radicals. These free radical molecules can cause krusakan on healthy cells through a process called oxidation. This process is similar to the ones we see on the green apple turns brown or copper metal that changes color from golden to reddish to greenish blue. Free radical production can increase in number if we are often exposed to sunlight, smoking, air pollution and consume low makana nutrition. Stress also plays a major role in the aging process. Stress in this case is not only related to psychological but also physical. When the body is damaged, the body will try to recover myself. At a certain extent the body can be recovered but not completely and not in all cases.The aging process can be prevented and slowed down when we have a good lifestyle and healthy and we consistently apply preformance everyday life. The first way is, exercise regularly and consistently. By exercising regularly, the body is accustomed to be always active and the blood circulation throughout the body remains healthy. Someone mentioned that people who start exercise habits have morbidity and mortality rates are lower than with young people who are diligent exercise and become lazy to exercise old age. Second is, eating healthy foods. Tips are used in choosing foods that can help slow the aging process: Limit consumption of refined sugar and animal fat, especially saturated fat, high fiber meal consumption sperti wheat, fruits and vegetables, adequate calcium intake, drink extra water and consumption of antioxidants. Third is, do periodic health checks are required and in accordance with the conditions of each individual. Fourth manage stress is to always think positive. (Dr. Pamela Diah Ruri)

Oily Skin Care

Oily skin is characterized by skin characters that look shiny and oily, and also have pores is clearly visible. Oily skin is caused by glands that make excessive secretion of oil on the skin (overproduction). It can berkembangmenjadi whiteheads (closed comedones and yet still oxidized) and blackhead (open comedones and oxidized so that colored black).But oily skin types are usually more durable and not easily wrinkled either by the aging process kulitmaupun by facial movement that often can lead to a clear expression lines, especially for owners of dry skin. Having oily skin does not mean we have to remain in a state of acne permanently. Having a skin type like this only means we have to follow the ways of skin care routine so you can help this extra condition before secretion becomes minimum.Here are some tips on how to care for oily skin.Foundation for oily skin care starts with washing the face twice a day, three times if possible. Although oily skin has more resistance than other skin types. Many ingredients that are hard are contained in a wide range of products perawatankulit really is not that necessary. Enough to make use of regular facial cleanser that suits the wearer's skin type.If you are one of the frequent fighting acne with oily skin conditions, it is advisable for you to use a cleanser that contains salicylid acid (salicylic acid).Clean your face regularly is more important than using soap in accordance with oily skin types. However facial soap and cleaning products that contain alcohol should any dihidari, because these cleaners can make the skin irritated and makes the skin too dry'd Always remember to clean the face of all makeup applied before going to bed. Leaving makeup will remain attached to the skin pores causing blockage in the closed pores, which is the beginning of problems such as blackhead and pimples. So no matter whatever you are late coming home or anything after you, make it a habit to clean your face of makeup.If you have a habit of using a toner, you can forward it as long as you use products that are free from alcohol. Indeed, most cleaning products face the current has also has the function and refreshes the face, but the toner can help get rid of residue left from cleaning and will also feel comfortable in the skin.Moisturizer also remains a very important thing, even seklaipun you often fight against your skin is oily. Try using a moisturizer specially formulated for oily skin types. Where these products serves to keep your skin hydrated after other products have been working to reduce production or excessive secretion of oil glands in your skin.

Jumat, 09 Desember 2011

Attractive Appearance, Clothing Exact

However the body shape you have, you can look fabulous. Once you begin to accept yourself sindiri and know who you are then you will find something appropriate for your use and then your confidence will increase. Every woman has the disadvantages of each, but it does not mean you can not hide it. Make sure when you are shopping for clothes you know the shortcomings of your body as something that you should cover as well as highlight other interesting side. so you'll look perfect. Here are some models of appropriate clothing for your body type.Type that has a size large hips and thighs. For this body type, you should not wear long dresses should be no more than 5-7 cm from above the knee. Choose a dress with a-line skirt. Can also choose a dress with straps in the back. Dress with this model can help make the curve of your body looks. To model the collar, use a model of v (v - neck).Body type with a wide waist. If the apple-shaped body which has a body width in the middle, you need to lengthen the look of your body. Choose a dress that shows the curve of your waist line. Avoid big belts and wide. Choose a chain belt and plug in your hips.Body type with a big arm. Sleeveless dress model or type of clothing with a hat kapucon or clothing is not suitable for owners of large arm. Instead, choose a shirt with ¾ sleeves or long sleeves. Model outfit like this can help cover your arms are huge. To help establish the ideal body can do arm exercises with dumbbells held for 15 minutes a day. This could help to improve the shape of your arm to be more ideal. That way, you'll be more confident wearing sleeveless dresses.Body type with small breasts. If the form of small breasts, you can still look sexy fashion handle links baby doll dresses or dresses with ribbon fastening under the breast. to add a dimension at the top can also be added accessories or jewelry beads are worn around the neck. Layered necklace that was popular also can make the appearance more riveting.Type the body with large breasts. Halter dress model (with the breastplate of clothing tied around the back of the neck and back) or v-collar dress model is very attractive to women who want to highlight the shape of the breast.Large size body types. For this body type do not try to wrap your body with baggy clothes. The reason, loose clothing will only make you look bigger. Wrap dress can be the right choice for this one body type. For those who have large body size, you must dare to look sexy by wearing a colorful fashion collections or patterned motif. This could attract a magnet and can make you look more stylish.Type the body is too skinny. Wearing a sweater is a good choice for thin women. You can also coat the sleeve with a cardigan or jacket. If you have very small feet, avoid mini skirts and select a dress with long skirt. Add a thick belt to waist look fuller. Balloon dresses can also be an option because it gives the appearance of the body become bigger and fuller.Good luck ;)

Want to Diet?

Diet is the wishes of some people who feel themselves too fat, or even sometimes because of job demands. If you want to burn more fat without wanting to effortlessly determine the diet plan, counting calories, or other programs, try it with a healthier way is to add foods that are nutritious foods into your diet. It makes you feel fuller and are foods that actually burn fat and healthy than to eat junk food.Yag fibrous foods good for your diet. All plant foods can lose weight with a diet high in fiber which include green vegetables in the diet to diet. Because fiber is very effective to help lower bad cholesterol. This makes you feel full and eat less. High fiber foods take longer to digest. Here are some foods which you can choose, there is no particular order or priority which is best. You can determine the taste and needs.Apples. Benefits of apples very much for your diet. Pectin (one of the substances in apples) makes you feel fuller. This is an effective way to eat less. In addition, pectin actually serves as the absorption of fat. Apples in the morning at breakfast, or try it as a snack mid-day is the time to choose.Avocado. Avocado is evidence that a diet low in fat does not always have to help you lose weight. Avocados contain over 25 essential nutrients, vitamin B, potassium, vitamin E, and lutein.Paprika (or other green vegetables). Green vegetables (like peppers) has a function speeds up metabolism. In western countries, peppers are often processed into salad interesting and delicious, so we can assume that a healthy diet is not always bland.Broccoli. Unlike the peppers, broccoli has no other role. Broccoli is a food a powerful anti-cancer diet, high in calcium, iron, magnesium, vitamin A, and vitamin C.There bebarapa snacks to the diet in order to remain able to enjoy a snack without having to worry about weight problems. First there youghurt. This one is a lot of foods that contain calcium sources that help you boost immunity, in a study explaining youghurt can help reduce belly fat by 80%. Then almonds. Almonds has 6 grams of protein content. Almonds are also rich in protein but also rich in good fats, because of the healthy fat content so you can mebuat full. Eggs are the food which is the best energy source for a lot of protein content. Eggs are also one of the functional foods for muscle formation. So it is good for consumption. Roasted soy nuts. Nutritional value of soy beans to measure ¼ cup roasted, that is equivalent to 17 grams of protein. Try a variety of soy beans and leave intact fatty snacks like cashew nuts. There is nothing wrong also to eat snacks in addition capable of filling is also able to maintain the appearance of you who want to look slim.Those are some tips and a variety of snacks that can be consumed to meets these demands is through a diet program. Thank you.