Program Java

Program Menghitung Rata-rata

import java.util.Scanner;
public class Rata_rata
{
public static void main(String args[])
{
Scanner x = new Scanner(System.in);
int n,i,w,jum;
float rata;
float s;
jum=0;
System.out.print(“Masukan jumlah data : “);
n = x.nextInt();
i=1;
w=0;

More >

Program Menghitung Umur Seseorang

import java.util.Scanner;
public class Umurku
{
public static void main(String args[])
{
Scanner masuk = new Scanner(System.in);
int hra,bla,tha,hrb,blb,thb,u,utha,uthb,ubla,ublb,uhra,uhrb,ua,ub;
System.out.print(“Masukan Tanggal lahir anda(xx) : “);
hra=masuk.nextInt();
System.out.println();
System.out.print(“Masukan Bulan lahir anda(yy) : “);
bla=masuk.nextInt();
System.out.println();
System.out.print(“Masukan Tahun lahir anda(TT) : “);
tha=masuk.nextInt();

More >

Program menghitung pecahan uang

import java.util.Scanner;
public class Uang
{
public static void main(String args[])
{
Scanner masuk = new Scanner(System.in);
int Uang,Pecahan1,Pecahan2,Pecahan3,Pecahan4,Pecahan5,Pecahan6,

Pecahan7,Sisa1,Sisa2,Sisa3,Sisa4,Sisa5,Sisa6,Sisa7;
System.out.print(“JUMLAH UANG = “);

Uang=masuk.nextInt();

More >

Program sederhana menghitung diskon

import java.util.Scanner;
public class Promo
{
public static void main(String args[])
{
System.out.println(” Program Promo Potongan Harga “);
System.out.println(“~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~~~~~~~~”);
System.out.println(” ************** Selamat Datang ***************”);
Scanner masuk = new Scanner(System.in);
int merek,ukuran,diskon;
double h1,h2,h3,h4,h5,h6,h7,h8;
String input;

More >