0% found this document useful (0 votes)
157 views

Pemrograman Java

The document contains code for a Java program that gets user input for personal biodata including name, student ID, gender, address, and phone number. It displays the collected biodata in a formatted table. It also contains code for another Java program that gets user input for a food order including name, selected dish, and quantity. It calculates and displays the total price of the order based on the selected dish and quantity.

Uploaded by

IyanAntoniuz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
157 views

Pemrograman Java

The document contains code for a Java program that gets user input for personal biodata including name, student ID, gender, address, and phone number. It displays the collected biodata in a formatted table. It also contains code for another Java program that gets user input for a food order including name, selected dish, and quantity. It calculates and displays the total price of the order based on the selected dish and quantity.

Uploaded by

IyanAntoniuz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

/*

* To change this license header, choose License Headers in Project Properties.

* To change this template file, choose Tools | Templates

* and open the template in the editor.

*/

package javaapplication6;

import java.util.Scanner; // import scanner untuk inputannya

/**

* @author msi gaming

*/

public class JavaApplication6 {

public static void main(String[] args) {

// TODO code application logic here

Scanner input = new Scanner(System.in);

String nama, nim, jeniskelamin, alamat, nope, def

="Masukan ";

System.out.println("| Contoh Program Java Biodata |");

System.out.println("| =========================== |");

System.out.println(def + "Nama \t\t: ");

nama = input.nextLine();
System.out.println(def + "Nim \t\t: ");

nim = input.nextLine();

System.out.println(def + "Jenis Kelamain \t\t: ");

jeniskelamin = input.nextLine();

System.out.println(def + "Alamat \t\t: ");

alamat = input.nextLine();

System.out.println(def + "Nomor Handphone \t\t: ");

nope = input.nextLine();

System.out.println("");

//tampilan datanya

System.out.println("+------------------------+");

System.out.println("| Biodata |");

System.out.println("|Nama \t\t\t: + " + nama );

System.out.println("|NIM \t\t\t: " +nim);

System.out.println("|Jenis Kelamoin \t\t: " + jeniskelamin );

System.out.println("|Alamat \t\t: " + alamat);

System.out.println("|Nomor Hp \t\t: "+ nope);

System.out.println("-------------------------- ");
}

/**

* @param args the command line arguments

*/

}
/*

* To change this license header, choose License Headers in Project Properties.

* To change this template file, choose Tools | Templates

* and open the template in the editor.

*/

package javaapplication6;

import java.util.Scanner;

/**

* @author msi gaming

*/

public class NewClass {

public static void main (String[] args) {

Scanner input = new Scanner(System.in);

int pesan,pilih;

String nama;

System.out.print("Masukan Nama :");

nama = input.next();

System.out.print("Pilihan:\n 1. nasi Goreng (Rp.15.000.00)\n 2. Mie Ayam (Rp.10.000.00) \n 3. Bakso


(Rp.13.000.00)");

pilih = input.nextInt();

System.out.print("Jumlah Pesan :");

pesan = input.nextInt();

System.out.println("============== :");

switch(pilih){
case 1:

System.out.println("Nama Pemesan :"+nama);

System.out.println("Pesanan : Nasi Goreng");

System.out.println("Harga Pesanan : 15.000");

System.out.println("Jumlah Pesan :"+pesan);

System.out.println("Total Bayar :"+pesan*15.000);

break;

case 2:

System.out.println("Nama Pemesan :"+nama);

System.out.println("Pesanan : Mie Ayam");

System.out.println("Harga Pesanan : 10.000");

System.out.println("Jumlah Pesan :"+pesan);

System.out.println("Total Bayar :"+pesan*10.000);

break;

case 3:

System.out.println("Nama Pemesan :"+nama);

System.out.println("Pesanan : Bakso");

System.out.println("Harga Pesanan : 13.000");

System.out.println("Jumlah Pesan :"+pesan);

System.out.println("Total Bayar :"+pesan*13.000);

break;

default:

System.out.print("Salah Pilih ! (");

}
}

You might also like