Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, it depends on where your code stands now after addressing the other two things I mentioned.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

No, "code" is the tag name.

[code] your code goes here [/code]

You can also highlight the code and click the little "#" button on the toolbar to surround it with code tags.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You need to either specify the collection type with Generics

Data one = new Data("bob", "jackson", "123 main street", "781-345-3245"
	
LinkedList<Data> list = new LinkedList<Data>();		
list.add(one);
 list.getFirst().output();

or cast it to your Data type prior to calling methods on it.

Data one = new Data("bob", "jackson", "123 main street", "781-345-3245"
	
LinkedList list = new LinkedList();		
list.add(one);
Data first = (Data)list.getFirst();
first.output(); 
// or
((Data)list.getFirst()).output();
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

First, use [code] [/code] tags around your code so it remains readable.
Second, get the "double" out of that expression you posted the error on (line 30). It doesn't belong in there.
Lastly, I don't think input.next.Int() is a valid method on the the Scanner class. Check the API.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

There are a couple of different ways you can do it. Either of the provided Timer classes can be used to schedule a repeated task to update your internal variables (i.e. seconds). You can read about when to use which here. Alternately, you could have a simple thread running a loop that sleeps 1000 ms, updates your time variables, and schedules a repaint on the the AWT event queue (with invokeLater())

Any of these methods can slip a little time over the long run if you update your internal time with something as simple as seconds++; due to process time slicing, garbage collection, etc. If you want your time to remain more accurate over longer periods, you can update your instance time variables from the difference in System.nanotime() since your last update.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

And what would you do after you find "that" partner you are looking for ?

Professor Chaos is born...

stephen84s commented: lolzz nice +5
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

He is referring to the "Read Me:" posts at the top of this forum: http://www.daniweb.com/forums/forum64.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I only see one logical place for it, given the structure of your ShoppingSim driver program. Where do you think it should go? Where would it make sense to create a new cart?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I Have That Same Problem........Will somebody please help!!!!!!!!!!!!

That's not enough exclamation points to bring the posters back from 2004.

Nick Evan commented: No?!??! :) +13
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

make website

Did it work?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Oh, I think it's printing the cart just fine.

The problem is that your menu choice handler creates a new cart every time it's called.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The Collections Framework has implementations of many such data structures. You only have to write your own if you need functionality that is not available with the existing ones - and even then you can probably just use composition to delegate most of the work to an existing implementation and add whatever extra you need.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Take a look at the String.split() method.

Scanner would work for that as well.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

So did you input 2 numbers for it to use? Your scanner is waiting for input.

Rashakil Fol commented: heh +9
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You may want to review some of the material in the "Starting Java" thread that is stickied at the top of the forum for basics.

What part of the assignment do you not understand? What do you have so far?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Hint: trace the value of "index" through your program.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I would guess that only the first element of your array has a value and that it is the last double from your file... ?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Glance through the methods on the Scanner class. I think you'll spot a couple that stand out.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Ok, there are actually two issues on that line. Your "index" variable is declared as double but used as an integer index to your array. It should be declared int. Secondly, inFile.next() returns a String. You cannot directly store that into an array of double.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

prashant, that is not the reason for his null pointer. The null pointer exception is from calling methods on his "db" class variable when he has not initialized it.

public static void main(String args[]) {
        
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new ImportDataGUI().setVisible(true);
            }
        });
        [B]// 'db' is still null here[/B]
        Connection conn = [B]db.connect[/B]("jdbc:mysql://localhost:3306/Registrar","root","Alyssa01");
        [B]db.importData[/B](conn,args[0]);
    }
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You're getting the null pointer because you have declared the "db" variable, but you have not initialized it in main().

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Mostly because there is nothing up the call stack to deal with it.

I guess it's just a pet peeve when I see that because too often you see students writing their entire program in main() and slapping a throws clause up there without even really knowing what it does or why they have to have it there (I literally heard "I was told I had to put that there to make it compile. I don't know what it's for."), rather than learning why a try-catch block is required around certain sections of code and how to write one.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I would add another vote for Avast. I use it at home myself.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Edit your post and use [code] [/code] tags around your code. Reading that unformatted wall of text will turn many away.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The problem is that you have overridden the complete painting behavior of the JFrame (and the components within it) by replacing its paint() method. At the very least, you would want to place a call to super.paint(g); before your own code.

A better solution would be to add a small class that extends JPanel and overrides the paintComponent(Graphics g) method to serve as a canvas for your shapes to be drawn on. You would then just add that panel in as another component in your JFrame.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, you're going to need a variable to keep track of the largest number entered so far. If you think about it a minute, updating that variable should be pretty easy in your input loop.

On a side note, never throw exceptions from main(). Use a try-catch block.

Also, use [code] [/code] tags when posting code so that formatting and indentation is preserved.

edit: Bah, was replying when the above was posted...

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

your problem.. not mine

No, your inability to make sense really is your problem, not his.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Try deep breathing.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I seriously doubt you are going to get anyone to fill in the blanks for you on this. It sounds too much like a current quiz and that won't fly well here.

Perhaps you should ask specific question about portion that you do not understand or fill in what you believe is correct.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

No reason to be mad at all. Just correcting the information :)

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

And btw, all Dual Cores below 8000 series are 65nm, not 45. :sad:

You may want to review the specs:
E5300
E7300
Both 45mm.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

