SilabGarza - RS Private Server  
Home Forum Play Register Store Market Highscores Mark Forums Read
Go Back   SilabGarza - RS Private Server > SilGar Media > Computers > Programming
Reload this Page [Java]Looking For Basic Exercises


[Java]Looking For Basic Exercises
Old
  (#1 (permalink))
Novus Anima is Offline
Senior Member
image
 
Novus Anima's Avatar
 
Posts: 317
Cookies Given: 37
Cookies Received: 29
Time Online: 4 d 20 h 37 m
   
Default [Java]Looking For Basic Exercises - 09-19-2012, 04:51 PM

Currently, I have only just started Java, but I am just about done with this chapter in my book. My plan is to experiment with class hierarchy, extensively, before I continue onto the next chapter. The book only has two exercises; the first being relatively simple and the second being a pretty decent hierarchy exercise. I'll post the exercise for #2 below in a quote, for a reference.

Quote:
Originally Posted by Exercise 2
Create an inheritance hierarchy for the pieces of a chess set. Decide where the instance variables color, startingPosition, forwardMovement, and sideMovement should be defined in the hierarchy.
Also, for those of you who are familiar with Java, I have code reference below so you can maybe suggest some things similar to what I have done thus far.

Code:
class VolcanoRobot {
    String status;
    int speed;
    float temperature;
    
    void checkTemperature() {
        if (temperature > 660) {
            status = "returing home";
            speed = 5;
        }
    }
    
    void show******utes() {
        System.out.println("Status: " + status);
        System.out.println("Speed: " + speed);
        System.out.println("Temperature: " + temperature);
    }
}
Code:
class VolcanoApplication {
    public static void main(String[] arguments) {
        VolcanoRobot dante = new VolcanoRobot();
        dante.status = "exploring";
        dante.speed = 2;
        dante.temperature = 510;
        
        dante.show******utes();
        System.out.println("Increasing speed to 3.");
        dante.speed = 3;
        dante.show******utes();
        System.out.println("Changing temperature to 670.");
        dante.temperature = 670;
        dante.show******utes();
        System.out.println("Checking the temperature.");
        dante.checkTemperature();
        dante.show******utes();
    }
}
Note: You don't need a programming background to help! All you need to do is supply me with an example scenario similar to the one described in the Exercise 2 quote.


“There is no small act of kindness. Every compassionate act makes large the world”
“People forget how fast you did a job – but they remember how well you did it”
  
Old
  (#2 (permalink))
Kayu10 is Offline
Loveless
image
 
Kayu10's Avatar
 
Posts: 5,196
Cookies Given: 3,080
Cookies Received: 527
Time Online: 45 d 10 h 7 m
   
Default 09-19-2012, 04:57 PM

Not to sure what your asking help with/ ideas for?

Otherwise i like what you've put down so far!


  
Old
  (#3 (permalink))
Novus Anima is Offline
Senior Member
image
 
Novus Anima's Avatar
 
Posts: 317
Cookies Given: 37
Cookies Received: 29
Time Online: 4 d 20 h 37 m
   
Default 09-19-2012, 05:28 PM

Quote:
Originally Posted by Kayu10 View Post
Not to sure what your asking help with/ ideas for?

Otherwise i like what you've put down so far!
As mentioned in the title, I am looking for some basic exercises. It can be anything so long as it's similar to the example in the beginning of my post.


“There is no small act of kindness. Every compassionate act makes large the world”
“People forget how fast you did a job – but they remember how well you did it”
  
Old
  (#4 (permalink))
atiaga is Offline
Love.
image
 
atiaga's Avatar
 
Posts: 637
Cookies Given: 54
Cookies Received: 11
Time Online: 15 d 10 h 26 m
Clan: Beryl Gang.
   
Default 09-19-2012, 05:33 PM

What book are you using right now?






  
Old
  (#5 (permalink))
Novus Anima is Offline
Senior Member
image
 
Novus Anima's Avatar
 
Posts: 317
Cookies Given: 37
Cookies Received: 29
Time Online: 4 d 20 h 37 m
   
Default 09-19-2012, 05:35 PM

Quote:
Originally Posted by atiaga View Post
What book are you using right now?
Sams TeachYourself Java 7 In 21 Days. Picked it up from Barnes and Nobles just yesterday. My dad is a computer programmer and the book basically got his stamp of approval, so it's pretty good.


“There is no small act of kindness. Every compassionate act makes large the world”
“People forget how fast you did a job – but they remember how well you did it”
  
adsense code2.3
Closed Thread

Bookmarks

[Java]Looking For Basic Exercises

Programming




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
adsense2.6
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7. The time now is 10:36 AM.





Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2017, vBulletin Solutions, Inc.