Can no one figure this out?

I'm an infant learning to crawl with java. When I try to compile this it contains errors I haven't been able to eliminate. The instructions from the Prof. follow.
public class CyberPet{
public static void main(String args[]){
private boolean isEating;
private boolean isSleeping;
public CyberPet(int i, int j){(isEating = true, isSleeping = false);}
public void eat() {
eat = System.out.println("Pet is eating.");}
public void sleep() {
sleep = System.out.println("Pet is sleeping.");};
public class TestCyberPet{
public void main (String args[]){
CyberPet pet1= new CyberPet();
CyberPet pet2= new CyberPet();
pet1.eat();
pet1.sleep();
pet2.eat();
pet2.sleep();
In this Lab you will design and write a complete Object-Oriented Java Application. The program will simulate a CyberPet that responds to a simple commands. Write a class called CyberPet with two boolean private data members called isEating and isSleeping that are initialized to true and false respectively. Use overloaded constructor to initialize data members. The overloaded constructors should have none, one, and two arguments. The class has two methods. The first one is called eat() that will simply display the message "Pet is eating". The second method is called sleep() that displays the message "Pet is sleeping". Write another class that tests your CyberPet class called TestCyberPet. Inside this class create two objects called pet1 and pet2. For pet1 and pet2 call the two eat() and sleep() methods.

Write a class called CyberPet with two boolean private data members called isEating
and isSleeping that are initialized to true and false respectively. You don't initialize the variables.
Use overloaded constructor to initialize data members.
The overloaded constructors should have none, one, and two arguments. You only have one constructor. It takes two arguments. Stupid assignment does tell you what to do with the arguments, but I would use them to set the two variables.
The class has two methods. The first one is called
eat() that will simply display the message "Pet is eating". You are almost doing this. But why are you trying to set the variable? It doesn't say to set the variable. What you need to do is 'test' the variable. You would do this with a 'if'. If it is true then print "eating" if false then don't do anthing.
The second method is called sleep() that displays the message "Pet is sleeping". Same problem as other method. You are setting a variable - no need. Rather you need to test it.
Write another class that tests your CyberPet class called TestCyberPet. The way you have the classes defined these will have to be in different files. If you want them in the same file then the file MUST be called TestCyberPet and 'class CyberPet' MUST be private.
Inside this class create two objects called pet1 and pet2.
For pet1 and pet2 call the two eat() and sleep() methods.Seems like this part is ok.
Once you fix the above then run the compiler again. The compiler will tell you the exact line that a problem occurs on. If you can't figure out the problem with a line then repost your code AND the compile errors.

Similar Messages

  • Why can't any one figure this out!!!

    I am going insane racking my brain.  I have posted this in MANY different forums, including all over the place in here, and not only does no one understand whats going wrong but they have NO idea how to fix it.
    THIS IS WHAT I DID. I didn't realize I was using a rare font to make the menu in my website. The link is ShoresHatesMe.com its for a comedian who employed me to create it. So I made each menu item a small image and hyperlinked it to the appropriate page.
    In my preview in browser it looks perfect. so I posted it, and its all messed up on every page!
    Here is what the preview looks like in dreamweaver. This is how its supposed to look. Notice that you can see the full background behind the images.
    That is what I am trying to get it to look like. But when I posted it, it came out looking like this.
    The backrgound stops at the first menu item.
    I can't figure out whats going wrong here. But i keep trying to fix it and I can't figure it out! And since no one else can either its killing me. Even professionals that are HIRED to figure out why these things happen couldn't figure it out. I tried calling customer support over and over and I got excuse after excuse. I even had some one tell me on dreamweaver customer support that I must not be seeing things right because thats how its supposed to post??
    I dont' know whats going on but if some one could PRETTY PLEASE HELP ME! That'd be rad.

    Thank you. As much as I love copy/pasting URL's and reading irrelevant details like who it's for and why you're designing it it's easier to access and see if it's actually a link with a preceeding http:// to enable it as a clickable link in the forum.
    http://www.shoreshatesme.com
    Fix your validation errors and then we'll talk. You have tags that are not properly formatted.
    body has bg image as http://www.shoreshatesme.com/img/body.gif but, as you can see, the image is sliced. Put the full-height image as your bg image in body.

  • When I updated my Iphone my naviogon app was erased, and I can't figure which one I had purchased. Does anyone have any ideals how I can figure this out.

    When I updated my Iphone my naviogon app was erased, and I can't figure which one I had purchased. Does anyone have any ideals how I can figure this out.

    App Store > Updates > Purchased > Not On This iPhone.
    Should be in the list.
    tt2

  • WHY!!!!! I can't figure this out

    Why my girlfriend is getting the message that her "remote IP address is invalid" I can't seem to understand or figure this out...

    They should turn off Internet Sharing in System Preferences > Sharing if it is On
    Are either of you running Internet Sharing? If so, turn it off.
    They should not be letting Parallels connect using the Mac's IP if they run Parallels.
    Do either of you use Parallels Desktop or VMWare Fusion to run windows on you Mac? If so, turn off their access to the internet in their settings or preferences.
    They should not be connected to the Router via wireless (Airport card) and Wired (Ethernet) at the same time.
    Are either of you connected to both Ethernet port and Airport wireless at the same time. If so, disable one of the network configurations. Either unplug the cable or turn Airport off.
    They should not have two DHCP servers in a modem and router on their LAN.
    How are your router and modem configured. If they are both distributing IP addresses, then you need to either set your router to bridge mode or set the modem to assign just one IP address. I don't know what hardware you have, so I can't begin to tell you how to configure either. Unless it is an Airport Base Station, most modems and routers are configured through a Web interface. Airport Utility will let you configure the Airport Base Station.

  • How can I figure this out?

    Very simple function, but as a beginner, it's still difficult for me.
    my mouse wants to detect boxes on the canvas and return the center coordinate of these boxes, how can i figure this out? The game will be, if point(x,y) is inside a box , return box Center

    I just noticed that you are placing them on Canvas and it is not a container object. One solution would be to keep track of boundaries of those clickable areas and whenever a click occurs, a check which box was clicked, if any. I hope this helped.

  • Hello  I have a problem with Mac Pro, iPhoto does not want to stay open and close as I can figure this out?  thanks

    Hello  I have a problem with Mac Pro, iPhoto does not want to stay open and close as I can figure this out?  thanks

    Refer below link once
    App doesn’t open | Progress wheel spins continually

  • So i have an apple ipod touch 1st generation and it is not charging! It shows the charging sign but its taking a really long time to charge. Ive had it charging for at least 3 hours and it still says under 20% so can someone help me figure this out??

    So i have an apple ipod touch 1st generation and it is not charging! It shows the charging sign but its taking a really long time to charge. Ive had it charging for at least 3 hours and it still says under 20% so can someone help me figure this out??

    Not Charge
    - See:      
    iPod touch: Hardware troubleshooting
    iPhone and iPod touch: Charging the battery
    - Try another cable.
    - Try another charging source
    - Inspect the dock connector on the iPod for bent or missing contacts, foreign material, corroded contacts, broken, missing or cracked plastic.
    - Make an appointment at the Genius Bar of an Apple store.
      Apple Retail Store - Genius Bar 

  • Can't figure this out- cable connection vs wifi connection

    Can't figure this out: when my 13" MBP is connected wirelessly to my Airport base station, my iPad can see it. When I connect the MBP to the base station via ethernet cable (for faster connection), the iPad can no longer see it.
    Note: my airport is not connected to the internet. I'm simply wanting to setup a closed network for the iPad to connect to the MBP. There's nothing else on the network. The app on the iPad is locating the MBP by ip address so it must be a permanently assigned number.
    Message was edited by: Alan Schmidt

    Am having the same problem.
    Everything was working fine until yesterday.
    Now if I connect my iMac to the Extreme with Ethernet the Airport is not visible and I can't connect to the internet.
    iPods and iPhones can still use the wifi to get on the internet.
    If I switch the iMac to Airport it works, but, will not work with the Ethernet cable connected.
    Have tried changing ethernet cables and still no go.
    Can't figure this out.

  • Can't figure this out: locating a MBP on the same wifi network

    Can't figure this out: when my 13" MBP is connected wirelessly to my Airport base station, my iPad can see it. When I connect the MBP to the base station via ethernet cable (for faster connection), the iPad can no longer see it.
    Note: my airport is not connected to the internet. I'm simply wanting to setup a closed network for the iPad to connect to the MBP. There's nothing else on the network. The app on the iPad is locating the MBP by ip address so it must be a permanently assigned number.
    Message was edited by: Alan Schmidt

    Am having the same problem.
    Everything was working fine until yesterday.
    Now if I connect my iMac to the Extreme with Ethernet the Airport is not visible and I can't connect to the internet.
    iPods and iPhones can still use the wifi to get on the internet.
    If I switch the iMac to Airport it works, but, will not work with the Ethernet cable connected.
    Have tried changing ethernet cables and still no go.
    Can't figure this out.

  • I'm having issues loading Youtube on my MacBook Pro for about a week now.  I'm not sure if this is because of my computer or internet but my sister's PC loads Youtube completely fine.  Can someone help me figure this out?

    I'm having issues loading Youtube on my MacBook Pro for about a week now.  I'm not sure if this is because of my computer or internet but my sister's PC loads Youtube completely fine.  Can someone help me figure this out?

    Hi, I had been having the same problem for over a week, but both my window's HP and my 2011 macbook pro barely could load youtube.  What kind of router you have?  I was using a belkin play router that was only 8 months old, switched to a new AirPort Extreme Base Station and now everything works perfect.

  • In version 10.1 fcpx how do I edit in proxy, then when I am finished share with optimize footage? It was easy in 10.9 version, but I can't figure this out in 10.1, please help.

    in version 10.1 fcpx how do I edit in proxy, then when I am finished share with optimize footage? It was easy in 10.9 version, but I can't figure this out in 10.1, please help.

    The switch is in the upper right of the viewer.

  • Trying to renew my subscription and can't seem to figure this out, my plan doesn't need renewed until feb 2015 so its not giving me the option to manage my account. Creative cloud isn't giving taking the $ off my credit card why? The $ is on my credit car

    trying to renew my subscription and can't seem to figure this out, my plan doesn't need renewed until feb 2015 so its not giving me the option to manage my account. Creative cloud isn't giving taking the $ off my credit card why? The $ is on my credit card. Thank you.

    Log out of your Cloud account... Restart your computer... Log in to your Cloud account
    or
    Verify Account https://forums.adobe.com/thread/1465499 may help
    -Credit card https://helpx.adobe.com/utilities/credit-card.html

  • My Imovie continues to shut down every time i File-Import- then it pops up with everything i can import and right before im about to click on something it quits. I can't use my imovie until i figure this out, please help!

    My Imovie continues to shut down every time i File-Import- then it pops up with everything i can import and right before im about to click on something it quits. I can't use my imovie until i figure this out, please help!

    Thanks so much Meg. Unfortunately, iTunes is the program I use to perform syncing. I don't really have other outside options. It is also the location of the backup I would use to restore my phone, and my only way to reclaim important data. I am concerned that, since the last backup occurred when the "other" bar was only moderately huge (around 29G I think), that a backup would replicate the problem back onto my phone. 
    My contacts, etc. are all in address book and the calendar app on my Mac.  As far as I know, iTunes is the way to get them back, but iTunes is where the problem is. 
    Any thoughts on this?

  • Even a hired Flash Technician couldn't figure this out! (button/AS2/link issue)

    I bought a template online, same as half the people on here needing help. I managed most modifications myself and even some swag. But one of the links entitled "more" is correct on the first page but then in AS2 appears to be a duplicate on the 4th page. I want the one on the 4th page to link to an imported .png file. When you click a veiw more link an animation slides the page that is linked open. There are 8 working pages in the site 5 of which seem to be the core pages. I want to add a ninth page that is actually a .png file and have the "more" link link to it and animate to it. Can anyone help me figure this out. I've put in over 230 hours on this template and am feeling like it'll never get finished!!

    You should hire another Flash designer to help you figure it out... either that or go back to where you bought the template and see if they offer editing services for a fee.

  • Coldfusion unexplainable duplicate issues, cannot figure this out!

        So I've been fighting this for days.  I dont have the slightest idea where I can go from here.  I have your standard coldfusion insert queries set up to insert new data into the database.  Something along the lines of:
    Select * from table where tableuniqueID = Form.UniqueID  
    Cfif databasecheck.recordcount EQ 0, then insert new row with form.uniqueID as the uniqueID.  Well recently, its been throwing the generic Violation of PRIMARY KEY constraint 'PK__OLMS_Dat__9C04DA075F0A3F61'. Cannot insert duplicate key in object 'dbo.table'.
    I dont understand that in the slightest, the only way it inserts is if the query right above it is defined and equal to 0 recordcount.
    I did some tooling around, and found someone suggesting to insert into my SQL "IF NOT EXISTS" to have SQL do the actual check to see if data exists.  Well we put that in place, and just recently, ANOTHER duplicate happened, same error, cannot insert duplicate showing the new SQL structure.
    This is beyond me.  I have two statements checking to see if it exists and, yet, Coldfusion still tries to execute a database insert.  What is going on??  Any ideas?  You would figure this would be the basics.

    Hello.  I know it's been awhile but did you figure this out?  I have a very similar thing happening. Something along the lines of
    INSERT INTO WorkSheet (CODE_KEY)
    SELECT TOP (1) EI.CODE_KEY
    FROM EmpInfo AS EI  LEFT OUTER JOIN
    WorkSheet AS WS ON WS.CODE_KEY = EI.CODE_KEY
    WHERE (EI.CODE_KEY = 'param1') AND (WS.CODE_KEY IS NULL)
    where the field "CODE_KEY" is a the primary key in SQL Server 2008.  This is similar to what you're doing except that the check for an existing value happens as part of the insert query.  Just like you every once in awhile I get the "[Macromedia][SQLServer JDBC Driver][SQLServer]Violation of PRIMARY KEY constraint" error. I'd say I get one a week.
    The only hint I have is that there is an insert that succeeds.  This insert happens at the same time as the one that fails. That seems that the code is executing twice at the exact same time which seems impossible. In fact it seems to me that a second query would have to happen so fast that the join shows no value (otherwise I'd get records updated = 0 rather than the error) but then the first (successful) record is created prior to the 2nd one being inserted.

Maybe you are looking for

  • How do I get my iPhone iMessages to sync with my macbook pro iMessages?

    I don't get imessages on my macbook pro unless I start the conversation first. How can I get my iMessages to sync together?

  • What are 'Qualifier' in XML ???/

    Hi, I have, may be, a very basic question on XML. What are Qualifiers which i see in some of XML documents and how can we relate it to a oracle table column. for example in one of oracle Exchange XML i saw this: <OPERAMT qualifier="UNIT" type="T"> <O

  • Installing Acrobat on multiple computers?

    Hi, It appears the time has come in our small business to justify the need for Acrobat Standard.  My question is, if I pay for the full version, how many downloads are we allowed.  My small business uses only one computer but we have plans to update

  • Can CR 2008 integrate in BO Edge Series?

    Hi, i have an BO Edge series, and i wish to buy Crystal report 2008 to replace my older version of CR, can CR 2008 integrate with BO Edge Series? Thanks!

  • Forcing you to buy???

    Why can I only buy new release movies such as Prisoners and Thor. Why can't I rent them? This is a silly idea and will only push customers away to other sources.