Results 1 to 4 of 4
  1. #1
    hopper9119 is offline Member
    Join Date
    Apr 2017
    Posts
    2
    Rep Power
    0

    Default Cannot find symbol error

    I am having an issue with the following error. Any tips would be helpful:

    cannot find symbol

    symbol: method calculateTotalCompensation(double)
    location: variable Salesperson1 of type Salesperson1

    thus error is on line 39 and 34

    Java Code:
    import java.text.NumberFormat;
    import java.util.Locale;
    import java.util.Scanner;
    
    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
    /**
     *
     * @author hopper9119
     */
    public class Salesperson1 {
    
        public Salesperson1(double fixedSalary, double commissionRate) {
        }
    
        public static void main(String[] args) {
    
            NumberFormat numberFormat = NumberFormat.getCurrencyInstance(Locale.US);
    
            Scanner input = new Scanner(System.in);
    
            System.out.print("Enter sales: ");
            double sales = input.nextDouble();
    
            double fixedSalary = 32600;
            double commissionRate = 0.045;
            
            Salesperson1 Salesperson1 = new Salesperson1(fixedSalary, commissionRate);
    
            System.out.println("Total compensation: " + numberFormat.format(Salesperson1.calculateTotalCompensation(sales)));
    
            double maxSales = 1.50 * sales;
            double salesAmount = sales;
            System.out.println("Total Sales\t\tTotal Compensation");
            while (salesAmount <= maxSales) {
                System.out.println(numberFormat.format(salesAmount) + "\t\t"
                        + numberFormat.format(Salesperson1.calculateTotalCompensation(salesAmount)));
                salesAmount = salesAmount + 5000;
            }
        }
    
    }

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    13

    Default Re: Cannot find symbol error

    Your class is missing the method calculateTotalCompensation(double).

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  3. #3
    hopper9119 is offline Member
    Join Date
    Apr 2017
    Posts
    2
    Rep Power
    0

    Default Re: Cannot find symbol error

    How doi create that method and where would i put it?

  4. #4
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    13

    Default Re: Cannot find symbol error

    Read The Java Tutorials - classes. It discusses methods and their use.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

Similar Threads

  1. Error: cannot find symbol
    By ishi07 in forum New To Java
    Replies: 1
    Last Post: 05-24-2012, 05:30 AM
  2. 'error: cannot find symbol' please help
    By Bahirji Naik in forum New To Java
    Replies: 4
    Last Post: 12-21-2011, 08:03 AM
  3. Please help- Error: cannot find symbol
    By Avthar in forum New To Java
    Replies: 4
    Last Post: 02-28-2011, 07:34 AM
  4. Replies: 9
    Last Post: 10-18-2008, 08:26 PM
  5. 'Cannot find symbol' error
    By minihazard10 in forum New To Java
    Replies: 6
    Last Post: 10-10-2008, 04:05 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •