User Profile

Collapse

Profile Sidebar

Collapse
Totally Stumped
Totally Stumped
Last Activity: Jan 27 '12, 09:56 AM
Joined: Oct 14 '11
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Sadly, I only marginally got this program to work. Even after the buttons were fixed, it still was a mess. So I'm trying a simpler program right now and will attempt the inventory program again later. Thanks rotaryfreak for trying to help. :)
    See more | Go to post

    Leave a comment:


  • Totally Stumped
    started a topic JButtons and maybe JTextArea not working
    in Java

    JButtons and maybe JTextArea not working

    I've hit a brick wall. I have an GUI inventory program that has three buttons and one textarea. I can get the GUI to appear and the input is correct. But my buttons won't work. When I click the Next button, I should see the next inventory item. Previous doesn't work and neither does Exit. And I a have a sinking feeling that there's something wrong with the logic to modify the textarea, but until the buttons function I can't be sure. Can anyone...
    See more | Go to post

  • Totally Stumped
    started a topic error <identifier> expected
    in Java

    error <identifier> expected

    Hello again folks. I have an error that I can't figure out. Here's my but of code, I can post the whole thing if necessary, but the program is getting big.
    Code:
            private RandomAccessFile output;
    	private String NUMBER_OF_RECORDS;
    
    	//Create a product
    	CD myCD = new CD( "", 0, 0, 0.00, 0.00, "Band" );
    
    	//Get the length of the array
    	NUMBER_OF_RECORDS = JOptionPane.showInputDialog(
    ...
    See more | Go to post

  • Never mind folks, someone suggested the compareTo() method and that solved everything
    See more | Go to post

    Leave a comment:


  • Totally Stumped
    started a topic bad operand '<' I can't compare two Strings
    in Java

    bad operand '<' I can't compare two Strings

    I'm getting a bad operand types for operator <. first String. second string.
    I get want the error means, so I'm assuming that I can't use this operator to sort my array of objects. Is there some other way for me to sort this array out. I need to sort the array by the Artist name.
    Here's my new code
    Code:
    public class Product
    {
    			//DECLARE VARIABLES
    	private String number;     //Item Number of product(
    ...
    See more | Go to post

  • Why is my type unexpected? required variable found value

    I'm trying to sort an array of object by the name of the Artist. But I keep getting an error message. Why am I getting this message?
    Code:
    //Program to Display Inventory
    /*Tiffany Walker
    IT215 Java Programming
    October 6, 2011*/
    
    import java.util.Scanner;  //allows user input
    import java.util.Arrays;  //allows us to add to the array
    
    public class InventoryDisplay
    {
    	//Main
    ...
    See more | Go to post
    Last edited by Niheel; Oct 15 '11, 10:53 AM. Reason: error details pertaining to quetion merged with question

  • Totally Stumped
    replied to My loop isn't working
    in Java
    Got the answer.
    total += inventory[counter].value( CD.getPrice(), CD.getUnits());

    This properly adds the value through the array!
    See more | Go to post

    Leave a comment:


  • Totally Stumped
    replied to My loop isn't working
    in Java
    Code:
    for ( int counter = 0; counter < inventory.length; counter++ )
                 {    
      
                          System.out.println( inventory[counter ] );
                 }
    After the user inputs the data which is added to the array, this code shows on the screen a summation of the data. The method that controls how that data is displayed in found in the Product class.
    See more | Go to post

    Leave a comment:


  • Totally Stumped
    replied to My loop isn't working
    in Java
    When I run the code, I get an output that shows the product#, name, price, amount, and value for each product in the array. The value show up and are correct. But when I try to add the values together (using the various versions of code I tried) either I get 0.00, or the only the last value calculated, or the last value times the array.length.
    See more | Go to post

    Leave a comment:


  • Totally Stumped
    replied to My loop isn't working
    in Java
    It wasn't working either way, but I figured try each. I've exhausted anything I thought was the problem. I'm just trying anything at this point. Desperation...
    See more | Go to post

    Leave a comment:


  • Totally Stumped
    replied to My loop isn't working
    in Java
    This is the changed code.
    Code:
    //Using inventory.length as a counter, loop input and output
    		for ( int counter = 0; counter < inventory.length; counter++ )
    		{
    			System.out.print( "What is the product number of the CD? ");
    			String theNumber = input.next();
    			CD.setNumber( theNumber );
    			System.out.println();
    
    			System.out.print( "What is the name of the Artist? ");
    ...
    See more | Go to post

    Leave a comment:


  • Totally Stumped
    replied to My loop isn't working
    in Java
    CD is an object made from Product class. Inventory[] is filled with CD's. I tried moving the total calculation to the other loop, but it didn't work.

    If you were trying to add data in array together, how would you go about it. Perhaps I'm tackling the problem the wrong way.
    See more | Go to post

    Leave a comment:


  • Totally Stumped
    started a topic My loop isn't working
    in Java

    My loop isn't working

    I'm making an inventory program for class. It has a loop that should cycle through the array and print the information. Part of the loop is supposed to add the value from each inventory item together to get the total value of the inventory. However, instead the program simply adds the last value entered to itself repeatedly. There is no compiler error, but the program isn't doing what it should.

    Here is my code for the Product...
    See more | Go to post
No activity results to display
Show More
Working...