• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Help with a quick Java code debugging exercise.

Community Beginner ,
Sep 19, 2019 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. 

TOPICS
Code , Error , How to , Other

Views

3.8K

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
community guidelines

correct answers 1 Correct answer

Community Expert , Sep 19, 2019 Sep 19, 2019

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

 

Votes

Translate

Translate
Community Expert ,
Sep 19, 2019 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...

 

Wappler, the only real Dreamweaver alternative.

Votes

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
community guidelines
Community Beginner ,
Sep 19, 2019 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.

Votes

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
community guidelines
Community Expert ,
Sep 20, 2019 Sep 20, 2019

Copy link to clipboard

Copied

LATEST

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— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

Votes

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
community guidelines