Question
Why doesn't this code compile for this assignment??? Guitar Class: public class Guitar { public static final int LOW = 1; public static final int
Why doesn't this code compile for this assignment???
Guitar Class:
public class Guitar { public static final int LOW = 1; public static final int MEDIUM = 2; public static final int HIGH = 3; private int volume; private double price; private String manufacturer; private String guitarColor; Guitar(){ volume = MEDIUM; price = 0.0; manufacturer = "DEFAULT"; guitarColor = "DEFAULT"; } public void setVolume(int v){ if(v HIGH){ volume = HIGH; } else{ volume = v; } } public void setPrice(double p){ price = p; } public void setManufacturer(String m){ manufacturer = m; } public void setColor(String C){ guitarColor = C; } public int getVolume(){ return volume; } public double getPrice(){ return this.price; } public String getManufacturer(){ return this.manufacturer; } public String getColor(){ return this.guitarColor; } public void changeVolume(int volume){ setVolume(volume); } public String toString(){ return String.format("Volume: %d Price: %.2f Manufacturer: %s Color: %s", volume, price, manufacturer, guitarColor); }
}
Test Class:
public class TestGuitar { public static void main(String args[]){ Guitar devices[] = new Guitar[3]; for(int i = 0; i
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