Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

Hello, for some reason I cannot get the code to run without errors.

Hello, for some reason I cannot get the code to run without errors.

Here is the error I get:

Screen Shot 2017-07-03 at 7.22.46 AM.png

HeadPhone.java
/**
* File: HeadPhone.java
* Date: June 26, 2017
* @author: Denisse Hernandez
* Purpose: HW 3 CMIS-141
*/
package headphone;
//class
public class HeadPhone {
//class variables
public static final int LOW = 1;
public static final int MEDIUM = 2;
public static final int HIGH = 3;
private int volume;
private boolean pluggedIn;
private String manufacturer;
private String headPhoneColor;
String currentVolume;
String statusPluggedIn;
String currentSetting;
//Default Constructor
public HeadPhone() {
volume = MEDIUM;
pluggedIn = false;
manufacturer = "DEFAULT";
headPhoneColor = "DEFAULT";
//Setters and getters
//volume
public void setVolume(int volume) {
this.volume = volume;
}
//PluggedIn
public void setPluggedIn(boolean pluggedIn) {
this.pluggedIn = pluggedIn;
}
//Manufacturer
public void setManufacturer(String manufacturer) {
this.manufacturer = manufacturer;
}
//HeadPhoneColor
public void setHeadPhoneColor(String headPhoneColor) {
this.headPhoneColor = headPhoneColor;
}
//Volume(get)
public int getVolume() {
if (volume == 1) {
currentVolume = "LOW";
} else if (volume == 2) {
currentVolume = "MEDIUM";
} else {
currentVolume = "HIGH";
}
return volume;
}
//PluggedIn(get) public boolean getPluggedIn() {
if (pluggedIn == true) {
statusPluggedIn = "plugged in";
} else {
statusPluggedIn = "disconnected";
}
return pluggedIn;
}
//Manufacturer(get)
public String getManufacturer() {
return manufacturer;
}
//HeadPhoneColor(get)
public String getHeadPhoneColor() {
return headPhoneColor;
}
//currentSetting(get)
public String getCurrentSetting() {
if (pluggedIn == false) {
currentSetting = "Currently not connected. Please plug into
device.";
} else if (pluggedIn == true && volume == 1) {
currentSetting = "Currently set to play yoga playlist";
} else if (pluggedIn == true && volume == 2) {
currentSetting = "Currently set to play kids playlist";
} else {
currentSetting = "Currently set to play workout playlist";
}
return currentSetting;
}
//changeVolume
public void changeVolume(int volume) {
setVolume(volume);
}
//toString
public String toString() {
int volume = this.getVolume();
boolean pluggedIn = this.getPluggedIn();
String manufacturer = this.getManufacturer();
String headphoneColor = this.getHeadPhoneColor();
String currentVolume = this.currentVolume;
String currentSetting = this.getCurrentSetting();
StringBuilder sb = new StringBuilder();
sb.append(String.format("Manufacturer: %s\n", manufacturer));
sb.append(String.format("Color: %s\n", headPhoneColor));
sb.append(String.format("Currently: %s\n", statusPluggedIn));
sb.append(String.format("Volume is set to: %s\n", currentVolume));
sb.append(String.format("%s\n", currentSetting));
return sb.toString();
}
}

Read more

 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"