SophiaPretty

(5)

$14/per page/Negotiable

About SophiaPretty

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing Hide all
Teaching Since: Jul 2017
Last Sign in: 304 Weeks Ago, 2 Days Ago
Questions Answered: 15833
Tutorials Posted: 15827

Education

  • MBA,PHD, Juris Doctor
    Strayer,Devery,Harvard University
    Mar-1995 - Mar-2002

Experience

  • Manager Planning
    WalMart
    Mar-2001 - Feb-2009

Category > Computer Science Posted 16 Dec 2017 My Price 10.00

Description: This program creates a headphone class,

I have my code written but when it comes to the test java file Im receiving mistakes that I do not know how to fix. Can you help me. I had another tutor help but I could not understand their answer and they have not responded to me yet.

  • /**
    * Description: This program creates a headphone class,
     * constructors, getter and setter methods and
     * methods to set and return values
     */

    public class Headphones {

        //final types
       
       final static int Low = 1;
       final static int Medium = 2;
       final static int High = 3;
      

      
       //private types
      
       private int volume;
       private boolean pluggedIn = false;
       private String manufacturer;
       private String headphonecolor;
      
      
       //constructors
      
       public Headphones()
       {
       volume = Medium;
       pluggedIn = false;
       manufacturer = "Sony";
       headphonecolor = "black";
       }
      
       public Headphones(int Hvolume, boolean HpluggedIn,String Hmanufacturer, String Hheadphonecolor)
       {
           volume =Hvolume;
           pluggedIn = HpluggedIn;
           manufacturer = Hmanufacturer;
           headphonecolor = Hheadphonecolor;
       }
      
      
       //get methods
      
       public int getvolume()
       {
           System.out.println("Current volume level is "+volume);
           return volume;
       }
      
       public boolean getpluggedIn()
       {
           System.out.println("Plugged in status is "+pluggedIn);
           return pluggedIn;
       }
      
      
       public String getmanufacturer()
       {
           System.out.println("Current Maker is "+manufacturer);
           return manufacturer;
       }
      
       public String getheadphonecolor()
       {
           System.out.println("Current Color is "+headphonecolor);
           return headphonecolor;
       }
      
       //set methods
      
       public void setvolume(int Hvolume)
       {
       volume = Hvolume;
       }
      
       public void setpluggedin(boolean HpluggedIn)
       {
       pluggedIn = HpluggedIn;
       }
      
       public void setmanufacturer(String Hmanufacturer)
       {
       manufacturer = Hmanufacturer;
       }
      
       public void setheadphonecolor(String Hheadphonecolor)
       {
       headphonecolor = Hheadphonecolor;
       }
      
       //to string method
       public String tostring()
       {
        String str = "Volume level = " + volume + ". Plugged in status = " + pluggedIn
        + ". Headphone Manufacturer = " + manufacturer + ". Headphone color = " + headphonecolor;
        System.out.println(str);
       return str;
       }
      
       //change volume method
       public void changevolume(int Cvolume)
       {
       volume = Cvolume;
       }
        
      }

    /**
    * Description: This program creates a headphone class,
     * constructors, getter and setter methods and
     * methods to set and return values
     */
    package headphones;
    public class TestHP
    {
        public static void main(String[] args)
        {
            //default headphones made with default values
            Headphones headphone1 = new Headphones();
            headphone1.tostring();
            headphone1.getheadphonecolor();
            headphone1.getvolume();
            headphone1.getpluggedIn();
            headphone1.getmanufacturer();
           
            headphone1.setheadphonecolor("Pink");
            headphone1.setmanufacturer("HP");
            headphone1.setvolume(1);
            headphone1.setpluggedin(true);
           
            headphone1.tostring();
            headphone1.changevolume(Headphones.Medium);
            headphone1.tostring();
           
           
            //headphones made with certain values;
            Headphones headphone2 = new Headphones(3,true,"Bose","Blue");
            headphone2.tostring();
            headphone2.getheadphonecolor();
            headphone2.getvolume();
            headphone2.getpluggedIn();
            headphone2.getmanufacturer();
           
            headphone2.setheadphonecolor("yellow");
            headphone2.setmanufacturer("Acer");
            headphone2.setvolume(2);
            headphone2.setpluggedin(true);
            headphone2.tostring();
            headphone2.changevolume(Headphones.Low);
            headphone2.tostring();
           
            //headphones made with certain values;
            Headphones headphone3 = new Headphones(1,true,"Microsoft","white");
            headphone3.tostring();
            headphone3.getheadphonecolor();
            headphone3.getvolume();
            headphone3.getpluggedIn();
            headphone3.getmanufacturer();
           
            headphone3.setheadphonecolor("Purple");
            headphone3.setmanufacturer("Samsung");
            headphone3.setvolume(1);
            headphone3.setpluggedin(true);
            headphone3.tostring();
            headphone3.changevolume(Headphones.High);
            headphone3.tostring();
           
            //headphones made with default values;
            Headphones headphone4 = new Headphones();
           
            //getter method returns the current value and displays them
            headphone4.getheadphonecolor();
            headphone4.getvolume();
            headphone4.getpluggedIn();
            headphone4.getmanufacturer();
           
           
            //displays current value of all fields
            headphone4.tostring();
           
            //changes values of defaulted fields
            headphone4.setheadphonecolor("Green");
            headphone4.setmanufacturer("Newegg");
            headphone4.setvolume(1);
            headphone4.setpluggedin(true);
           
           
            //getter method retrieves current values and displays them
            headphone4.getheadphonecolor();
            headphone4.getvolume();
            headphone4.getpluggedIn();
            headphone4.getmanufacturer();
           
     
            //displays current value of all fields
            headphone4.tostring();
           
            //sets the private variable to the final variable of medium volume level
            headphone4.changevolume(Headphones.Medium);
           
            //displays current value
            headphone4.tostring();
           
           
        }



       
    }



Attachments:

Answers

(5)
Status NEW Posted 16 Dec 2017 02:12 PM My Price 10.00

-----------  ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly

Not Rated(0)