У меня есть код, который я пишу только для удовольствия и помог мне ознакомиться с процессом. Я очень новичок в программировании на Java, поэтому, пожалуйста, несите меня.Как распечатать Java в окне
В настоящее время я просто пишу в Notepad ++ и компилирую в командной строке, но я хотел бы узнать, как скомпилировать и распечатать мой вывод в окне, а не распечатывать его в командной строке.
public class SalesCalculations {
public static void main (String args[]){
//This section is shirt sales calculations
int shirtCost;
shirtCost = 12;
int shirtSales;
shirtSales = 200;
int shirtSalePrice;
shirtSalePrice = 25;
int shirtMakeCost;
shirtMakeCost = shirtCost * shirtSales;
int shirtSaleTotal;
shirtSaleTotal = shirtSalePrice * shirtSales;
int shirtProfit;
shirtProfit = shirtSaleTotal - shirtMakeCost;
System.out.println("");
System.out.println("Cost to make Shirt: " + "$" + shirtCost);
System.out.println("Sales Price of Shirt: " + "$" + shirtSalePrice);
System.out.println("Number of Shirt sales: " + shirtSales);
System.out.println("This months Shirt making price: " + "$" + shirtMakeCost);
System.out.println("Shirt sales money this month: " + "$" + shirtSaleTotal);
System.out.println("Profit of Shirts: " + "$" + shirtProfit);
System.out.println("");
}
}
Любая помощь или руководство будет принята с благодарностью!
вы можете использовать класс JOptionPane https://docs.oracle.com/javase/7/docs/api/javax/swing/JOptionPane .html, например 'JOptionPane.showMessageDialog (null," Cost to make Shirt: "+" $ "+ shirtCost);' –