Hey everyone,
Im working on passing a double input to a method by the following code:
//sales and sPerson Declaration double sales; sales = AnnualSales; Salesperson sPerson = new Salesperson(); sPerson.setSales(sales); //Output Total Commission System.out.println("\nYour Total Commission for the year is: $" + sPerson.getComm()); //Output Total Compensation System.out.println("Your Total Compensation for the year is: $"+ String.format("%.2f", sPerson.getAnnComp())+ "+\n"); //Output Table Headers System.out.println(" Total Sales Total Compensation" + "\n ________________________________________"); //UpperLimit Set: 150% int upperlimit = (int) ((AnnualSales/2)/5000); //Calculate Total Compensation in relevance with Total Sales for(int i=0;i<=upperlimit;i++){ System.out.println(" $"+ sales+" | " +"$"+String.format("%.2f", sales.getAnnComp())); *****REFERENCE ERROR IS HERE***** sales+=5000; } }
The getAnnComp method code is here:
public double getAnnComp () { TotalAnnComp = Fix_Sal + CommEarned; return TotalAnnComp; }
Any ideas? I'll continue working on a solution in the meantime. I can't just convert it to a string because the method used a double
Thanks,
- Deployment