1. Remove the errors, warnings and mistakes that are in the source code. 2. Modify the code so that: •one bean is created •one bean is counted •there is only one line in the main method
package debugging;
public class BeanCounter {
public static int beanCount = 0;
}
public class Bean {
public Color beanColor;
public String description;
public Bean(Color beanColor, String description){
this.beanColor = beanColor;
this.description = description;
}
}
public class Color {
double[] rgb;
double saturation;
public Color(double[] rgb, double saturation){
this.rgb = rgb;
this.saturation = 0.0;
}
}
public class Debugging {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
BeanCounter bc = new BeanCounter();
double[] redGreenBlue = {22.3d, 41.7d, 202.57d};
Color c = new Color(rgb, 22.44+0.05, 15.78, 79.53, 252.04);
++BeanCounter.beanCount;
Bean b = new FavaBean(c); // New bean created!
bc.beanCount++;
}
}
1. Remove the errors, warnings and mistakes that are in the source code.
2. Modify the code so that:
•one bean is created
•one bean is counted
•there is only one line in the main method
Trending now
This is a popular solution!
Step by step
Solved in 2 steps