6 Replies - 652 Views - Last Post: 26 April 2011 - 08:09 PM Rate Topic: -----

#1 frenchy197032  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 24-April 11

Error - can not find symbol

Posted 26 April 2011 - 03:36 PM

I can not find the error I made. I get the error: java54 can not find symbol. I believe I need another set of eyes.

thank you,
Donna


import java.util.*;

public class FinalExam
{
  //globally declare variables
  private String cusName; // not empty
  private String procedure; // 3 types
  private int quantity; // >=1
  private boolean insurance; 
  private double procedureCost;
  private double insuranceDiscount;
  private double totalBill; // calc = procedure * quantity
  Scanner keyboard = new Scanner(System.in);
  
  public FinalExam() // Default Constructor
  {
    cusName = " ";
    procedure = " ";
    quantity = 0;
    insurance = false;
    totalBill = 0.0;
    insuranceDiscount = 0.0;
    procedureCost = 0.0;
  }
  
  //Non-default constructor
  public FinalExam (String inCusName,
                    String inProcedure,
                    int inQuantity,
                    boolean inInsurance,
                    double procedureCost,
                    double insuranceDiscout,
                    double inTotalBill)
    
  {
    //Declare variables for Non-default constuctors's user input
    boolean choice = false;
    String input = " ";
    
    //Set cusName
    setCusName (inCusName);
    while (choice == false)
    {
      System.out.println ("Enter customer's name:");
      input = keyboard.next();
      choice = setCusName(input);
    }
    //Set procedure
    setProcedure (inProcedure);
    while (choice ==false)
    {
      System.out.println ("Choose one of the following procedures: Cleaning, Filling, RootCanal");
      input = keyboard.next();
      choice = setProcedure(input);
    }
    //Set quantity
    setQuantity (inQuantity);
    while (quantity < 1)
    {
      quantity = inQuantity;
        System.out.println ("Enter the quantity of procedure performed");
        quantity = keyboard.nextInt();
    }
    //Set Insurance
    setInsurance (inInsurance);
    
  } //End of Non-default Constructor
  
  //Mutators
  
  public boolean setCusName (String name)
  {
    if (name !=null)
    {
      cusName = name;
      return true;
    }
    else
    {
      return false;
    }
  }
      
   public boolean procedure (String procd)
   {
     if (procd.equalsIgnoreCase ("Cleaning")) 
     {
       procedure = procd;
       double procedureCost = 60;
       return true;
     }
     else if (procd.equalsIgnoreCase ("Filling"))
     {
       procedure = procd;
       double procedureCost = 75;
       return true;
     }
     else if (procd.equalsIgnoreCase ("Root Canal"))
     {
       procedure = procd;
       double procedureCost = 89;
       return true;
     }
           
     else 
     {
       return false;
     }
   }
   
   public void setQuantity (int quant)
   {
     quantity = quant;
   }
   
   public boolean setInsurance (boolean insur)
   {
     if (insur == true)
     {
       insurance = insur;
       double insuranceDiscount = .20;
       return true;
     }
     else
     {
       return false;
     }
   }
   
   public double calcTotalBill()
   {
     totalBill = procedureCost * quantity * insuranceDiscount;
     return totalBill;
   }
   
   //Get Methods
   
   public String getCusName()
   {
     return cusName;
   }
   public String getProcedure()
   {
     return procedure;
   }
   public int getquantity()
   {
     return quantity;
   }
   public boolean getInsurance()
   {
     return insurance;
   }
   public double getTotalBill()
   {
     return totalBill;
   }
   
   //Class Display
   public void display()
   {
     System.out.println ("Customer Name: ");
     System.out.println ("Procedure was: ");
     System.out.println ("Quantity was: ");
     System.out.println ("Is there insurance? ");
     System.out.println ("The total bill is: $");
   }
}


Is This A Good Question/Topic? 0
  • +

Replies To: Error - can not find symbol

#2 Brewer  Icon User is offline

  • Awesome
  • member icon

Reputation: 179
  • View blog
  • Posts: 1,044
  • Joined: 14-June 10

Re: Error - can not find symbol

Posted 26 April 2011 - 03:47 PM

I don't see a setProcedure() method anywhere but you reference it on lines 49 and 54. Perhaps that is the problem. Post the error message in its entirety and we'll be better able to help you out.
Was This Post Helpful? 0
  • +
  • -

#3 frenchy197032  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 24-April 11

Re: Error - can not find symbol

Posted 26 April 2011 - 03:55 PM

View PostBrewer, on 26 April 2011 - 03:47 PM, said:

I don't see a setProcedure() method anywhere but you reference it on lines 49 and 54. Perhaps that is the problem. Post the error message in its entirety and we'll be better able to help you out.


Here is the complete error message (sorry I'm new to this).
2 errors found:
File: H:\Final Exam\FinalExam.java [line: 49]
Error: H:\Final Exam\FinalExam.java:49: cannot find symbol
symbol : method setProcedure(java.lang.String)
location: class FinalExam
File: H:\Final Exam\FinalExam.java [line: 54]
Error: H:\Final Exam\FinalExam.java:54: cannot find symbol
symbol : method setProcedure(java.lang.String)
location: class FinalExam
Was This Post Helpful? 0
  • +
  • -

#4 Brewer  Icon User is offline

  • Awesome
  • member icon

Reputation: 179
  • View blog
  • Posts: 1,044
  • Joined: 14-June 10

Re: Error - can not find symbol

Posted 26 April 2011 - 03:59 PM

The confirms what I said in my last post. Your program does not have a setProcedure() method, you'll have to create the method.
Was This Post Helpful? 1
  • +
  • -

#5 frenchy197032  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 24-April 11

Re: Error - can not find symbol

Posted 26 April 2011 - 04:08 PM

I have it set above where I set the rest of my methods

//Set procedure
    setProcedure (inProcedure);
    while (choice ==false)
    {
      System.out.println ("Choose one of the following procedures: Cleaning, Filling, RootCanal");
      input = keyboard.next();
      choice = setProcedure(input);
    }

Was This Post Helpful? 0
  • +
  • -

#6 Brewer  Icon User is offline

  • Awesome
  • member icon

Reputation: 179
  • View blog
  • Posts: 1,044
  • Joined: 14-June 10

Re: Error - can not find symbol

Posted 26 April 2011 - 04:14 PM

You don't define a setProcedure() method there. You do, however, try to call it twice, which you can't do since the method doesn't exit.
Was This Post Helpful? 0
  • +
  • -

#7 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8334
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: Error - can not find symbol

Posted 26 April 2011 - 08:09 PM

you have the following methods:
- setQuantity()
- setInsurance()

but no setProcedure() method... you have a procedure() method thow :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1