3 Replies - 2186 Views - Last Post: 29 April 2011 - 06:07 AM Rate Topic: -----

#1 balanta  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 57
  • Joined: 01-March 11

OOP, Virtual Basketball

Posted 28 April 2011 - 12:29 PM

Hello guys, I have started learning OOP a few days ago and now I have to do a virtual basketball game. I have the code but I also have an err C:\j2sdk1.4.2_10\bin>javac BasketballTester.java
BasketballTester.java:38: cannot resolve symbol
symbol : variable our
location: class java.lang.System
System.our.println(team + ", from " + name + " " + "who is number " + numb
er + " " + "the ball.");
^
1 error

Here is the code:

/*This program simulates a virtual basketball game.
 *In this program there are two classes. A Basketball class and a tester class.
 *Also the program includes a team, a player and his shirt number.
*/

class Basketball
{
   // variables
   String team;
   String name;
   int number;
   
   // initialize the variables
   Basketball(String playerTeam, String playerName, int playerNumber)
     {
       team = playerTeam;
       name = playerName;
       number = playerNumber;
     }

   // method
   void dribbleBasketball()
   {
      System.out.println(team + ", from " + name + " " + "who is number " + number + " " + "dribble the ball. ");
   } 
 // method2
   void shootBasketball()
   {
      System.our.println(team + ", from " + name + " " + "who is number " + number + " " + "shoot the ball. ");
   } 

 } 



   // here is the main class, whose purpose is to test the second class, the Basketball class 
   public class BasketballTester
   {
     // starts the program
     public static void main(String[] args)
     {
       Basketball player1 = new Basketball("Shaquille O'Neal", "Boston Celtics", 36);
     
       Basketball player2 = new Basketball("Troy Murphy", "Boston Celtics", 30);
    
       Basketball player3 = new Basketball("Pau Gasol", "Lakers", 16);

       Basketball player4 = new Basketball("Luke Walton", "Lakers", 40);
  
       Basketball player5 = new Basketball("Carlos Arroyo", "Boston Celtics", 45);

     // applies the dribbleBasketball() method
     player1.dribbleBasketball();
     player1.shootBasketball();
     player2.dribbleBasketball();
     player5.shootBasketball();
     player3.dribbleBasketball();
     player3.shootBasketball();
     player4.shootBasketball();
  
    }
 }

THX in advance!!! :)

This post has been edited by balanta: 28 April 2011 - 12:30 PM


Is This A Good Question/Topic? 0
  • +

Replies To: OOP, Virtual Basketball

#2 mi14chal  Icon User is offline

  • D.I.C Head

Reputation: 81
  • View blog
  • Posts: 202
  • Joined: 11-December 10

Re: OOP, Virtual Basketball

Posted 28 April 2011 - 12:43 PM

Not System.our.println only: System.out.println
Was This Post Helpful? 4
  • +
  • -

#3 CasiOo  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 1428
  • View blog
  • Posts: 3,172
  • Joined: 05-April 11

Re: OOP, Virtual Basketball

Posted 28 April 2011 - 12:43 PM

29 System.our.println


'our' should be 'out' ;)
Was This Post Helpful? 3
  • +
  • -

#4 balanta  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 57
  • Joined: 01-March 11

Re: OOP, Virtual Basketball

Posted 29 April 2011 - 06:07 AM

Ok thx, I fixed sys.out.println. It works now THX again!!! :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1