Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Java Linux OOP
Hi
 
I would like to Ask a Question about compiling an OOP Java application.
 

Below is a Class Called ComputerGame.java which holds Game Details.
 
 
package OOP;
 
public class ComputerGame
{
	private String Name;
	private String Description;
	private float Cost;
	private boolean Released;
	private final String Publisher = "TriWorld Studios";
	
	public ComputerGame(String Name)
	{
		Name = this.Name;
	}
	
	public ComputerGame(String Name, float  Cost)
	{
		Name = this.Name;
		Cost = this.Cost;
	}
	
	public static void Buy()
	{
		System.out.println(" The Buy Method ");
	}
	
	public static void Play()
	{
		
		System.out.println(" The Play Method ");
	}
	
	public static void Store()
	{	
		System.out.println(" The Store Method ");
	}
	
	public static void Sell()
	{
		System.out.println(" The Sell Method ");
	}
	
	
	
	public String GetName()
	{
		return Name;
	}
	
	public String GetDescription()
	{
		return Description;
	}
	
	public float GetCost()
	{
		return Cost;
	}
	
	public boolean GetReleased()
	{
		return Released;
	}
	
	
	public void SetName(String Name)
	{
		Name = this.Name;
	}
	
	public void SetDescription(String Description)
	{
		Description = this.Description;
	}
	
	public void SetCost(float Cost)
	{
		Cost = this.Cost;
	}
	
	public void SetReleased(boolean Released)
	{
		Released = this.Released;
	}
	
	
	
	
}
 
 
Below is the Main Class which is supposed to create an Object of type Computer Game
 
 

package OOP;
 
public class ComputerGameMain
{
	public static void main(String[] args)
	{
		ComputerGame FierceArmour 		= 		new ComputerGame("Fierce Armour", "A Strategy Game");
		ComputerGame Tennis3D 			= 		new ComputerGame("Tennis 3D", "A Sports Game");
		ComputerGame TwoDCarton 		= 		new ComputerGame("2DCarton", "An Arcafe Game");
		
		FierceArmour.setCost(56.45);
		FierceArmour.setReleased(true);
 
		Tennis3D.setCost(76.34);
		Tennis3D.setReleased(false);
		
		TwoDCarton.setCost(23.99);
		TwoDCarton.setReleased(true);
	}
}
 

 
I am using a Text Editor to create this Application ( Geany ).
 
I Would like to know ho to link the CoumputerGame Class to the Main Class and how to compile these using javac or any other compiler.
 
Thank You,
 
Andrew Borg
Posted 4-Nov-12 6:16am
Comments
Sergey Alexandrovich Kryukov at 4-Nov-12 11:54am
   
As there is no even a tiny bit of OOP in this code, it's not clear what you are asking about.
--SA
pasztorpisti at 4-Nov-12 13:28pm
   
I have a guess, but I don't like guessing... :-)
Sergey Alexandrovich Kryukov at 4-Nov-12 13:48pm
   
I also don't like guess, even in cases I'm pretty sure what it is. OP needs to go through exact recognition of his problem first, otherwise the answer is not really useful.
--SA
pasztorpisti at 4-Nov-12 13:24pm
   
You started programming before learning how to program. I recommend the reverse order, first learn how to use java and then start using it. Here is the official tutorial: http://docs.oracle.com/javase/tutorial/.
Read everything that is inside the "Trails Covering the Basics" paragraph (its quite short) and after it you won't ask questions like this. I recommend compiling the program without Eclipse or Netbeans for the first time. Don't misunderstand, those IDEs are great but you should understand whats goin on under the hood.
Sergey Alexandrovich Kryukov at 4-Nov-12 13:49pm
   
Good point! This the real background of it.
My 5. :-)
--SA
pasztorpisti at 4-Nov-12 14:09pm
   
Thank you! :-)
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You should use Eclipse or Netbeans as a IDE for programming.
Both are free and will guide you through development and both can also make the build for you.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 490
1 Maciej Los 299
2 BillWoodruff 174
3 /\jmot 170
4 Suraj Sahoo | Coding Passion 150
0 OriginalGriff 8,484
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,639
3 Maciej Los 5,159
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web02 | 2.8.1411023.1 | Last Updated 4 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100