Alpro 1

Ini Program sederhana yang dibuat dalam bahasa Java, fungsinya untuk membandingkan nilai pada variable ‘uang’ dengan nilai variable ‘total’.

Code Program

—————————

public class main
{

public static void main (String[] args)
{
// todo code application logic here
System.out.println(“Test”);

int price1, q1, price2, q2, discount1, discount2, total, nett1, nett2;

price1=5000;
discount1=95;
q1=5;
nett1=price1/100*discount1*q1;

price2=7500;
discount2=90;
q2=10;
nett2=price2/100*discount2*q2;

total=nett1+nett2;

System.out.println(“Total =” + total);

long uang=100000;

if(total>uang)
{
System.out.println(“Uang Anda tidak cukup”);
}
else
{
System.out.println(“Terima Kasih, Kembali Anda “+ (uang-total));
};
}

}

—————————

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s