Search:

Type: Posts; User: kenster421

Page 1 of 3 1 2 3

Search: Search took 0.87 seconds.

  1. Replies
    5
    Views
    554

    Re: A deadly combination

    I can see your desire to use the Strategy Pattern to fulfill your need of CRUD; however, do not let Design Patterns entice you into doing something that is, programmatically, a poor decision.

    When...
  2. Replies
    7
    Views
    1,653

    Re: Calendar from user input PROBLEM!

    On any given calendar there are 5 weeks given that 31/7 = 4.42...

    A simple way to think of the calendar is that it's like an array: 5 rows, 7 columns;

    int[][] dates = new int[5][7];


    You...
  3. Replies
    1
    Views
    487

    Re: Dymaic Casting of List

    The easiest way is to use inheritance. The best way is to use object composition.

    How will you decide which object you want to cast it into? Why does your "List object" not contain a parameter....
  4. Replies
    7
    Views
    1,653

    Re: Calendar from user input PROBLEM!

    It wont go past 9 because you have a limiting if statement in your logic. Why is it there?
  5. Re: Tic Tac Toe Program, Can someone help me out????

    You need to use debug and step through your code, line-by-line. It isn't complicated and should give you a good idea of where you are going wrong. After a cursory look at the code, I can't see any...
  6. Replies
    8
    Views
    1,232

    Re: ArrayList question

    In order to create your own hashmap, you need a key->value pair.

    This would be helpful:

    public class HashMapImp
    {
    public static void main(String args[])
    {
    MyHashMap mhm = new...
  7. Replies
    1
    Views
    1,013

    Re: read a file word by word

    You should read the entire file into a String and use the replace method for strings.
    String (Java Platform SE 6)
    Note that since you want to switch tags around you will need to create a temporary...
  8. Replies
    30
    Views
    2,239

    Re: Strings not being added to arraylist

    You left out some key details. What does your constructor for Roster actually do? I see that you define teamRoster in class Roster immediately. Do this in the constructor to ensure that it gets...
  9. Re: How to convert local path drive to UNC path

    Basic String concatenation should do just fine.

    Change your \ to / and follow the UNC conventions.
  10. Replies
    3
    Views
    1,252

    Re: Using Comparable in Binary Search

    The comparable interface will assist you in comparing objects.

    Comparable (Java 2 Platform SE v1.4.2)

    You will need to implement the methods in your class BinarySearch when you add the...
  11. Replies
    1
    Views
    1,816

    Re: double LinkedList (insersion sort)

    What you need to do is implement a Doubly Linked List and ensure that you have add(), insert(), remove() working correctly.

    Insertion sort is one of the easiest algorithms to implement.

    After...
  12. Re: Problem with Reading very long line using bufferedReader

    Apparently, BufferedReader is better for reading line streams from a text file and the limit for strings is 2 billion characters. My suggesstion: read the file one character at a time...
  13. Re: Problem with Reading very long line using bufferedReader

    Try using a scanner instead:


    Scanner scanner = new Scanner(new File(inFile));

    while(scanner.hasNextLine())
    {
    System.out.println(scanner.nextLine());
    }
  14. Replies
    3
    Views
    707

    Re: Data Structure

    Using data structures effectively is all about thinking about how a program needs to operate. Yes, arrays do have a fixed size, but you can always create another array.

    Consider this example:
    ...
  15. Re: Finding Multiple Equal Max Values in an Array

    Using an ArrayList seems like overkill.

    I think you should use multiple methods:

    int getHighestScore()
    Player[] getWinners()
    void printWinners()

    Inside the getWinners() method, you create...
  16. Re: [Method] How to calculate the sum of a Row or Column in a Multi Dimensional Array

    The first thing you should realize is the "direction" that the active element takes in a multidimensional array when traversing through it.

    The 2D array:

    int[][] matrix = new int[3][4];...
  17. Re: Simplest Problem but i am unable to understand it, WHY???

    Mr. 777,

    You have a logical error in your post that
    'a' is not an object, it is a reference to an object of type A.

    You have classes A and B where B is a subclass of A.

    In your code, you...
  18. Replies
    3
    Views
    730

    Re: SORTING ALGORITHMS...

    First, read this on Selection Sort: Selection sort - Wikipedia, the free encyclopedia.

    Make sure you are following that algorithm.

    If the length of the arrary is n, you will make n passes. On...
  19. Replies
    3
    Views
    2,617

    Re: Simple client-server chat program

    This site has simple solutions for TCP and UDP servers that you can use to establish if what you are doing is correct.

    A Simple Java TCP Server and TCP Client | systemBash
  20. Replies
    2
    Views
    1,052

    Re: Palindrome program help

    What is the point of this code segment?

    After you ask for a palindrome, you assign it to strippedInput and then immediately expect more input. Why?



    What if the string has an even number of...
  21. Replies
    4
    Views
    403

    Re: Length of Java source files?

    The good thing about Java is that you can break apart large files like the one you are writing into multiple files easily via copy/paste. Java was designed to be an object-oriented language, so there...
  22. Replies
    3
    Views
    431

    Re: How can I refer methods ??

    Methods do not get "connected". One gets called and can call another.

    If I have a class, Foo, and two methods in that class, barOne() and barTwo(), then I can choose to call them like so:
    ...
  23. Replies
    4
    Views
    1,564

    Re: ArrayList (Inheritance)

    While I will concede that the case of a Tree is a good reason to employ this, I cannot think of any reason that a Graph should contain a collection of Graphs. If this is the functionality needed, use...
  24. Replies
    4
    Views
    1,564

    Re: ArrayList (Inheritance)

    Maybe I'm a stickler for OOP, but I'll ask anyway.

    Why is there a collection of Things inside of class Thing? It's like putting a collection of Computers inside of class Computer. It's possible I...
  25. Replies
    6
    Views
    712

    Re: Help with my CPU Scheduler

    I'm with copeg
Results 1 to 25 of 68
Page 1 of 3 1 2 3