Java 프로그래밍 클래스를 작성하기 위해 코드를 작성하지 못하는 것 같습니다.1 개의 오류! "Main.java:30 : 오류 : 심볼을 찾을 수 없습니다."
/*Coby Bushong
Java Programming
Professor Lehman
August 9th 2014*/
import java.util.Scanner; // Needed for the Scanner class
/*This program will calculate the commission of a stock broker
at a 2% commission given the number of shares at a contant rate.*/
public class StockCommission
{
public static void main(String[] args)
{
//Constants
final double STOCK_VALUE = 21.77; //price per share
final double BROKER_COMMISSION = 0.02; //broker commission rate
//variables
double shares; //To hold share amount
double shareValue; //To hold total price of shares
double commission; //To hold commission
double total; //To hold total cost
//create scanner for keyboard input
Scanner Keyboard = new Scanner(System.in);
//creates dialog box for user input
String inputShares;
inputShares = JOptionPane.showInputDialog(null, "How many stocks do you own?");
shares = Integer.parseInt(inputShares);
//calculate total
shareValue = shares * STOCK_VALUE;
//calculate commission
commission = shareValue * BROKER_COMMISSION;
//calculate total
total = commission + shareValue;
//display results
System.out.println("Shares Owned:" + shares);
System.out.println("Value of Shares: $" + shareValue);
System.out.println("Comission: $" + commission);
System.out.println("Total: $" + total);
}
}
는이 오류 얻을 : 당신은 수입JOptionPane
클래스가
Errors: 1
StockCommission.java:30: error: cannot find symbol
inputShares = JOptionPane.showInputDialog(null, "How many stocks do you own?");
^
와일드 카드 가져 오기가 권장되지 않습니다. – chrylis