I have a java code that i don't know what is the problem. could you help me? On"Stock testStock = new Stock();" I get an error message that says " Stockcannot be resolved to a type."
import java.util.Scanner;
/**
An application class to test Stock class
*/
public class StockTesting
{
public static void main (String[] args)
{
//Create an object belonging to the class Stock
Stock testStock = new Stock();
//Declare local variables
int inputNumberOfShares, outputNumberOfShares;
String inputTickerSymbol, outputTickerSymbol;
double inputDividend, outputDividend;
double outputYearlyDividend;
//Get input values
Scanner scannedInfo = new Scanner(System.in);
System.out.print("Enter numbers own, stock symbol"
+ " and dividend : ");
System.out.flush();
inputNumberOfShares = scannedInfo.nextInt();
inputTickerSymbol = scannedInfo.next();
inputDividend = scannedInfo.nextDouble();
System.out.println();
//Test mutator and accessor methods
testStock.setNumberOfShares(inputNumberOfShares);
testStock.setTickerSymbol(inputTickerSymbol);
testStock.setDividend(inputDividend);
outputNumberOfShares
= testStock.getNumberOfShares ();
outputTickerSymbol = testStock.getTickerSymbol();
outputDividend = testStock.getDividend();
System.out.println("Number of shares : " +
outputNumberOfShares);
System.out.println("Stock symbol is : " +
outputTickerSymbol);
System.out.println("Dividend per share is : " +
outputDividend);
//Test yearlyDividend method
outputYearlyDividend = testStock.yearlyDividend();
System.out.println("Yearly Dividend is : " +
outputYearlyDividend);
System.out.println();
//Test mutator and accessor methods
testStock.setNumberOfShares(inputNumberOfShares);
testStock.setTickerSymbol(inputTickerSymbol);
testStock.setDividend(inputDividend);
outputNumberOfShares
= testStock.getNumberOfShares ();
outputTickerSymbol = testStock.getTickerSymbol();
outputDividend = testStock.getDividend();
System.out.println("Number of shares : " +
outputNumberOfShares);
System.out.println("Stock symbol is : " +
outputTickerSymbol);
System.out.println("Dividend per share is : " +
outputDividend);
//Test yearlyDividend method
outputYearlyDividend = testStock.yearlyDividend();
System.out.println("Yearly Dividend is : " +
outputYearlyDividend);
System.out.println(testStock.toString());
}
}