If you can't keep track of 6 or 12 cokes and your own rate of consumption well enough to tell if someone's stealing them, you certainly aren't smart enough to figure out an algorithm for it. You probably aren't even smart enough to be working there at all.

Rashakil Fol commented: That's not the point of the puzzle :P -2
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

What have you done in your code so far? I gave you a model to start with above. Did you read it? Did you understand it?

I am not going to write examples of how to do every single thing you request - especially when you are too lazy to even type all of the letters in a sentence.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

To get more control over the layout, you'll need to learn more about the various layout managers that are available. The following tutorial has a lot of information and samples: http://java.sun.com/docs/books/tutorial/uiswing/layout/index.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Neither one. I don't write console applications. :P

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You should have very little code at all in main() - the majority of it should be in separate classes and methods.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Welcome.
You'll have an easier time in the IT field if you replace your defective keyboard. It's not typing all of the letters consistently.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I'm not sure what your professor is expecting you to use here, but a fall-through switch works pretty well for the gifts due to the additive nature of each successive case:

System.out.print("On the ");
        
        String dayString = "";
        switch (day) {
            case 1:
                dayString="first";
                break;
            case 2:
                dayString="second";
                break;
            case 3:
                dayString="third";
                break;
        }

        System.out.print(dayString + " day of Christmas, \nmy true love gave to me\n");

        switch (day) {
            case 3:
                System.out.println("Three french hens,");
                // fall through
            case 2:
                System.out.println("Two turtle doves");
                // fall through
            case 1:
                if (day > 1) {
                    System.out.print("and ");
                }
                System.out.println("A partridge in a pear tree.");
        }//end switch

Arrays to hold the day names and the gifts would also work well and, in that case, a while loop would be appropriate to count down through the gifts.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Because you are looping while day is greater than zero. If you only want the single result, remove the loop.

Another thing to consider though: you are retyping all of the gifts from other days on each case, which is unnecessary because the lines are additive. Each day adds a new line, but the previous lines are the same. Your code should reflect that.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The following article may be helpful as well: Programming a Spider in Java

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, the first place to start would be here at the tutorial on networking: http://java.sun.com/docs/books/tutorial/networking/index.html

As a basic outline, you would need to maintain a collection of URLs to visit, connect to each URL and retrieve the content, parse the content and store what you want in the database, then move along to the next URL.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Too late. Already hit 1000.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Okay, here is a bare-bones example. I've included the EditorPanel here as an inner class just for convenience sake. You would actually want that to be a separate top-level class.
(For future reference, if you want people to take the time to help you out, the least you can do is expend the effort to type complete words. There is no "u" here. Punctuation wouldn't hurt either.)

import java.awt.BorderLayout;
import javax.swing.JEditorPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.text.Document;


public class TabbedEditorExample extends javax.swing.JFrame {

    public TabbedEditorExample() {
        initComponents();
        
        // Add a couple of editor panels for example purposes
        addEditorPanel("C++");
        addEditorPanel("Java");
        
        setBounds(100, 100, 300, 300);
    }

    /** Add a new editor tab */
    protected void addEditorPanel(String name){
        tabbedPane.add(name, new EditorPanel(name));
    }

    /** Example of getting the currently selected editor */
    private EditorPanel getSelectedEditorPane(){
        return (EditorPanel)tabbedPane.getSelectedComponent();
    }

    /** Example of getting the currently selected document. */
    private Document getSelectedDocument(){
        if (tabbedPane.getComponentCount()>0){
            return getSelectedEditorPane().getDocument();
        } else {
            return null;
        }
    }

    /** This class just encapsulates the component details of the editor panel */
    class EditorPanel extends JPanel {
        private String name;
        private JEditorPane editorPane;

        public EditorPanel(String name){
            super();
            this.name = name;
            editorPane = new JEditorPane();
            JScrollPane scrollPane = new JScrollPane(editorPane);
            setLayout(new BorderLayout());
            add(scrollPane, BorderLayout.CENTER);
        }

        /** Provides access to the text document. */
        public Document getDocument(){
            return editorPane.getDocument();
        }

        public String getName(){
            return name;
        }
    }

    private void initComponents() {
        tabbedPane = new javax.swing.JTabbedPane();
        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        getContentPane().add(tabbedPane, java.awt.BorderLayout.CENTER);

        pack();
    }

    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() …
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

http://maddox.xmission.com/beat.html

I disagree totally!

HITTING,ETC DOES NOTHING BUT HURT THEM MENTALLY.....

When they do something bad,they should be delt with WITHOUT VIOLENCE (If possible)

If you actually took it as a serious article, you could use a slap yourself.
http://en.wikipedia.org/wiki/Maddox_(writer)

A second slap for typing in caps for no good reason.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

So post your current code and explain exactly what you are having trouble with, as you were told above. This is not a "code by request" forum.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, you could find it by walking down the container hierarchy from the selected tab with instanceof checks, but I'd consider that an awful hack. You're better off writing an EditorPane class that encapsulates the components of each editor pane. Each tab would contain a single instance of EditorPane and have the necessary references to obtain the text.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, you can either remove them or rename the variables - but you can't declare two different variables with the same name within the same scope.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

This site has quite a lot of information on DSP: http://www.101science.com/dsp.htm

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Hmm... let us think about it for awhile...

No.

Read the forum policies on homework and demonstrating effort. For that matter, read the section on using proper English too - this isn't a chat room.

Salem commented: Keep up the good work, unlike some of the soft-heads who -ve rep for telling lazy students what to do. +27