Search:

Type: Posts; User: bengregg

Search: Search took 0.28 seconds.

  1. Replies
    2
    Views
    698

    Figuring Out Object Arrays

    So I'm trying to figure out how to create Arrays out of Objects but I'm having a problem adding an Object to an Array.

    Here's what I have:


    public class Main {

    double[] values = new...
  2. Replies
    1
    Views
    295

    Calculator Throw Error

    I'm working on creating a Calculator. The code is not finished yet but I'm getting an error already at a part I need to work in order to continue building the program.

    I can type in numbers fine,...
  3. Replies
    7
    Views
    549

    Re: Changing Panel Color with a ComboBox

    How do you instantiate an anonymous class?
  4. Replies
    7
    Views
    549

    Re: Changing Panel Color with a ComboBox

    Lol so I have no errors now. The only problem is nothing happens when I Choose an option form the Combo Box nothing happens :(


    public class ThreeColorsFrame extends JFrame {
    private JPanel...
  5. Replies
    7
    Views
    549

    Re: Changing Panel Color with a ComboBox

    So I'm trying to get the action listener right but I get a ; Expected error at the second to last }. What am I doing wrong?



    public void createComboBox()
    {
    JPanel northPanel = new...
  6. Replies
    7
    Views
    549

    Changing Panel Color with a ComboBox

    So I'm working on a program to change the Color of a Panel with a Combo Box.

    So far I have the Panel and the ComboBox with th options. However, when you click the option nothing happens. This is...
  7. Replies
    17
    Views
    3,245

    Re: Counting Words in a File with a Loop

    Lol I'm trying to seperate the program into classes now.
    The program works, it takes a file and counts the number of lines, words, and characters:




    import java.io.File;
    import...
  8. Replies
    17
    Views
    3,245

    Re: Counting Words in a File with a Loop

    But the program works none the less. Now I'm just working on separating the program into classes so it is object oriented.

    I have My getWords



    import java.util.Scanner;

    /**
    *
  9. Replies
    17
    Views
    3,245

    Re: Counting Words in a File with a Loop

    Lol nevermind silly mistake I got it...

    int lineNumberAgain = 1;

    int totalChars=0;
    while (three.hasNextLine())
    {
    String lineagain = three.nextLine();
    int lineChars = lineagain.length();...
  10. Replies
    17
    Views
    3,245

    Re: Counting Words in a File with a Loop

    I know but the problem I am gaving is with int totalChars = lineChars + totalChar; (used to be int Total = howLong + Total;
    ) because it says that totalChars is not initiated. When I initiate...
  11. Replies
    17
    Views
    3,245

    Re: Counting Words in a File with a Loop

    lineNumberAgain starts at the first line and for every loop it goes to the next line. The total is supposed to keep track of the total number of characters.
  12. Replies
    17
    Views
    3,245

    Re: Counting Words in a File with a Loop

    Lol, almost there.

    Here is what I have for the find Characters:



    File inputFileThree = new File(inputFileName);
    Scanner three = new Scanner(inputFileThree);
  13. Replies
    17
    Views
    3,245

    Re: Counting Words in a File with a Loop

    Hey thanks for the advice. For some reason I thought I couldn't change System in, I thought it needed to be together for whatever reason. So I got it so it can count the lines and words now. However,...
  14. Replies
    17
    Views
    3,245

    Counting Words in a File with a Loop

    So the point of the program is to input a file and have the program generate the number of lines, characters, and words. As of right not I can generate the lines and the words. However, I cannot...
  15. Replies
    4
    Views
    1,245

    Help With Validation

    So I'm trying to use two validations in my program:
    5 integers for the first Validation and
    the second is 32 characters only including : and |.

    The first validation is for a Zip Code and the...
  16. Replies
    6
    Views
    4,013

    Re: Trying to Give Coins For Change

    Okay so I'm making progress...
    I set the purchase at .25 and Pay with 1 penny, 1 dime, 8 quarters, and 1 nickel ($2.16)
    So I should get back 1.91

    Here is the Output
    The Change Due is:...
  17. Replies
    6
    Views
    4,013

    Re: Trying to Give Coins For Change

    So I put the code in the givechange() method instead and it gave me the result of 25.
    I found out this result is the total amount of coins to give back.
    return dollarsint + quartersint + dimesint +...
  18. Replies
    6
    Views
    4,013

    Re: Trying to Give Coins For Change

    Okay So I went back and had the doubles converted to ints. Lol, however, I had to convert them back to double so the equations would work. I'm error free however, when I call the method it gives me...
  19. Replies
    6
    Views
    4,013

    Trying to Give Coins For Change

    I am working on a program where you have to give change in coins. The program already gives the change amount, I'm just trying to figure out how to give the change in coins. This is what i have so...
  20. Replies
    2
    Views
    919

    Re: No Output in Program:

    Lol wow. Thank you very much Newbie, I appreciate it.
  21. Replies
    2
    Views
    919

    No Output in Program:

    I am working on a Object Oriented Program that gives change for a certain Purchase. You give it the purchase amount and the coins and amount of coins that you are paying with.

    The problem is that...
  22. Replies
    1
    Views
    2,096

    ArrayList for 2DPoints

    I just started my second quarter of Java. I'm in Java 2 now anyways I was given this as my first assignment:

    Implement a Class Polygon that contains an array List of Point2D.Double objects....
Results 1 to 22 of 22