Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

Java (help)

Name: Anonymous 2006-04-04 19:36

You are to create two classes to implement a database program.  The main class is a menu of options and will create an arraylist() to store the objects.  The other object contains the data that will be stored in the array list


Data Class

You are to create a class that implements the comparable interface and stores data.  It is similar to the contact method in the book.  It should have the following methods:
-    A constructor method
-    A get() and set() for each data element
-    String toString()
-    int compareto(object)

For example, if the class was a ASU_student, you might have a student id, first and last names, and a debt.  Then you would have:
-    void ASU_student( id, first, last, debt)
-    String getid(), String getfirst(), String getlast(), double getdebt()
-    void setid( id), void setfirst( first), void setlast( last), void setdebt( debt)
-    String toString()
-    int compareto( obj);


Main Class

In this class, you will create an arraylist to store objects of the above Data Class.  This class will prompt the user, via a menu, to perform the following operations, until the user decides to quit.

1.    Add an object to the list – the object should be unique.  Thus, you will need to search the list before adding to make sure the Key is not already there.  The key can be any data item (ex. student id), or combination of data items (Band + CD).
2.    Display an object from the list.  Ask for the key, search, and display all the data for the object, or that it was not found
3.    Remove an object from the list.  Ask for the key, search, and if there remove it.
4.    Modify an object from the list.  Ask for the key, search, and update the non-key fields.
5.    Scan the database for some sub-information, or non-key fields.  For example, you may want to display all records with a certain last name, or CD name, or range of GPA, ...


As Extra Credit, try reading in the database from a text file when the program starts, and saving it to a text file as the program exits.

Look at the book examples and the on-line documentation to see how an arraylist is used.

Name: Anonymous 2006-04-04 19:53 (sage)

>>1
Translated:
HAI. HALP ME DO MY HOMEWRK. LOLOL. KTHXBAI.

Name: Anonymous 2006-04-04 21:01

As a marker I can tell you that we appreciate it if you don't hand anything in.

Name: Anonymous 2006-04-05 3:46

Name: Anonymous 2006-04-05 6:50

We could actually stop bitching and help. I would help if it were not Java; Java makes me sad.

Name: Anonymous 2006-04-05 7:09

I would help if it were a specific problem and not just some guy who can't be bothered doing his homework.

Name: Anonymous 2006-04-05 7:37 (sage)

>>5
HAI. HALP ME DO MY HOMEWRK. LOLOL. KTHXBAI.

Name: Anonymous 2006-04-05 9:49

ham ka chan

Name: Anonymous 2006-04-05 13:12 (sage)

>>5
>Java makes me hate all life.
Fixed.

Name: Anonymous 2006-04-06 20:33

>>1 It should have the following methods: A get() and set() for each data element

And what the fuck are those "data elements"? My 8-ball is broken, I would help but I'm not a fucking wizard...

Name: Anonymous 2006-04-06 20:53 (sage)

I love how he doesn't even include a message asking for help. Gets right to the point. In fact, it's as if he were assigning this homework to us.

Not to mention the fact that a 12 year old retard could figure this out by himself while crying from being slapped around by his abusive alcoholic father.

Name: Anonymous 2006-04-06 22:34

>>10
Fails for even trying to help.

Name: Anonymous 2006-04-07 2:52

>>12 yeah, heaven forfend anyone in /prog/ help someone *gasp* program.

Name: Anonymous 2006-04-07 3:28

>>13
DOING YOUR HOMEWORK FOR YOU IS NOT HELPING.

Name: Anonymous 2006-04-07 3:30

>>13 Helping you with programming does not mean doing your homework for you.

Name: Anonymous 2006-04-07 6:59 (sage)

>>13
Asking for homework help is widely considered unacceptable, not just on world4ch. Just try doing it in an IRC channel like ##java on irc.freenode.net; they will yell at you like you ate their testicles.

Name: Anonymous 2006-04-07 12:57

>>16
And what is this place supposed to be if not to help each other? Language flamewars between Ruby and Python? I'd like to help >>1 but I don't even understand what his problem is.

Name: Anonymous 2006-04-07 19:29

