Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

Create a Java class named HeadPhone to represent a headphone set. The class contains:
- Three integer constants named LOW, MEDIUM, and HIGH with values of 1, 2, and 3.
- A private int data field named volume that contains the volume setting of the headphone. The default value is HIGH.
- A private boolean data field named pluggedIn that specifies if the headphone is plugged in. The default value is false.
- A private String data field named manufacturer that specifies the name of the manufacturer of the headphones.
- A private Color data field named headPhoneColor that specifies the color of the headphones. This must be an object of the java.awt.Color class. (You will need to look up the features of this class.)
- A two-argument constructor that creates a HeadPhone object with specified manufacturer name and color, and default values for all other data fields.
- A method named toString() that returns a String object describing the current field values of the headphone.
- A method named changeVolume(int value) that changes the volume of the headphone to the value passed into the method. If the provided value is invalid, the volume shall not be changed.
- getter methods for all data fields, and setter methods for all data fields except manufacturer name and device color and volume. ()
(Note: It's not appropriate to provide "set" methods for the manufacturer and color because in the real world, manufacturer and color of a shipped product cannot be changed. Also, we don't want a "set" method for volume because that function is provided by the changeVolume method, which provides the needed input data validation.)
Create a TestHeadPhone main class to test the HeadPhone class. For each test, the necessary inputs shall be obtained from the tester (user). Each feature of the Headphone class shall be tested by comparing outputs from the getter methods to the required values. Test three different headphones. (Hint: put the test code in a loop.)
Use your IDE to accomplish this assignment.
Grading criteria are the same as for Assignments 1 and 2, and so are not restated here.
Submission requirements
Java Style:
- Header comments include filename, author, date, and brief description of the purpose of the program
- In-line comments as needed to explain any non-obvious code.
- Meaningful variable names and user prompts
- Class names in UpperCamelCase

Attachment:- Java code.rar

Java, Programming

  • Category:- Java
  • Reference No.:- M92405442
  • Price:- $35

Priced at Now at $35, Verified Solution

Have any Question?


Related Questions in Java

Question slideshows or carousels are very popular in

Question : Slideshows (or carousels) are very popular in websites. They allow web developers to display news or images on the website in limited space. In this code challenge, you are required to complete the JavaScript ...

Fundamentals of operating systems and java

Fundamentals of Operating Systems and Java Programming Purpose of the assessment (with ULO Mapping) This assignment assesses the following Unit Learning Outcomes; students should be able to demonstrate their achievements ...

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

Project requirementsfor the problem described in the next

Project requirements For the problem described in the next section, you must do the following: 1. include your student ID at the end of all filenames for all java code files. Three classes have been identified in section ...

Assessment database and multithread programmingtasktask 1

Assessment: Database and Multithread Programming Task Task 1: Grade Processing University grading system maintains a database called "GradeProcessing" that contains number of tables to store, retrieve and manipulate stud ...

Answer the following question whats the difference public

Answer the following Question : What's the difference public inheritance and private inheritance? What can derived classes inherit from base classes? What cannot be inherited from base classes?

Project descriptionwrite a java program to traverse a

Project Description: Write a java program to traverse a directory structure (DirWalker.java) of csv files that contain csv files with customer info. A simple sample in provided in with the sample code but you MUST will r ...

Assessment database and multithread programmingtasktask 1

Assessment: Database and Multithread Programming Task Task 1: Grade Processing University grading system maintains a database called "GradeProcessing" that contains number of tables to store, retrieve and manipulate stud ...

In ruby the hash class inherits from enumerable suggesting

In Ruby, the Hash class inherits from Enumerable, suggesting to a programmer that Hashes are collections. In Java, however, the Map classes are not part of the JCF (Java Collections Framework). For each language, provide ...

Assessment -java program using array of Assessment -JAVA Program using array of objects

Assessment -JAVA Program using array of objects Objectives This assessment item relates to the course learning outcomes as stated in the Unit Profile. Details For this assignment, you are required to develop a Windowed G ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As