<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>Java Programming Forums - The Java Community - Object Oriented Programming</title>
		<link>http://www.javaprogrammingforums.com/</link>
		<description>Classes, Objects, Methods, Inheritance..</description>
		<language>en</language>
		<lastBuildDate>Wed, 22 May 2013 21:22:19 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://www.javaprogrammingforums.com/images/misc/rss.png</url>
			<title>Java Programming Forums - The Java Community - Object Oriented Programming</title>
			<link>http://www.javaprogrammingforums.com/</link>
		</image>
		<item>
			<title>Can a method be an abstract method without specifically declaring it is abstract?</title>
			<link>http://www.javaprogrammingforums.com/object-oriented-programming/29543-can-method-abstract-method-without-specifically-declaring-abstract.html</link>
			<pubDate>Mon, 20 May 2013 01:21:46 GMT</pubDate>
			<description>An abstract method is a method that has no body. If a method was declared as public Push push(); within an abstract class would it be abstract...</description>
			<content:encoded><![CDATA[<div>An abstract method is a method that has no body. If a method was declared as public Push push(); within an abstract class would it be abstract because it has no body?</div>

]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/object-oriented-programming/">Object Oriented Programming</category>
			<dc:creator>EDale</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/object-oriented-programming/29543-can-method-abstract-method-without-specifically-declaring-abstract.html</guid>
		</item>
		<item>
			<title>java programming</title>
			<link>http://www.javaprogrammingforums.com/object-oriented-programming/29535-java-programming.html</link>
			<pubDate>Sun, 19 May 2013 18:04:43 GMT</pubDate>
			<description>I am wanting a program that I can put account details into to open up accounts to many yellowpage directory sites. Then I would like to put in...</description>
			<content:encoded><![CDATA[<div>I am wanting a program that I can put account details into to open up accounts to many yellowpage directory sites. Then I would like to put in business information, pictures, website, social website links and videos if the directory allows it to submit the business information to all the yellowpage directory sites</div>

]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/object-oriented-programming/">Object Oriented Programming</category>
			<dc:creator>tahsan007</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/object-oriented-programming/29535-java-programming.html</guid>
		</item>
		<item>
			<title>Creating an exception class</title>
			<link>http://www.javaprogrammingforums.com/object-oriented-programming/29521-creating-exception-class.html</link>
			<pubDate>Sat, 18 May 2013 03:36:56 GMT</pubDate>
			<description>I had to make two classes that search a String array for specific words, and a ItemNotFoundException class. I do not think the exception class is...</description>
			<content:encoded><![CDATA[<div>I had to make two classes that search a String array for specific words, and a ItemNotFoundException class. I do not think the exception class is working correctly though. I am not completely sure though because I am unsure of what the final outcome should in fact be.<br />
<br />
Driver:<br />
<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><div class="" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Scanner;
&nbsp;
public class HW5Driver {
&nbsp;
	public final static String FILE_AND_PATH = &quot;longwords.txt&quot;;
	/* 
	 * TODO: Be sure to change the FILE_AND_PATH to point to your local 
	 * copy of longwords.txt or a FileNotFoundException will result
	 */	
&nbsp;
&nbsp;
	//Note how we deal with Java's Catch-or-Declare rule here by declaring the exceptions we might throw
	public static void main(String&#91;&#93; args) throws FileNotFoundException {
		Scanner input = new Scanner(new File(FILE_AND_PATH));
		int wordCount = 0;
		ArrayList&lt;String&gt; theWords = new ArrayList&lt;String&gt;();
&nbsp;
		//read in words, count them
		while(input.hasNext())  {
			theWords.add( input.next() );
			wordCount++;
		}
&nbsp;
		//make a standard array from an ArrayList
		String&#91;&#93; wordsToSearch = new String&#91;theWords.size()&#93;;
		theWords.toArray(wordsToSearch);
&nbsp;
&nbsp;
&nbsp;
		//start with the linear searches
		tryLinearSearch(wordsToSearch, &quot;DISCIPLINES&quot;);
		tryLinearSearch(wordsToSearch, &quot;TRANSURANIUM&quot;);
		tryLinearSearch(wordsToSearch, &quot;HEURISTICALLY&quot;);
		tryLinearSearch(wordsToSearch, &quot;FOO&quot;);
&nbsp;
		//and compare these results to the binary searches
		tryBinarySearch(wordsToSearch, &quot;DISCIPLINES&quot;);
		tryBinarySearch(wordsToSearch, &quot;TRANSURANIUM&quot;);
		tryBinarySearch(wordsToSearch, &quot;HEURISTICALLY&quot;);
		tryBinarySearch(wordsToSearch, &quot;FOO&quot;);
&nbsp;
	}
&nbsp;
	/**
	 * Method tryBinarySearch
	 * precondition: wordsToSearch is a nonempty array of Strings, and target is a non-null string to search for 
	 * 				 in our collection of strings
	 * postcondition: Uses a BinarySearch object (which implements this style of search) to try to find the target string
	 */
	private static void tryBinarySearch(String&#91;&#93; wordsToSearch, String target) {
		//Todo: Build a LinearSearch class that inherits from SearchAlgorithm, and put it in the same directory as this class to successfully compile
		SearchAlgorithm bs = new BinarySearch();
&nbsp;
		try {
			System.out.print( target + &quot; found at index: &quot; + bs.search(wordsToSearch,target));
			System.out.println( &quot; taking &quot; + bs.getCount() + &quot; comparisons.&quot;);
		} 
		catch( ItemNotFoundException e ) {
			System.out.println( target + &quot;:&quot; + e.getMessage());
		}	
	}
&nbsp;
	/**
	 * Method tryLinearSearch
	 * precondition: wordsToSearch is a nonempty array of Strings, and target is a non-null string to search for 
	 * 				 in our collection of strings
	 * postcondition: Uses a LinearSearch object to try to find the target string
	 */
	private static void tryLinearSearch(String&#91;&#93; wordsToSearch, String target) {
		//Todo: Build a LinearSearch class that inherits from SearchAlgorithm, and put it in the same directory as this class to successfully compile
		SearchAlgorithm bs = new LinearSearch();
&nbsp;
		try {
			System.out.print( target + &quot; found at index: &quot; + bs.search(wordsToSearch,target));
			System.out.println( &quot; taking &quot; + bs.getCount() + &quot; comparisons.&quot;);
&nbsp;
		} 
		catch( ItemNotFoundException e ) {
			System.out.println( target + &quot;:&quot; + e.getMessage());
		}	
	}
&nbsp;
}</pre></div></code><hr />
</div> <br />
<br />
ItemNotFoundException class:<br />
<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><div class="" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">public class ItemNotFoundException extends Exception{
&nbsp;
    public ItemNotFoundException(){
        super(&quot;Word not found.&quot;);
    }
&nbsp;
    public ItemNotFoundException(String message){
        super(message);
    }
&nbsp;
}</pre></div></code><hr />
</div> <font color="Silver"><br />
<br />
--- Update ---<br />
<br />
</font>LinearSearch class: <br />
<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><div class="" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">public class LinearSearch extends SearchAlgorithm{
&nbsp;
    public int search(String&#91;&#93; words, String wordToFind){
&nbsp;
        for(int i = 0; i &lt; words.length ; i++){ 
            if(words&#91;i&#93;.equals(wordToFind)){
                break;
            }else{
                incrementCount();
            }
        }
        return getCount();
&nbsp;
    }
}</pre></div></code><hr />
</div> <br />
SearchAlgorithm class: <br />
<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><div class="" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">public abstract class SearchAlgorithm {
&nbsp;
	/**
	 * Method search: a &quot;to-be-defined&quot; method used to implement a specific search strategy over the given array looking for the target word
	 * Precondition: words is a nonempty array and target is a non-null string
	 * Postcondition: if the target word is found, return its index.  
	 *                If not found, throw an ItemNotFoundException (a subclass which you have to make)
	 * 
	 */
	public abstract int search(String&#91;&#93; words, String wordToFind) throws ItemNotFoundException;
&nbsp;
	/**
	 * Utility Features: This class can be used to track the number of search comparisons
	 *                   for use in comparing two different search algorithms
	 */
	private int count = 0;
	public void incrementCount() {
		count++;
	}
	public int getCount() {
		return count;
	}
	public void resetCount() {
		count = 0;
	}
}</pre></div></code><hr />
</div> </div>

]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/object-oriented-programming/">Object Oriented Programming</category>
			<dc:creator>Kristenw17</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/object-oriented-programming/29521-creating-exception-class.html</guid>
		</item>
		<item>
			<title>Need Help!</title>
			<link>http://www.javaprogrammingforums.com/object-oriented-programming/29442-need-help.html</link>
			<pubDate>Mon, 13 May 2013 22:25:29 GMT</pubDate>
			<description>Hi I am trying to finish a simple program up and having a few issues with the code and the output. Here is my output! 
Welcome to the Web Host...</description>
			<content:encoded><![CDATA[<div>Hi I am trying to finish a simple program up and having a few issues with the code and the output. Here is my output!<br />
Welcome to the Web Host Ordering System<br />
<br />
Please enter the price of the new package: $0<br />
<br />
The average sales for these packages is: $NaN<br />
Welcome to the Shipping Wizard!<br />
<br />
<br />
Enter 0 to end!<br />
<br />
Please enter shipping charges: $5<br />
<br />
The shipping charges total up to $ShippingData@18088c0<br />
<br />
Welcome to the Shipping Wizard!<br />
<br />
<br />
Enter 0 to end!<br />
<br />
Please enter shipping charges: $3<br />
The highest shipping charge inputed was: $ShippingData@fec107<br />
<br />
Welcome to the Shipping Wizard!<br />
<br />
<br />
Enter 0 to end!<br />
<br />
Please enter shipping charges: $2<br />
The lowest shipping charge inputes was: $ShippingData@1617189<br />
<br />
BUILD SUCCESSFUL (total time: 9 seconds)<br />
<br />
And I am attaching my code because it is so big plus it is 3 files.</div>


	<div style="padding:10px">

	

	

	

	
		<fieldset class="fieldset">
			<legend>Attached Files</legend>
			<ul>
			<li>
	<img class="inlineimg" src="http://www.javaprogrammingforums.com/images/attach/zip.gif" alt="File Type: zip" />
	<a href="http://www.javaprogrammingforums.com/attachments/object-oriented-programming/2087d1368483867-need-help-webhostorder1-4-zip">WebHostOrder1.4.zip</a> 
(31.8 KB)
</li>
			</ul>
		</fieldset>
	

	</div>
]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/object-oriented-programming/">Object Oriented Programming</category>
			<dc:creator>mstratmann</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/object-oriented-programming/29442-need-help.html</guid>
		</item>
		<item>
			<title>Help with Beginner JAVA method!</title>
			<link>http://www.javaprogrammingforums.com/object-oriented-programming/29429-help-beginner-java-method.html</link>
			<pubDate>Mon, 13 May 2013 09:56:34 GMT</pubDate>
			<description><![CDATA[Hi guys I can't seem to get this method working. Any help is appreciated on what's wrong in my code thanks! 
 
<div class="bbcode_container"> 
      ...]]></description>
			<content:encoded><![CDATA[<div>Hi guys I can't seem to get this method working. Any help is appreciated on what's wrong in my code thanks!<br />
<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><div class="" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    /**
public static final String SENTENCE_SEPARATORS = &quot;&#91;.?!&#93;&quot;;
&nbsp;
     * Given an ArrayList of lines from a text file, create a new array list
     * in which each entry is a sentence from the file 
     * with SENTENCE_SEPARATORS removed but no other changes.
     * A sentence is defined to be a sequence of characters that 
     * (1) is terminated by (but doesn't include) the characters ! ? . or the end of the file, 
     * (2) excludes whitespace on either end, and 
     * (3) is not empty.
     */
    public static ArrayList&lt;String&gt; convertFileLinesToSentences(ArrayList&lt;String&gt; filelines)
    {
        String allLines = &quot;&quot;;
        for(String lines : filelines) { // add all lines into a single string
            allLines = (lines + &quot; &quot;);
        }
        String&#91;&#93; sentencesArray = allLines.split(SENTENCE_SEPARATORS);  // split at sentence separators
        ArrayList&lt;String&gt; entries = new ArrayList&lt;&gt;(Arrays.asList(sentencesArray)); // add sentences from array into ArrayList
        for(String sentence : entries) { // remove the sentence separators
            sentence.trim().replaceAll(SENTENCE_SEPARATORS, &quot;&quot;);
        }
        return entries;
    }</pre></div></code><hr />
</div> </div>

]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/object-oriented-programming/">Object Oriented Programming</category>
			<dc:creator>starlest</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/object-oriented-programming/29429-help-beginner-java-method.html</guid>
		</item>
		<item>
			<title>Nodes</title>
			<link>http://www.javaprogrammingforums.com/object-oriented-programming/29394-nodes.html</link>
			<pubDate>Fri, 10 May 2013 22:27:46 GMT</pubDate>
			<description><![CDATA[So I absolutely cannot figure out nodes. I have no clue what I am doing. I can't figure out how to do the add method. So far all I have is:  
 
...]]></description>
			<content:encoded><![CDATA[<div>So I absolutely cannot figure out nodes. I have no clue what I am doing. I can't figure out how to do the add method. So far all I have is: <br />
<br />
<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><div class="" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">public class List{
&nbsp;
    Node head = null; //the start of the linked list
    private 
&nbsp;
    public void add(Object next, int index){
        if(head == null){ //adding to an empty list (changes head)
            head = new Node(next, head);     //what about index?
        }else if( ){ //adding to a single element list (changes head)
&nbsp;
        }else if(){ //adding to a populated list (n&gt;=2)
            Node temp = head;
            while(temp.next != null){
                temp = temp.next;
            }
            temp.next = new Node(next, index) //not correct.....
        }
&nbsp;
    }
}</pre></div></code><hr />
</div> </div>

]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/object-oriented-programming/">Object Oriented Programming</category>
			<dc:creator>Kristenw17</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/object-oriented-programming/29394-nodes.html</guid>
		</item>
		<item>
			<title>A beginner needs help in oop</title>
			<link>http://www.javaprogrammingforums.com/object-oriented-programming/29378-beginner-needs-help-oop.html</link>
			<pubDate>Thu, 09 May 2013 23:12:10 GMT</pubDate>
			<description><![CDATA[Hello everyone!  
 
I've tried to create objects from classes and it worked until I wanted to draw the new objects I created. 
 
<div...]]></description>
			<content:encoded><![CDATA[<div>Hello everyone! <br />
<br />
I've tried to create objects from classes and it worked until I wanted to draw the new objects I created.<br />
<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><div class="" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">package objectclasstrain;
import javax.swing.SwingUtilities;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.Dimension;
import java.awt.Color;
import java.awt.Graphics;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
public class ObjectClassTrain {
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
    public static void main(String&#91;&#93; args) {
&nbsp;
        square squareRed = new square();
        System.out.println(squareRed.returnXposition());
        System.out.println(squareRed.returnYposition());
&nbsp;
        SwingUtilities.invokeLater(new Runnable(){
            @Override
            public void run(){
                createAndShowGUI();
            }
        });
&nbsp;
    }
&nbsp;
    public static void createAndShowGUI(){
&nbsp;
        JFrame f = new JFrame(&quot;JFrame test&quot;);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setResizable(false);
        f.add(new myPanel());
        f.pack();
        f.setVisible(true);
&nbsp;
    }
&nbsp;
}
&nbsp;
class myPanel extends JPanel{
&nbsp;
&nbsp;
     int room_width = 640;
     int room_height = 480;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
    public myPanel(){
&nbsp;
&nbsp;
&nbsp;
    }
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
    @Override
    public Dimension getPreferredSize(){
&nbsp;
        return new Dimension(room_width, room_height);
&nbsp;
    }
&nbsp;
    @Override
    public void paintComponent(Graphics g){
        super.paintComponent(g);        
        g.setColor(Color.BLACK);
        g.fillRect(squareRed.returnXposition(), 0, room_width, room_height);
&nbsp;
    }
&nbsp;
&nbsp;
}
&nbsp;
&nbsp;
class square{
&nbsp;
    int room_width = 640;
     int room_height = 480;
&nbsp;
    double Xposition;
    double Yposition;
&nbsp;
         public square(){
&nbsp;
             Xposition = (int) (Math.random() * room_width);
             Yposition = (int) (Math.random() * room_height);
             }
&nbsp;
         public double returnXposition(){
             return Xposition;
         }
&nbsp;
         public double returnYposition(){
             return Yposition;
         }
&nbsp;
&nbsp;
}</pre></div></code><hr />
</div> <br />
I don't really know how I could get access to the squareRed's Xposition variable.<br />
<br />
oh, and another problem is that there is only one line of code which will paint the objects, and I want to be able, for example,<br />
to click on the screen to create an object which is automatically be painted on the screen. And to do that I can't just create new lines<br />
of code for every object that could be created. <br />
<br />
What should I do?</div>

]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/object-oriented-programming/">Object Oriented Programming</category>
			<dc:creator>kinkita</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/object-oriented-programming/29378-beginner-needs-help-oop.html</guid>
		</item>
		<item>
			<title>Find a java program that calculates</title>
			<link>http://www.javaprogrammingforums.com/object-oriented-programming/29369-find-java-program-calculates.html</link>
			<pubDate>Thu, 09 May 2013 15:16:47 GMT</pubDate>
			<description>1) For linear function 
        a. x-and y-intercepts 
2) For quadratic function 
        a. x-and y-intercepts 
        b. Vertex 
 
--- Update ---...</description>
			<content:encoded><![CDATA[<div>1) For linear function<br />
        a. x-and y-intercepts<br />
2) For quadratic function<br />
        a. x-and y-intercepts<br />
        b. Vertex<font color="Silver"><br />
<br />
--- Update ---<br />
<br />
</font>Guest...i really need helped...this assignment will be submit on Sunday..12 may..2013.</div>

]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/object-oriented-programming/">Object Oriented Programming</category>
			<dc:creator>Zuhairi Abdullah</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/object-oriented-programming/29369-find-java-program-calculates.html</guid>
		</item>
		<item>
			<title><![CDATA[[Beginner Java] Returning a variable from mothod problem]]></title>
			<link>http://www.javaprogrammingforums.com/object-oriented-programming/29338-%5Bbeginner-java%5D-returning-variable-mothod-problem.html</link>
			<pubDate>Wed, 08 May 2013 19:26:20 GMT</pubDate>
			<description><![CDATA[So, I've tried to learn how to use methods so I dont have to use the same script to handle something in vain. But 
what I'm having problems with is...]]></description>
			<content:encoded><![CDATA[<div>So, I've tried to learn how to use methods so I dont have to use the same script to handle something in vain. But<br />
what I'm having problems with is returning a variable.<br />
<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><div class="" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">package javagametest;
import javax.swing.SwingUtilities;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Color;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
public class JavaGameTest{
&nbsp;
    public static void main(String&#91;&#93; args){
&nbsp;
        SwingUtilities.invokeLater(new Runnable(){
&nbsp;
            @Override
            public void run(){
                createAndShowGUI();
            }
&nbsp;
        });
&nbsp;
    }
&nbsp;
    public static void createAndShowGUI(){
&nbsp;
        JFrame f = new JFrame(&quot;JFrame test&quot;);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.add(new myPanel());
        f.pack();
        f.setVisible(true);
&nbsp;
&nbsp;
    }
&nbsp;
}
&nbsp;
class myPanel extends JPanel{
&nbsp;
    //Global
    static int Room_Width = 966;
    static int Room_Height = 600;
&nbsp;
    //The red box variables
    private double RedBoxX = (int) (Math.random() * 640);
    private double RedBoxY = (int) (Math.random() * 480);
    private int RedBoxW = 32;
    private int RedBoxH = 32;
    private int RedBoxVert = 1;
    private int RedBoxHoro = 1;
    private double RedBoxSpeed = 0.3;
&nbsp;
&nbsp;
    public myPanel(){
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
    }
&nbsp;
&nbsp;
    private void MoveObject(){
&nbsp;
            switch (RedBoxVert)
            {
                case 0: RedBoxY-=RedBoxSpeed;
                    break;
                case 1: RedBoxY+=RedBoxSpeed;
                    break;
            }
&nbsp;
            switch (RedBoxHoro)
            {
                case 0: RedBoxX-=RedBoxSpeed;
                    break;
                case 1: RedBoxX+=RedBoxSpeed;
                    break;
            }
&nbsp;
&nbsp;
        }
&nbsp;
&nbsp;
    static int checkCollisionHOROSONTAL(double x, double y, int horo, int width){
&nbsp;
                if ((x + width &gt;= Room_Width))
                {horo = 0;}
&nbsp;
                if ((x  &lt;= 0))
                {horo = 1;}
&nbsp;
                return horo;
&nbsp;
            }
&nbsp;
&nbsp;
            static int checkCollisionVertical(double x, double y, int vert1, int height){
&nbsp;
                if ((x + height &gt;= Room_Height))
                {vert1 = 0;}
&nbsp;
                if ((x  &lt;= 0))
                vert1 = 1;
&nbsp;
                return vert1;
&nbsp;
            }
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
    @Override
    public Dimension getPreferredSize(){
        return new Dimension(Room_Width,Room_Height);
    }
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
    @Override
    public void paintComponent(Graphics g){
&nbsp;
        super.paintComponent(g);
        {
         super.paintComponent(g);
                MoveObject();
                checkCollisionHOROSONTAL(RedBoxX, RedBoxY, RedBoxHoro, RedBoxW);
                checkCollisionVertical(RedBoxX, RedBoxY, RedBoxVert, RedBoxH);
&nbsp;
                int RedBoxXINT = (int)RedBoxX;
                int RedBoxYINT = (int)RedBoxY;
&nbsp;
         g.setColor(Color.RED);
         g.fillRect(RedBoxXINT, RedBoxYINT, RedBoxW, RedBoxH);
         g.setColor(Color.BLACK);
         g.drawRect(RedBoxXINT, RedBoxYINT, RedBoxW, RedBoxH);
&nbsp;
&nbsp;
         repaint();
&nbsp;
        }
&nbsp;
    }
&nbsp;
&nbsp;
}</pre></div></code><hr />
</div> <br />
<br />
I want the &quot;Return vart1&quot; to indicate if the variable RedBoxVert should be on or off (as you can see in the paramaters &quot; checkCollisionVertical(RedBoxX, RedBoxY, <u>RedBoxVert</u>, RedBoxH);&quot; ), but it's not working. <br />
<br />
I've also tryed to use public int instead of static int, but I have no clue on what I should do. <br />
<br />
I would really appreciate if someone could help! :)</div>

]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/object-oriented-programming/">Object Oriented Programming</category>
			<dc:creator>kinkita</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/object-oriented-programming/29338-%5Bbeginner-java%5D-returning-variable-mothod-problem.html</guid>
		</item>
		<item>
			<title><![CDATA[Removing punctuation characters from a word [Beginner Java]]]></title>
			<link>http://www.javaprogrammingforums.com/object-oriented-programming/29308-removing-punctuation-characters-word-%5Bbeginner-java%5D.html</link>
			<pubDate>Wed, 08 May 2013 14:34:54 GMT</pubDate>
			<description><![CDATA[I have these 2 methods. What I'm currently having troubles is with the cleanWord method. What it can do now is remove only one punctuation either in...]]></description>
			<content:encoded><![CDATA[<div>I have these 2 methods. What I'm currently having troubles is with the cleanWord method. What it can do now is remove only one punctuation either in front or at the back of the string or at both ends. What I'm trying to figure out is how to remove multiple punctuation characters at one go? For example &quot;!!!test&quot; will return &quot;test&quot; after implementing the method. Thank you!<br />
<br />
[but do not clean punctuation found in the middle of the word for example &quot;don't&quot;]<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code java:</div>
                <hr /><code class="bbcode_code"><div class="java" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #7F0055; font-weight: bold;">public</span> <span style="color: #7F0055; font-weight: bold;">static</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> cleanWord<span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> word<span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> cleanWord <span style="color: #000000;">=</span> word<span style="color: #000000;">;</span>
        <span style="color: #000066; font-weight: bold;">int</span> wordLength <span style="color: #000000;">=</span> cleanWord.<span style="color: #000000;">length</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
&nbsp;
        <span style="color: #7F0055; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>isPunctuation<span style="color: #000000;">&#40;</span>cleanWord.<span style="color: #000000;">charAt</span><span style="color: #000000;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">==</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
            cleanWord <span style="color: #000000;">=</span> cleanWord.<span style="color: #000000;">substring</span><span style="color: #000000;">&#40;</span><span style="color: #cc66cc;">1</span>, wordLength<span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
            <span style="color: #7F0055; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>isPunctuation<span style="color: #000000;">&#40;</span>cleanWord.<span style="color: #000000;">charAt</span><span style="color: #000000;">&#40;</span>wordLength <span style="color: #000000;">-</span> <span style="color: #cc66cc;">1</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">==</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
                cleanWord <span style="color: #000000;">=</span> word.<span style="color: #000000;">substring</span><span style="color: #000000;">&#40;</span><span style="color: #cc66cc;">1</span>, wordLength <span style="color: #000000;">-</span> <span style="color: #cc66cc;">1</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
            <span style="color: #000000;">&#125;</span>
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #7F0055; font-weight: bold;">else</span> <span style="color: #7F0055; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>isPunctuation<span style="color: #000000;">&#40;</span>word.<span style="color: #000000;">charAt</span><span style="color: #000000;">&#40;</span>wordLength <span style="color: #000000;">-</span> <span style="color: #cc66cc;">1</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">==</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
            cleanWord <span style="color: #000000;">=</span> cleanWord.<span style="color: #000000;">substring</span><span style="color: #000000;">&#40;</span><span style="color: #cc66cc;">0</span>, wordLength <span style="color: #000000;">-</span> <span style="color: #cc66cc;">1</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
        <span style="color: #000000;">&#125;</span>    
&nbsp;
        <span style="color: #7F0055; font-weight: bold;">return</span> cleanWord<span style="color: #000000;">;</span>
    <span style="color: #000000;">&#125;</span>
&nbsp;
&nbsp;
    <span style="color: #7F0055; font-weight: bold;">public</span> <span style="color: #7F0055; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">boolean</span> isPunctuation<span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Acharacter+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Character</span></a> c<span style="color: #000000;">&#41;</span> 
    <span style="color: #000000;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">boolean</span> isPunctuation <span style="color: #000000;">=</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #000000;">;</span>
        <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> punctuationList <span style="color: #000000;">=</span> PUNCTUATION.<span style="color: #000000;">split</span><span style="color: #000000;">&#40;</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
        <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> d <span style="color: #000000;">=</span> c.<span style="color: #000000;">toString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
&nbsp;
        <span style="color: #7F0055; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> punctuation <span style="color: #000000;">:</span> punctuationList<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
            <span style="color: #7F0055; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>d.<span style="color: #000000;">equals</span><span style="color: #000000;">&#40;</span>punctuation<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
                isPunctuation <span style="color: #000000;">=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #000000;">;</span>
            <span style="color: #000000;">&#125;</span>
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #7F0055; font-weight: bold;">return</span> isPunctuation<span style="color: #000000;">;</span>
    <span style="color: #000000;">&#125;</span></pre></div></code><hr />
</div> </div>

]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/object-oriented-programming/">Object Oriented Programming</category>
			<dc:creator>starlest</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/object-oriented-programming/29308-removing-punctuation-characters-word-%5Bbeginner-java%5D.html</guid>
		</item>
		<item>
			<title>Trouble with moving array through classes</title>
			<link>http://www.javaprogrammingforums.com/object-oriented-programming/29196-trouble-moving-array-through-classes.html</link>
			<pubDate>Mon, 06 May 2013 22:17:59 GMT</pubDate>
			<description>This is in my main class and method.  I let the user select a character (called a champion), and then ,depending on which character they pick, I want...</description>
			<content:encoded><![CDATA[<div>This is in my main class and method.  I let the user select a character (called a champion), and then ,depending on which character they pick, I want to assign their stats as different values in an array.  Each character having different array values imported from a secondary class.  I have tried it both declaring the array in the primary class and taking it of either class.  I haven't had a lot of progress and wasn't sure where else to look for an answer.  Please answer with code, because sometimes I get confused between the different names of things.<br />
<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code Java:</div>
                <hr /><code class="bbcode_code"><div class="java" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;
<span style="color: #7F0055; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span> champ1 <span style="color: #000000;">==</span> <span style="color: #cc66cc;">0</span> <span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span><span style="color: #3F7F5F; font-style: italic;">//decides if character has been selected or not</span>
                        <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #000000;">out</span>.<span style="color: #000000;">print</span><span style="color: #000000;">&#40;</span>
                                <span style="color: #0000ff;">&quot;Pick a character:<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #3F7F5F; font-style: italic;">//outputs menu</span>
                              <span style="color: #000000;">+</span> <span style="color: #0000ff;">&quot;1) Miss Fortune<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
                              <span style="color: #000000;">+</span> <span style="color: #0000ff;">&quot;2) Brand<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
                              <span style="color: #000000;">+</span> <span style="color: #0000ff;">&quot;3) Annie<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> 
                              <span style="color: #000000;">+</span> <span style="color: #0000ff;">&quot;Enter your choice: &quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
&nbsp;
                        champ1 <span style="color: #000000;">=</span> input.<span style="color: #000000;">nextInt</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
                        <span style="color: #7F0055; font-weight: bold;">switch</span><span style="color: #000000;">&#40;</span>champ1<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
                            <span style="color: #7F0055; font-weight: bold;">case</span> <span style="color: #cc66cc;">1</span><span style="color: #000000;">:</span> 
                                obj.<span style="color: #000000;">missfortune</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
                                <span style="color: #7F0055; font-weight: bold;">break</span><span style="color: #000000;">;</span>
                            <span style="color: #7F0055; font-weight: bold;">case</span> <span style="color: #cc66cc;">2</span><span style="color: #000000;">:</span>
                                <span style="color: #000066; font-weight: bold;">int</span> champarr1<span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> <span style="color: #000000;">=</span> <span style="color: #7F0055; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">int</span><span style="color: #000000;">&#91;</span><span style="color: #cc66cc;">7</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">;</span>
                                obj.<span style="color: #000000;">annie</span><span style="color: #000000;">&#40;</span>champarr1<span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
                                <span style="color: #7F0055; font-weight: bold;">break</span><span style="color: #000000;">;</span>
                            <span style="color: #7F0055; font-weight: bold;">case</span> <span style="color: #cc66cc;">3</span><span style="color: #000000;">:</span>
                                <span style="color: #000066; font-weight: bold;">int</span> champarr1<span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> <span style="color: #000000;">=</span> <span style="color: #7F0055; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">int</span><span style="color: #000000;">&#91;</span><span style="color: #cc66cc;">7</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">;</span>
                                obj.<span style="color: #000000;">brand</span><span style="color: #000000;">&#40;</span>champarr1<span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
                                <span style="color: #7F0055; font-weight: bold;">break</span><span style="color: #000000;">;</span>
                            <span style="color: #7F0055; font-weight: bold;">default</span><span style="color: #000000;">:</span>
                                <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #000000;">out</span>.<span style="color: #000000;">println</span><span style="color: #000000;">&#40;</span><span style="color: #0000ff;">&quot;Invalide entry, try again.&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
                                <span style="color: #7F0055; font-weight: bold;">break</span><span style="color: #000000;">;</span></pre></div></code><hr />
</div> <br />
This is my secondary class.<br />
<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code Java:</div>
                <hr /><code class="bbcode_code"><div class="java" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;
<span style="color: #3F7F5F; font-style: italic;">//subclass of reague of regends</span>
&nbsp;
<span style="color: #7F0055; font-weight: bold;">package</span> <span style="color: #006699;">reagueofregends</span><span style="color: #000000;">;</span>
&nbsp;
<span style="color: #7F0055; font-weight: bold;">public</span> <span style="color: #7F0055; font-weight: bold;">class</span> Characters <span style="color: #000000;">&#123;</span>
&nbsp;
    <span style="color: #7F0055; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> champ <span style="color: #000000;">=</span> <span style="color: #7F0055; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">int</span><span style="color: #000000;">&#91;</span><span style="color: #cc66cc;">5</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">;</span>
&nbsp;
    <span style="color: #7F0055; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> missfortune<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">int</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> champ <span style="color: #000000;">=</span> <span style="color: #000000;">&#123;</span><span style="color: #cc66cc;">1</span>,<span style="color: #cc66cc;">2</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">4</span>,<span style="color: #cc66cc;">5</span>,<span style="color: #cc66cc;">6</span>,<span style="color: #cc66cc;">7</span><span style="color: #000000;">&#125;</span><span style="color: #000000;">;</span>
        <span style="color: #7F0055; font-weight: bold;">return</span> <span style="color: #000000;">&#40;</span>champ<span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
    <span style="color: #000000;">&#125;</span>
    <span style="color: #7F0055; font-weight: bold;">public</span> <span style="color: #7F0055; font-weight: bold;">void</span> annie<span style="color: #000000;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> champ<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">int</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> champ <span style="color: #000000;">=</span> <span style="color: #000000;">&#123;</span><span style="color: #cc66cc;">1</span>,<span style="color: #cc66cc;">2</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">4</span>,<span style="color: #cc66cc;">5</span>,<span style="color: #cc66cc;">6</span>,<span style="color: #cc66cc;">7</span><span style="color: #000000;">&#125;</span><span style="color: #000000;">;</span>
    <span style="color: #000000;">&#125;</span>
    <span style="color: #7F0055; font-weight: bold;">public</span> <span style="color: #7F0055; font-weight: bold;">void</span> brand<span style="color: #000000;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> champ<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">int</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> champ <span style="color: #000000;">=</span> <span style="color: #000000;">&#123;</span><span style="color: #cc66cc;">1</span>,<span style="color: #cc66cc;">2</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">4</span>,<span style="color: #cc66cc;">5</span>,<span style="color: #cc66cc;">6</span>,<span style="color: #cc66cc;">7</span><span style="color: #000000;">&#125;</span><span style="color: #000000;">;</span>
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></code><hr />
</div> </div>

]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/object-oriented-programming/">Object Oriented Programming</category>
			<dc:creator>IkeIII</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/object-oriented-programming/29196-trouble-moving-array-through-classes.html</guid>
		</item>
		<item>
			<title>question about Anonymous object and Wrapper classes?</title>
			<link>http://www.javaprogrammingforums.com/object-oriented-programming/29186-question-about-anonymous-object-wrapper-classes.html</link>
			<pubDate>Mon, 06 May 2013 12:58:00 GMT</pubDate>
			<description>When should I decide to use Anonymous object and Wrapper classes? 
In Which cases should I? 
 
thanks in advance.</description>
			<content:encoded><![CDATA[<div>When should I decide to use Anonymous object and Wrapper classes?<br />
In Which cases should I?<br />
<br />
thanks in advance.</div>

]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/object-oriented-programming/">Object Oriented Programming</category>
			<dc:creator>sciences</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/object-oriented-programming/29186-question-about-anonymous-object-wrapper-classes.html</guid>
		</item>
		<item>
			<title>Instance variable inside a method</title>
			<link>http://www.javaprogrammingforums.com/object-oriented-programming/29171-instance-variable-inside-method.html</link>
			<pubDate>Sun, 05 May 2013 19:48:18 GMT</pubDate>
			<description>I am working on a project where I need to return 3 values I understand I can only return one using a method alone! So I need to add 2 instance...</description>
			<content:encoded><![CDATA[<div>I am working on a project where I need to return 3 values I understand I can only return one using a method alone! So I need to add 2 instance variables, that will return the other 2 values. Can someone please assist me in this? Here is my code, it may be completely wrong! I have used a larger font and commented as much as possible about where I am having a problem!<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><div class="" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">import java.util.Scanner;
&nbsp;
// The Bandwidth class
&nbsp;
&nbsp;
public class WebHostOrder14 {
&nbsp;
    private double highestCharge; // instance variable for highestCharge
    private double lowestCharge; // instance variable for lowestCherge
&nbsp;
    private Scanner scanner;
&nbsp;
    //create a new constructor to do the work
    public WebHostOrder14() {
        WebHost webHost;
        double average;
        double shipping;
        double highest;
        double lowest;
&nbsp;
        System.out.println(&quot;\nWelcome to the Web Host Ordering System\n&quot;);
        scanner = new Scanner(System.in);
        average = computeAverageSales();
        System.out.printf(&quot;\nThe average sales for these packages is: $&quot; + average);
        if (average &gt;= 200) {
            System.out.println(&quot;\nWow! Those sales are awesome!!\n&quot;);
        }
        shipping = computeShippingCharges();
         System.out.printf(&quot;\nThe shipping charges total up to $&quot; + shipping);
    }
&nbsp;
    private double computeAverageSales() {
        WebHost webHost;
        double average;
        double total = 0;
        int counter = 0;
&nbsp;
        while (true) {
            System.out.printf(&quot;Please enter the price of the new package: $&quot;);
            double webHostPrice = scanner.nextDouble();
            total = webHostPrice + total;
            counter++;
            if (webHostPrice == 0 || webHostPrice == 0.00) {
                break;
            } else if (webHostPrice &lt;= -1) {
                System.out.println(&quot;Please, enter a positive number!&quot;);
            } else if (webHostPrice &gt; 500) {
                System.out.println(&quot;That is unrealistic, please enter the correct amount!&quot;);
            } else if (webHostPrice &gt;=1  || webHostPrice &lt;= 500){
            System.out.printf(&quot;You entered price $&quot; + webHostPrice);
            }// end webHostPrice validation
&nbsp;
            System.out.print(&quot;What will be the product ID: &quot;);
            int webHostId = scanner.nextInt();
            scanner.nextLine();
            if (webHostId &lt;= 0) {
                System.out.println(&quot;Please, enter a positive number!&quot;);
            } else if (webHostId &gt; 10000) {
                System.out.println(&quot;Please enter the correct produce ID!&quot;);
            } // end webHostId validation statements
&nbsp;
            System.out.print(&quot;What is the product name: &quot;);
            String webHostName = scanner.next();
            if (webHostName == null){
                System.out.println(&quot;Please enter a valid product name!&quot;);
            }// end webHostName validation
&nbsp;
            System.out.print(&quot;Please enter the required Bandwidth needed for your site? &quot;);
            double webHostBandwidth = scanner.nextDouble();
            if (webHostBandwidth &lt;= 0){
                System.out.println(&quot;Please enter a positive number!&quot;);
            } else if (webHostBandwidth &gt; 1000000){
                System.out.println(&quot;That seems high are you sure?&quot;);
            } // end webHostBandwidth validation
&nbsp;
            System.out.print(&quot;How many FTP accounts do you need? &quot;);
            int webHostFtp = scanner.nextInt();
            if (webHostFtp &lt;= 0){
                System.out.println(&quot;Please enter a positive number!&quot;);
            } else if (webHostFtp &gt; 100){
                System.out.println(&quot;Please enter a valid number!&quot;);
            } // emd webHostFtp validation
&nbsp;
            System.out.print(&quot;How many email accounts do you need? &quot;);
            int webHostMail = scanner.nextInt();
            if (webHostMail &lt;= 0){
                System.out.print(&quot;Please enter a positive number!&quot;);
            } else if (webHostMail &gt; 500){
                System.out.println(&quot;Please enter a valid number!&quot;);
            } // end webHostMail validation
&nbsp;
            System.out.print(&quot;What is your domain name? &quot;);
            String webHostDomain = scanner.next();
            if (webHostDomain == null){
                System.out.println(&quot;Please enter a valid domain!&quot;);
            } // end webHostDomain validation
        } // end while statement
    average  = total / (counter - 1);
    return average;
} // end computeAverageSales
&nbsp;
&nbsp;
   &#91;SIZE=4&#93; /*Here is where my problem is*/&#91;/SIZE&#93;
private double computeShippingCharges() {
    WebHost webHost;
        double shipping = 0;
        double highest;
        double lowest;
        double x = 0;
        double y = 0;
&nbsp;
&nbsp;
        System.out.println(&quot;\nWelcome to the Shipping Wizard!\n&quot;);
        System.out.println(&quot;\nEnter 0 to end!\n&quot;);
&nbsp;
&nbsp;
&nbsp;
       // while (true) {
            // Acquire a price. A price == 0 indicates end-of-data
&nbsp;
            System.out.print(&quot;Please enter shipping charges: $&quot;);
            double charges = scanner.nextDouble();
            charges = x;
            if (charges &lt; x){
                highest = x;
                System.out.printf(&quot;The highest sales price added was $&quot; + highest);
            } else if (charges &gt; x){
                x= y;
                lowest = y;
                System.out.print(&quot;The lowest value was $&quot; + lowest);
            }
&nbsp;
            // Test for end-of-data
           /*  if (charges &lt;= -1) {
                System.out.println(&quot;Please enter a positive number!&quot;);
                charges = scanner.nextDouble();
            } else if (charges &gt; 1000) {
                System.out.println(&quot;That is unrealistic please enter the correct value!&quot;);
                charges = scanner.nextDouble();
            } else if (charges == 0){
                break;
            }
&nbsp;
&nbsp;
&nbsp;
        }*/
&nbsp;
        return shipping;
}
&nbsp;
    public static void main(String&#91;&#93; args) {
        WebHost webHost = new WebHost();
        new WebHostOrder14();
    } // end main
} // end program</pre></div></code><hr />
</div> Here is my separate class<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><div class="" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">class WebHost {
&nbsp;
    private double bandwidth, price, &#91;SIZE=4&#93;highest, lowest&#91;/SIZE&#93;;
    private int ftp, mail, id;
    private String domain, name;
&nbsp;
    // Constructors
    WebHost() {
        setWebHostBandwidth(0.0);
        setWebHostPrice(0.0);
        &#91;SIZE=4&#93;setWebHostHighest(0.0); //// added this////
        setWebHostLowest(0.0); //// and added this////&#91;/SIZE&#93;
        setWebHostFtp(0);
        setWebHostMail(0);
        setWebHostId(0);
        setWebHostDomain(&quot;&quot;);
        setWebHostName(&quot;&quot;);
&nbsp;
    } // End WebHost
&nbsp;
    WebHost(double bandwidth, double price, &#91;SIZE=4&#93;double highest, double lowest&#91;/SIZE&#93;, int ftp, int mail, int id,
            String domain, String name) {
        setWebHostBandwidth(bandwidth);
        setWebHostPrice(price);
        &#91;SIZE=4&#93;setWebHostHighest(highest);
        setWebHostLowest(lowest);&#91;/SIZE&#93;
        setWebHostFtp(ftp);
        setWebHostMail(mail);
        setWebHostId(id);
        setWebHostDomain(domain);
        setWebHostName(name);
&nbsp;
    } // end WebHost
&nbsp;
    //Getters and Setters
    public double getWebHostBandwidth() {
        return bandwidth;
    } //end getWebHostBandwidth
&nbsp;
    public double getWebHostPrice() {
        return price;
    } //end getWebHostPrice
    &#91;SIZE=4&#93;////added the next 2 sections of code below//// 
    public double getWebHostHighest(){
        return highest;
    }
&nbsp;
    public double getWebHostLowest(){
        return lowest;
    }
&#91;/SIZE&#93;
    public int getWebHostFtp() {
        return ftp;
    } //end getWebHostFtp
&nbsp;
    public int getWebHostMail() {
        return mail;
    } //end getWebHostMail
&nbsp;
    public int getWebHostId() {
        return id;
    } //end getWebHostId
&nbsp;
    public String getWebHostDomain() {
        return domain;
    } //end getWebHostDomain
&nbsp;
    public String getWebHostName() {
        return name;
    } //end getWebHostName  
&nbsp;
    public final void setWebHostBandwidth(double bandwidth) {
        this.bandwidth = bandwidth;
    } //end setBandwidth
&nbsp;
    public final void setWebHostPrice(double price) {
        this.price = price;
    }//end setPrice
    &#91;SIZE=4&#93;//// again I added the next 2 sections below as well//////
    public final void setWebHostHighest(double highest){
        this.highest = highest;
    }
&nbsp;
    public final void setWebHostLowest(double lowest){
        this.lowest = lowest;
    }
&#91;/SIZE&#93;
    public final void setWebHostFtp(int ftp) {
        this.ftp = ftp;
    } //end setFtp
&nbsp;
    public final void setWebHostMail(int mail) {
        this.mail = mail;
    } //end setMail
&nbsp;
    public final void setWebHostId(int id) {
        this.id = id;
    } //end setId
&nbsp;
    public final void setWebHostDomain(String domain) {
        this.domain = domain;
    } //end setDomain
&nbsp;
    public final void setWebHostName(String name) {
        this.name = name;
    } //end setName
&nbsp;
    // Display WebHost data
     public void display() {
     System.out.println(&quot;\nThank you for your order you ordered a package &quot;
     + &quot;with\n&quot; + &quot;Bandwidth: &quot; + getWebHostBandwidth() + &quot; Mbits\n&quot;
     + getWebHostFtp() + &quot; FTP accounts\n&quot; + getWebHostMail()
     + &quot; mail accounts\n&quot; + &quot;For the domain of\n &quot; + getWebHostDomain());
     System.out.println(&quot;This package has an ID of: &quot; + getWebHostId()
     + &quot;/nThe package name is: &quot; + getWebHostName() + &quot;/nThe price is set at: $&quot;
     + getWebHostPrice());
     } // end display()
} // end class WebHost</pre></div></code><hr />
</div> </div>


	<div style="padding:10px">

	

	

	

	
		<fieldset class="fieldset">
			<legend>Attached Files</legend>
			<ul>
			<li>
	<img class="inlineimg" src="http://www.javaprogrammingforums.com/images/attach/zip.gif" alt="File Type: zip" />
	<a href="http://www.javaprogrammingforums.com/attachments/object-oriented-programming/2069d1367783274-instance-variable-inside-method-webhostorder1-4-zip">WebHostOrder1.4.zip</a> 
(21.6 KB)
</li>
			</ul>
		</fieldset>
	

	</div>
]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/object-oriented-programming/">Object Oriented Programming</category>
			<dc:creator>mstratmann</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/object-oriented-programming/29171-instance-variable-inside-method.html</guid>
		</item>
		<item>
			<title><![CDATA[[SOLVED] Trying to apply methods to sequential program. Getting error.]]></title>
			<link>http://www.javaprogrammingforums.com/object-oriented-programming/29160-trying-apply-methods-sequential-program-getting-error.html</link>
			<pubDate>Sun, 05 May 2013 04:26:04 GMT</pubDate>
			<description><![CDATA[Hi all.  Hope everyone is doing well.  Hey, I'm trying to apply methods to a program I have previously written sequentially.  I keep getting the...]]></description>
			<content:encoded><![CDATA[<div>Hi all.  Hope everyone is doing well.  Hey, I'm trying to apply methods to a program I have previously written sequentially.  I keep getting the following error because of my semicolon on line 31 that seems necessary to me so I don't understand why:<br />
<br />
hotelDemo2Arnette.java:31: error: illegal start of expression<br />
		}<br />
		^<br />
hotelDemo2Arnette.java:33: error: illegal start of expression<br />
	public static void getRooms()<br />
	^<br />
<br />
<br />
Here is le code...<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><div class="" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">import javax.swing.JOptionPane;
&nbsp;
&nbsp;
public class hotelDemo2Arnette
{
	public static void main (String&#91;&#93; args)
	{
		getFloors();
		getRooms();
		getOccupied();
		displayMethod();
&nbsp;
&nbsp;
	}
	public static void getFloors()
		{
			String input; 
			double occNum;
			double occNext;
			double occTot = 0;										//Our variables....
			double toNum;
			double floorNum;
			double floorTot = 0;
&nbsp;
			Hotel worker = new Hotel();								//We make a new object....
&nbsp;
			input = JOptionPane.showInputDialog(&quot;How many floors does the hotel have?&quot;);				//Start getting our input.
			toNum = Double.parseDouble(input);
			for (int i = 1; i &lt;= toNum; i++)
		}
&nbsp;
	public static void getRooms()
		{
			input = JOptionPane.showInputDialog(&quot;How many rooms does floor &quot; + i + &quot; have?&quot;);
			floorNum = Double.parseDouble(input);
			floorTot += floorNum;
			worker.setTotalRooms(floorTot);
		}
&nbsp;
&nbsp;
	public static void getOccupied()
		{
			input = JOptionPane.showInputDialog(&quot;How many occupied rooms does floor 1 have?&quot;);
			occNum = Double.parseDouble(input);
			for (int i = 2; i &lt;= toNum; i++)
&nbsp;
			input = JOptionPane.showInputDialog(&quot;How many occupied rooms does floor &quot; + i + &quot; have?&quot;);
			occNext = Double.parseDouble(input);
			occTot += occNext + occNum;
			worker.setTotalFull(occTot);
		}
&nbsp;
	public static void displayMethod()	
		{
			JOptionPane.showMessageDialog(null, &quot;So that's &quot; + worker.getTotalRooms() + &quot; and &quot; + worker.getTotalFull() + &quot; are full.&quot;);
			JOptionPane.showMessageDialog(null, &quot;That means you have &quot; + worker.getOccupancy() + &quot; rooms empty, &quot; 
												+ &quot;giving you an occupancy rate of &quot; + worker.getVacancy() + &quot;%&quot; );
&nbsp;
			if (worker.getVacancy() &lt; 80.0)
			{
				JOptionPane.showMessageDialog(null, &quot;Contact Manager&quot;);
			}
&nbsp;
			System.exit(0);
		}										
&nbsp;
&nbsp;
}</pre></div></code><hr />
</div> <font color="Silver"><br />
<br />
--- Update ---<br />
<br />
</font>Here's this class btw,<br />
<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><div class="" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">public class hotelDemo1Arnette
{
	private double totalRooms;
	private double totalFull;
	private double occupancy;
	private double vacancy;
&nbsp;
&nbsp;
	public hotelDemo1Arnette()
	{
		totalRooms = 0.0;
		totalFull = 0.0;
		occupancy = 0.0;
		vacancy = 0.0;
	}
	public void setTotalRooms(double rooms)
	{
		totalRooms = rooms;
	}
&nbsp;
	public void setTotalFull(double full)
	{
		totalFull = full;
	}
&nbsp;
	public double getTotalRooms()
	{
		return totalRooms;
	}
&nbsp;
	public double getTotalFull()
	{
		return totalFull;
	}
&nbsp;
	public double getOccupancy()
	{
		occupancy = totalRooms - totalFull;
		return occupancy;
	}
&nbsp;
	public double getVacancy()
	{
		vacancy = (occupancy / totalRooms) * 100;
		return vacancy;
	}</pre></div></code><hr />
</div> <font color="Silver"><br />
<br />
--- Update ---<br />
<br />
</font>Also, I'm sure there are other compilation errors to come, but I can't get past this one at this point.<font color="Silver"><br />
<br />
--- Update ---<br />
<br />
</font>I see it now. I had placed it right after a 'for' statement.</div>

]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/object-oriented-programming/">Object Oriented Programming</category>
			<dc:creator>Praetorian</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/object-oriented-programming/29160-trying-apply-methods-sequential-program-getting-error.html</guid>
		</item>
		<item>
			<title>How to import information from a file, and use it to calculate and display serval things?</title>
			<link>http://www.javaprogrammingforums.com/object-oriented-programming/29153-how-import-information-file-use-calculate-display-serval-things.html</link>
			<pubDate>Sat, 04 May 2013 21:10:00 GMT</pubDate>
			<description>Hello everyone, 
 
I am trying to create a program that reads from a file, and outputs the data. The file contains a list of bank accounts with some...</description>
			<content:encoded><![CDATA[<div>Hello everyone,<br />
<br />
I am trying to create a program that reads from a file, and outputs the data. The file contains a list of bank accounts with some standard bank account information, also we need to output what the monthly fee for each account is based on certain criteria. Then, after that we need to find the total of all deposits, the average of all accounts, and the average of the savings and the checking accounts located in the file, but this is to be done using polymorphism.<br />
<br />
I have gotten quite a lot of the program done, but I am having an issue in getting everything from this file to output correctly, and then to find the average of and total of everything that I need to.<br />
<br />
I have five classes all together, one I believe I have finished. I would like to start with analyzing this class, and then moving on.<br />
<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code java:</div>
                <hr /><code class="bbcode_code"><div class="java" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #7F0055; font-weight: bold;">public</span> <span style="color: #7F0055; font-weight: bold;">class</span> Bank
<span style="color: #000000;">&#123;</span>
	<span style="color: #7F0055; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">int</span> total<span style="color: #000000;">;</span>
&nbsp;
	<span style="color: #7F0055; font-weight: bold;">public</span> Bank<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
	BankAccount myBankAccount <span style="color: #000000;">=</span> <span style="color: #7F0055; font-weight: bold;">new</span> BankAccount<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
&nbsp;
	<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #000000;">out</span>.<span style="color: #000000;">println</span><span style="color: #000000;">&#40;</span><span style="color: #0000ff;">&quot;There are: &quot;</span> <span style="color: #000000;">+</span> myBankAccount.<span style="color: #000000;">getAccountCount</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">+</span> myBankAccount.<span style="color: #000000;">getAccountType</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">+</span> <span style="color: #0000ff;">&quot; account in the Bank&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
	<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #000000;">out</span>.<span style="color: #000000;">println</span><span style="color: #000000;">&#40;</span><span style="color: #0000ff;">&quot;Account #: &quot;</span> <span style="color: #000000;">+</span> myBankAccount.<span style="color: #000000;">getAccountNumber</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
	<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #000000;">out</span>.<span style="color: #000000;">println</span><span style="color: #000000;">&#40;</span><span style="color: #0000ff;">&quot;Account Type: &quot;</span> <span style="color: #000000;">+</span> myBankAccount.<span style="color: #000000;">getAccountType</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
	<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #000000;">out</span>.<span style="color: #000000;">println</span><span style="color: #000000;">&#40;</span><span style="color: #0000ff;">&quot;CustomerName: &quot;</span> <span style="color: #000000;">+</span> myBankAccount.<span style="color: #000000;">getCustomerName</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
	<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #000000;">out</span>.<span style="color: #000000;">println</span><span style="color: #000000;">&#40;</span><span style="color: #0000ff;">&quot;Customer Type: &quot;</span> <span style="color: #000000;">+</span> myBankAccount.<span style="color: #000000;">getCustomerType</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
	<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #000000;">out</span>.<span style="color: #000000;">println</span><span style="color: #000000;">&#40;</span><span style="color: #0000ff;">&quot;Balance: &quot;</span> <span style="color: #000000;">+</span> myBankAccount.<span style="color: #000000;">getBalance</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
	<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #000000;">out</span>.<span style="color: #000000;">println</span><span style="color: #000000;">&#40;</span><span style="color: #0000ff;">&quot;Monthly Fee: &quot;</span> <span style="color: #000000;">+</span> myBankAccount.<span style="color: #000000;">getMonthlyFee</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></code><hr />
</div> <br />
The issue I am having with this class is that I am being told that I am not able to instantiate a BankAccount object. Have I done this right?<br />
<br />
Thank you,<br />
<br />
Techergy</div>

]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/object-oriented-programming/">Object Oriented Programming</category>
			<dc:creator>Techergy</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/object-oriented-programming/29153-how-import-information-file-use-calculate-display-serval-things.html</guid>
		</item>
	</channel>
</rss>
