Im trying to add an if else statement so when the profit is negative it tells them its a negative profit and when its positive it tells them its positive. Where would i put the if else statement and how would i format so it works.
import java.util.Scanner;
class Assignment2
{
public static void main(String[] args) //header of the main method
{
Scanner in = new Scanner(System.in);
String First;
String Last;
String StockCode;
double ShareNumber;
double StockBuy;
double StockSell;
final double charge =.02;
System.out.println("Enter your First name");
First = in.nextLine();
System.out.println("Enter your Last name");
Last = in.nextLine();
System.out.println("Enter the stock code");
StockCode = in.nextLine();
System.out.println("How much did the stocks cost?");
StockBuy = in.nextInt();
System.out.println("How many shares did you buy?");
ShareNumber = in.nextInt();
System.out.println("Customer Name:" + First.toUpperCase() + ' ' + Last.toUpperCase());
System.out.println("Stock Code:" + StockCode );
System.out.println("Stock Cost:" + ((StockBuy * charge) + (ShareNumber*StockBuy)));
}
}