Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

There are two debugs here that need fixed and that is why I am offering such a h

ID: 3547781 • Letter: T

Question

There are two debugs here that need fixed and that is why I am offering such a high number of points. I will award the points once I test and run the corrected debugs if they work right I will award points right away.


1. // 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 static int calcTip(int bill)

    {

      final double RATE = 0.15;

      tip = bill + RATE;

      System.out.println("The tip should be at least " + tip);

    }

}


2. // This application displays some math facts

public class DebugThree2

{

   public static void main(String args[])

   {

      int a = 2, b = 5, c = 10;

      add = a + b;

      add = b + c;

      subtract = c -b;

   }

   public static void add()

   {

      System.out.println("The sum of " + a +

         and + b + is + a + b);

   }

   public static void subtract()

   {

      System.out.println("The difference between " +

        a + and + b + is + a - b);

   }

}

Explanation / Answer

1. // This class calculates a waitperson's tip as 15% of the bill



public class DebugThree1 {
    public static void calcTip(double bill){

    final double RATE = 0.15;
    double tip;
    tip = bill + RATE;

    System.out.println("The tip should be at least " + tip);
   

}

    public static void main(String[] args) {
        double myCheck = 50.00;

        double yourCheck = 19.95;

        System.out.println("Tips are");

        calcTip(myCheck);

        calcTip(yourCheck);

        }

}


2. // This application displays some math facts


public class DebugThree2 {
       
    public static void add(int a,int b){
    System.out.println("The sum of " + a + " and " + b + " is " + (a + b));
    }
   
    public static void subtract(int a,int b){
    System.out.println("The difference between " + a + " and " + b + " is " + (a - b));
    }
    public static void main(String[] args) {
        int a = 2, b = 5, c = 10;
        add( a , b);
        add (b ,c);
        subtract( c ,b);
        }       

    }