Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Formal SQL Tuning For Oracle Databases Practical Efficiency Efficient Practice

Authors: Leonid Nossov ,Hanno Ernst ,Victor Chupis

1st Edition

3662570564, 978-3662570562

More Books

Students also viewed these Databases questions