Answered step by step
Verified Expert Solution
Question
1 Approved Answer
hi i need help with a school lab assignment! the instructions are in the word images and the code we received in bluej is copied
hi i need help with a school lab assignment! the instructions are in the word images and the code we received in bluej is copied and pasted below. lmk if you have any questions.
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. @author Ana Posada @author Scott Grissom @version February 20, 2018 ****************************************************************/ 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= 61 + over && speed 0) total = total + val; count++; }while(val > 0); return total / count; } /**************************************************************** Return a new String that has all occurence of character c removed. For exmample removeChar("Help!!!!", '!') returns "Help" @param str the initial String @param c the character to be removed from str @return the modified String @return the computed average of all positive numbers ****************************************************************/ public String removeChar(String str, char c){ String result = ""; int index = 0; while(index Lab 8 Debugging(1) - Compatibility Mode - Saved to my Mac Q Search In Document Home Insert Design Layout References Mailings Review Vievw Share P comments LD Paste Styles Hesding 3 Titie Subtie Emon.Emphasis Intensr Emo. CIS 162 Lab 8 Debugging Objectives Aer cumpleting this lab yuu shoul be able lo: indurrors in suneueels'scode Step 1: Create a New BlusJ Project Step 2: Download Debugging.java We creared a class aith several merhods that have some devius hugs! Creare a new clnss called telbugging and delete all of the starter cnde. Cut and paste the provided code from iugging-javain the newly cealed class. I should ccmpile with nu errurs. Step 3: Create a new class called Debugginglest Copy the rain pided ngging.jas pet you started. caught 3DAF d! nai) shoald have four tets. Therefore, vour test harness should have tifteen tests. STOP! Show Delbupging est to your instructor Fifteen errors should he identified when nmning n Page 1 of 2 290 wordsEnglish United Statrs) T Facus Lab 8 Debugging(1) - Compatibility Mode - Saved to my Mac Q Search In Document Home Insert Design Layout References Mailings Review Vievw ShareComments LD Paste Styles Hesding 3 Titie Subtie Emon.Emphasis Intensr Emo. Step 4: Start Debugging Use the debuging salegies dacribed in Clhapter 8 and in class. Each eror is quit.e as missing bas, wtong vaiabe ,ncoct cnlculatious ofoth such 1. Visally inspct tbe code 2. Sprinkle lempurary prinl stalemeols in ralegic localiuns 3. Use b udebugger Step 5: Test using a Book AFTICR all errors have been fixed I. Upload yoar improved Debugging.jeva file to the appmpriate Ch & ylab. 2. Fix remaining emosif any) ALL DONE? Show the zy.ab results to your instructor Send your completed code within a -mail (not attachment) to get credit for this lab. . Debugging'est.java. The ode sbould bewl decuenled. Grading Criteria Ihis lab is wotb a possible 1 poi. Page 1 of 2 290 wordsEnglish United Statrs) T Focus
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started