Highlighted

Help with a quick Java code debugging exercise.

Community Beginner ,
Sep 19, 2019

Copy link to clipboard

Copied

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. 

Adobe Community Professional
Correct answer by BenPleysier | Adobe Community Professional

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

 

TOPICS
Code, Error, How to, Other

Views

1.1K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Help with a quick Java code debugging exercise.

Community Beginner ,
Sep 19, 2019

Copy link to clipboard

Copied

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. 

Adobe Community Professional
Correct answer by BenPleysier | Adobe Community Professional

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

 

TOPICS
Code, Error, How to, Other

Views

1.1K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Sep 19, 2019 0
Adobe Community Professional ,
Sep 19, 2019

Copy link to clipboard

Copied

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/DebugThr...

 


Ben

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 19, 2019 1
Community Beginner ,
Sep 19, 2019

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 19, 2019 1
Adobe Community Professional ,
Sep 20, 2019

Copy link to clipboard

Copied

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

clipboard_image_0.png

 

Nancy O'Shea, ACP
Alt-Web Design & Publishing

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 20, 2019 0