Skip to main content
savannahs82895027
Participant
Sep 19, 2019 10:48 PM UTC
Answered

Help with a quick Java code debugging exercise.

Hello, all. I'm in a Java Programming I class with a Debugging Exercise 3-1. Right now, we're learning about methods, returns, classes, objects, etc. I have tried multiple ways to get this to execute properly, but I can't figure it out. I've played with the code so much that I don't remember any specific problems that I've had. 

 

This is the original code:

// This class calculates a waitperson's tip as 15% of the bill
public class DebugThree1
{
   public static void main(String args[])
   {
      double myCheck = 50.00;
      double yourCheck = 19.95;
      System.out.println("Tips are");
      calcTip(myCheck);
      calctip(yourcheck);
    }
    public void calcTip(double bill)
    {
       final double RATE = 0.15;
       double tip;
       tip = check * RATE;
       System.out.println("The tip should be at least " + tip);
    }
}

The current error messages say:

DebugThree1.java:9: error: non-static method calcTip(double) cannot be referenced from a static context
      calcTip(myCheck);
      ^
DebugThree1.java:10: error: cannot find symbol
      calctip(yourcheck);
              ^
  symbol:   variable yourcheck
  location: class DebugThree1
DebugThree1.java:16: error: cannot find symbol
       tip = check * RATE;
             ^
  symbol:   variable check
  location: class DebugThree1
3 errors
Error: Could not find or load main class DebugThree1



I have noticed the small typos included. 

This topic is closed to new replies. Start a new post to keep the conversation going.
BenPleysier
BenPleysierCorrect answer
Community Expert
Sep 20, 2019 12:56 AM UTC

You will find that not many contributors to this Dreamweaver forum will be able to find a solution to your Java problem. Nor should they because the answer needs to be supplied by you.

 

Having said that, have a look at https://github.com/mscoley169/school/blob/master/workspace/DebugThree1/src/edu/nashcc/c3dbg/DebugThree1.java

 

Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!

3 replies

Nancy OShea
Community Expert
Community Expert
Sep 20, 2019 5:10 PM UTC

JAVA  isn't as popular for web programming as it once was.  These days, DW doesn't support it.

 

Translate
Nancy O'Shea— Product User & Community Expert
BenPleysier
Community Expert
BenPleysierCommunity ExpertCorrect answer
Community Expert
Sep 20, 2019 12:56 AM UTC

You will find that not many contributors to this Dreamweaver forum will be able to find a solution to your Java problem. Nor should they because the answer needs to be supplied by you.

 

Having said that, have a look at https://github.com/mscoley169/school/blob/master/workspace/DebugThree1/src/edu/nashcc/c3dbg/DebugThree1.java

 

Translate
Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
savannahs82895027
Participant
Sep 20, 2019 12:59 AM UTC
Thanks you! I haven't seen that website before. Adobe is one of the only forums that has a response time that is DAYS faster than my professor's email replies.
Translate