r/javahelp • u/[deleted] • Jan 30 '13
Help please!
I keep getting an error stating "error: bad operand types for binary operator '-' " I don't know how to fix it. Here is my code:
/* Programmer name: Corey Kapanka Project name: Course, day and time: CIS1500, Wednesday 11:00AM Date of completion: 1/29/13 Purpose: Prints amount paid for stock, amount stock sold for, amount paid to stock broker when bought and sold, and the profit made*/
public class Stock { public static void main(String[] args) { int AmtStock; //Amount of Stock bought double PriceBought=32.87; double PriceSold=33.92; double AmtBroker=.02;
AmtStock=1000;
System.out.println("Joe paid $"+ AmtStock * PriceBought +" for the shares of stock.");
System.out.println("Joe sold his stock for $"+ AmtStock * PriceSold +".");
System.out.println("When Joe bought his stock he paid his broker $"+ AmtBroker * (AmtStock * PriceBought) +".");
System.out.println("When Joe sold his stock he paid his broker $"+ AmtBroker * (AmtStock * PriceSold) +".");
System.out.print("Joe made $"+ ((AmtStock * PriceSold) + (AmtBroker * (AmtStock * PriceSold)))-((AmtStock * PriceBought) + (AmtBroker * (AmtStock * PriceBought)))+".");
} //end method main} //end class Stock
1
Upvotes
1
u/TheHorribleTruth Kind of meh Jan 30 '13
This will help
Also, please read the sidebar before posting.