import java.util.Scanner;
public class predictStockMarket {
public static void main(String args[]){
int openingPrice;
int currentPrice;
int numberOfStocks;
String buyOrSell;
Scanner number=new Scanner(System.in);
Scanner text=new Scanner(System.in);
System.out.println("What is the Opening Price? ");//Asking for the opening price
openingPrice=number.nextInt(); //storing into current price variable
System.out.println("What is the Current Price? ");//Asking for the Current Price
currentPrice=number.nextInt(); //storing into current price variable
System.out.println("Do you want to buy or sell? ");//Asking if they want to buy or sell
buyOrSell=text.nextLine();
if (buyOrSell.equalsIgnoreCase("buy")){
System.out.println("How many stock do you want to buy ");//Asking the user for hours per week
buyNumber=number.nextLine();
int i;
i = (buyNumber*currentPrice)-(openingPrice*buyNumber);
System.out.println(i);
}
else {
System.out.println("How many stock do you want to sell");
sellNumber=number.nextLine();
int i;
i = (sellNumber*currentPrice)-(openingPrice*sellNumber);
System.out.println(i);
}
Extremely confused, i thought putting a local variable would make it an integer. Using Jgrasp