Question: Create a TestHeadPhone class that constructs at least 3 HeadPhone objects. For each of the objects constructed, demonstrate the use of each of the methods.

Create a TestHeadPhone class that constructs at least 3 HeadPhone objects. For each of the objects constructed, demonstrate the use of each of the methods. Be sure to use your IDE to accomplish this assignment.

i wrote this code but it has alot of bugs and can't seem to fix it. pls i need help

//Import required Java Class

public class TestHeadPhone {

public static void changeVolumeWithDefaultConstructor() {

HeadPhone headPhone = new HeadPhone();

System.out.println(headPhone);

printModel(headPhone);

headPhone.ChangeVolume(HeadPhone.VOLUME_LEVEL_HIGH);

}

public static void changeVolumeWithCustomConstructor() {

HeadPhone headPhone = new HeadPhone(HeadPhone.VOLUME_LEVEL_LOW, true, "Beats", "Black", " Studio3");

System.out.println(headPhone);

printModel(headPhone);

headPhone.ChangeVolume(HeadPhone.VOLUME_LEVEL_MEDIUM);

}

public static void changeVolumeWithCustomConstructorNotPlugged() {

HeadPhone headPhone = new HeadPhone(HeadPhone.VOLUME_LEVEL_HIGH, false, "Bose", "White", "Amorno");

System.out.println(headPhone);

printModel(headPhone);

headPhone.ChangeVolume(HeadPhone.VOLUME_LEVEL_MEDIUM);

}

public static void printModel(HeadPhone headPhone) {

System.out.println("Manufacturer: " + headPhone.getManufacturer());

System.out.println("Model: " + headPhone.getHeadPhoneModel());

System.out.println("Color: " + headPhone.getHeadPhoneColor());

System.out.println("Plugged In: " + (headPhone.isPluggedIn() ? "Yes" : "No"));

System.out.println("Current Volume: " + headPhone.getVolume() + " or " + headPhone.getHeadPhoneVolumeName(headPhone.getVolume()));

}

public static void main(String[] args) {

changeVolumeWithDefaultConstructor();

changeVolumeWithCustomConstructor();

changeVolumeWithCustomConstructorNotPlugged();

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!