Question: import java.util.*; /**************************************************************** This class contains several methods with multiple logical errors. Although, it should compile with no errors. Create a new class called dubuggingTest

import java.util.*; /**************************************************************** This class contains several methods with multiple logical errors. Although, it should compile with no errors.
Create a new class called dubuggingTest that contains a single main() to test all methods. Create multiple tests for each method. Use the provided main() below as a start.
****************************************************************/ public class Debugging{ /** quantity on hand for sale */ private int inventory; /** constants used for convertion to farenheit temperatures */ private final double RATIO = 9 / 5; private final int BASE = 32; /****************************************************************** Copy this method to a new class called "debuggingTest" and add more tests for each method. ******************************************************************/ public static void main(String args[]){ Debugging bug1 = new Debugging(); if(bug1.calcAverage("10 20 30 -100") != 20.0){ System.out.println("ERROR: Average of 10, 20 and 30 should be 20.0"); } } /****************************************************************** Default constructor should set inventory to -1 ******************************************************************/ public Debugging(){ inventory = 0; } /****************************************************************** Alternative constructor should set inventory @param inventory amount to be assigned to the instance field ******************************************************************/ public Debugging(int inventory){ inventory = inventory; } /****************************************************************** Set inventory @param inventory amount to be assigned to the instance field ******************************************************************/ public void setInventory(int amount){ amount = inventory; } /****************************************************************** Get inventory @return the current inventory ******************************************************************/ public int getInventory(){ return inventory; } /****************************************************************** Calculate the 'base' raised to the 'exp' power For example, power(2, 4) should return 16 @param base the number to be raised @param exp the exponent @return a new number that represents base raised to the exp power. ******************************************************************/ public int power(int base, int exp){ int result = 0; for(int i=1; i }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
