私はこのJava電卓とeclipseを使ったテキストベースのゲームを作った。私がしたいのは、何らかの.exeや.jarファイルを持っているか、それを実行すると私のJavaプログラムを実行するものです。私はダウンロードのためにこれを置くことができるようにして、他の人々が日食を持たずにテキストベースのゲームをプレイできるようにしたい。私が求めているのは、自分のプログラムをブラウザや他の誰かのコンピュータで実行できるようにすることです。 私はあなたが実行可能なJARファイルとしてファイルをパッケージ化する必要があり、どこかHERESに私の電卓コード私のJavaプログラムをダウンロードする方法
package calculator;
import java.util.Scanner;
public class calculator {
public static void main(String args[]){
Scanner test = new Scanner(System.in);
System.out.println("enter a number");
int a = test.nextInt();
System.out.println("enter 1 to add 2 to subtract 3 to multiply 4 for divide");
int t = test.nextInt();
if(t == 1){
System.out.println("enter the second number");
int g = test.nextInt();
int u = a + g;
System.out.println("The answer is " + u);
}
if(t == 2){
System.out.println("enter the second number");
int l = test.nextInt();
int m = a - l;
System.out.println("The answer is " + m);
}
if(t == 3){
System.out.println("enter the second number");
int j = test.nextInt();
int v = a * j;
System.out.println("The answer is " + v);
}
if(t == 4){
System.out.println("enter the second number");
int p = test.nextInt();
int z = a/p;
System.out.println("The answer is " + z);
}
}
}