Here is the solution for the first class:
class Data implements Comparable
{
    public Data() { }
    public int get() { return 42; }
    public void set(int i) { /* I don't care, I prefer 42 */ }
    public String toString() { return "Hello, world!"; }
    public int compareTo(Object o) { return 666; }
}
Maybe you can be more precise next time. Why don't you scan your assignment and put it on ImageShack, maybe I can help a bit.

Name: Anonymous 2006-04-07 19:33

>>17
No sir. This forum is supposed to be an ongoing flamewar between Perl, PHP, Ruby, Python, Lisp, Scheme, C, VB, and many other languages. We'll agree to one thing though - Java sucks.

Name: Anonymous 2006-04-07 22:40

>>18

In a few years, you'll realised that >>1 will turn out to be your co-worker or new manager, and that somehow got a BSc Degree and knows shit little about basic programming.

I'm sure you'll be ESCATIC to find out that you helped someone who can't even implement a simple OO Object defination get that degree.

We, people who perhaps code for a living, on a whole, thank you for putting cut and paste "coders" through university.

Name: Anonymous 2006-04-07 23:08

>>20
Dude, did you even read the code?

Name: Anonymous 2006-04-08 5:07

>>20
You code for a living?

Name: Anonymous 2006-04-08 7:12

I code for a living and I'm not >>20, so there must be at least two people coding for a living here. And the best of all: it doesn't imply Java. This keeps me happy.

Name: Anonymous 2006-04-08 7:58

>>23
No because >>20 was lying, you're the only one coding for a living here unless you're a troll too.

Name: Anonymous 2006-04-08 8:30

>>24
Just because you are a troll, doesn't mean everyone else is.

Name: Anonymous 2006-04-08 8:49

I hate Java, but do your own fucking homework.

Name: Anonymous 2006-04-08 13:56

sigh. i teach and code java for a living. you all suck. except >>18 for spending 2 seconds of his/her life helping a student that should be failing.

hey man, stick with brick laying ok?

Name: Anonymous 2006-04-08 23:06

>>1
YOU FORGOT THE FRIES IN MY ORDER AGAIN!

Name: Anonymous 2006-11-14 21:26

help me

Name: Anonymous 2006-11-15 5:49

>>1
Java (help)
This is supposed to help us how?

Name: Anonymous 2006-11-19 13:37

>>10
i would be guessing data elements would be instance variables.
you just suck though.

Name: Anonymous 2006-11-19 14:03

>>30
Give a man a fire and he'll be warm for the rest of the day, put the man on fire and he'll be warm for the rest of his life.

Name: Anonymous 2006-11-19 15:33

Okay, so someone is being held over a pit of lava and we have to cool off the lava before we get him loose. Okay! Let's call on Iceman!
Hmm? No? Iceman's powers have no effect on lava? Oh well, I guess we'll have to find a cauldron to pour on the lava! Okay, Iceman, you're off the hook, lukewarm water has saved the day!
The same applies to when you find someone trapped in a block of ice - can the Human Torch or Ghost Rider melt it? No. But you know what can? THE INDIRECT RAYS OF THE SUN.
The logic, it breaks. There's even a part of the game where they say "USE SOMEONE'S LIGHTNING POWERS" and when you do, it works. Simple as that. So why not make ice powers, you know, have icy effects?

Name: Anonymous 2006-11-19 23:13

>>33
Copypasta of Dom's blog now? Only in /prog/.

Name: Anonymous 2010-06-02 13:12

WARNING: NECRO BUMP - DO NOT REPLY

Name: Anonymous 2010-09-09 4:55

#OH HAI

Name: Anonymous 2010-12-17 1:34

Are you GAY?
Are you a NIGGER?
Are you a GAY NIGGER?

If you answered "Yes" to all of the above questions, then GNAA (GAY NIGGER ASSOCIATION OF AMERICA) might be exactly what you've been looking for!

Name: garrett 2012-08-12 1:32

Name: Anonymous 2012-08-12 2:00

>>39
If I answered "No" to the first and second, but "Yes" to the third, what options do I have?

Name: Anonymous 2012-08-12 5:08

>>39
God, I remember when I used to see that shitty spam daily. Not just here, but even places like Slashdot. Can't imagine anybody ever thought that was funny. And newfags try to pretend the internet used to be good.

Name: Anonymous 2012-08-12 8:32

>>39
Tsk.

Name: Anonymous 2012-08-12 10:46

check 'em

Don't change these.
Name: Email:
Entire Thread Thread List