This is mini calculator in Program Java used input User in command form.
Yo" kawan-kawan ini saya ada buat mini kalkulator menggunakan java program di command user yang minta dari user.
check it out :
import java.util.Scanner;
/*
@ Author Mega Sari -- President University
DO NOt COPY and Paste Without this!!
*/
public class amenu
{
public static void main (String args[])
{
Scanner input = new Scanner(System.in);
int menu;
int angka1, angka2, hasil,hasil2,hasil3,hasil4;
System.out.println("Welcome to calculator ");
System.out.println("1. Addition");
System.out.println("2. Subcription");
System.out.println("3. Division");
System.out.println("4. Multiplication");
System.out.print("Please choose the menu what U want! :");
menu = input.nextInt();
if(menu == 1)
{
System.out.print("Enter First no :");
angka1 = input.nextInt();
System.out.print("Enter second no :");
angka2 = input.nextInt();
hasil = angka1+angka2;
System.out.printf("Result from %d + %d =%d",
angka1,angka2,hasil);
}
else if (menu == 2)
{
System.out.print("Enter First no :");
angka1 = input.nextInt();
System.out.print("Enter second no :");
angka2 = input.nextInt();
hasil2 = angka1-angka2;
System.out.printf("Result from %d - %d =%d",
angka1,angka2,hasil2);
}
else if (menu == 3)
{
System.out.print("Enter First no :");
angka1 = input.nextInt();
System.out.print("Enter second no :");
angka2 = input.nextInt();
hasil3 = angka1/angka2;
System.out.printf("Result from %d / %d =%d ",
angka1,angka2,hasil3);
}
else if (menu == 4)
{
System.out.print("Enter First no :");
angka1 = input.nextInt();
System.out.print("Enter second no :");
angka2 = input.nextInt();
hasil4 = angka1*angka2;
System.out.printf("Result from %d * %d =%d",
angka1,angka2,hasil4);
}
else
{
System.out.println("The muenu doesn't exist!!");
}
}
}
semoga bermanfaat yahh.,
Yo" kawan-kawan ini saya ada buat mini kalkulator menggunakan java program di command user yang minta dari user.
check it out :
import java.util.Scanner;
/*
@ Author Mega Sari -- President University
DO NOt COPY and Paste Without this!!
*/
public class amenu
{
public static void main (String args[])
{
Scanner input = new Scanner(System.in);
int menu;
int angka1, angka2, hasil,hasil2,hasil3,hasil4;
System.out.println("Welcome to calculator ");
System.out.println("1. Addition");
System.out.println("2. Subcription");
System.out.println("3. Division");
System.out.println("4. Multiplication");
System.out.print("Please choose the menu what U want! :");
menu = input.nextInt();
if(menu == 1)
{
System.out.print("Enter First no :");
angka1 = input.nextInt();
System.out.print("Enter second no :");
angka2 = input.nextInt();
hasil = angka1+angka2;
System.out.printf("Result from %d + %d =%d",
angka1,angka2,hasil);
}
else if (menu == 2)
{
System.out.print("Enter First no :");
angka1 = input.nextInt();
System.out.print("Enter second no :");
angka2 = input.nextInt();
hasil2 = angka1-angka2;
System.out.printf("Result from %d - %d =%d",
angka1,angka2,hasil2);
}
else if (menu == 3)
{
System.out.print("Enter First no :");
angka1 = input.nextInt();
System.out.print("Enter second no :");
angka2 = input.nextInt();
hasil3 = angka1/angka2;
System.out.printf("Result from %d / %d =%d ",
angka1,angka2,hasil3);
}
else if (menu == 4)
{
System.out.print("Enter First no :");
angka1 = input.nextInt();
System.out.print("Enter second no :");
angka2 = input.nextInt();
hasil4 = angka1*angka2;
System.out.printf("Result from %d * %d =%d",
angka1,angka2,hasil4);
}
else
{
System.out.println("The muenu doesn't exist!!");
}
}
}
semoga bermanfaat yahh.,
Tidak ada komentar:
Posting Komentar