Jameson Locke

+ Follow
since Mar 19, 2017
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jameson Locke

Sorry last bit isn't right

Not sure what I'm doing wrong at this point. Pretty annoying question.
1 week ago
Alright been trying to do this for a while now and ended up with this, there's still some errors in the logic though. Would anyone recommend a better way or improvements upon this ?

1 week ago
Hey all just got back from a java interview, didn't go very well unfortunately . I took a picture of the question in the hopes of understanding how to solve it but I still cant wrap my head around it, can anyone provide the solutions.

You are given an array on integers n length n for a driver. The integer at index i symbolizes the time allocated to her or his i'th task in minutes. The optimal time for a break s between two tasks i and i+1, when the sum of all tasks from 0 to i equals the sum i+1 to n .

Write a method that returns index i where the condition above is met. If there is no such index the driver is not awarded a break and the method returns null.

Input [1, 4, 1, 3, 1] -> Output 1
Input [1, 4, 1, 3] -> Output null


Can you find a solution that efficiently handles 3, 4, ..., m breaks ?

Thanks in advance!
1 week ago
Hey all, I am currently doing an assignment that requires me to implement any 2 design pattern to improve the "usability" of a system. I have put the word usability in parenthesis, because measuring it to any standard or baseline is problematic, I have researched for such methods and they do exist. However, in the context of game programing (Tic Tac Toe) its a bit more confusing, according to the research I have read depending on the game various types of usability measurements are used. For this instance I will be conducting a survey that asks how more "user friendly" the application was before and after the implementation of the design patters and comparing the two.

I have used the command design pattern for my first implementation of Tic Tac Toe. Functionalities such as Undo and Redo have been added and allow the user better overall control of the game in case they mis click.

Now heres the problem, I cant quite think of another design pattern that would help improve the usability of Tic Tac Toe. Additionally, I would rather not start coding a new system from scratch, since the point of this assignment is not to improve coding skills rather improve your overall understanding of design patterns and how they are implemented.

My understanding of design patterns thus far is that it should not be implemented by force. Instead it should be used if your faced with a problem that suits the needs of a pattern (does that make sense?). Regardless the work says I have to do it, so I will.

On a side note I have researched a pattern called MVC, I don't fully understand it. However, there is sample code online of it implemented with tic tac toe. Could this pattern be used to help "Improve the usability" of a system?

The question is quite long, but I've been thinking about it to myself for quite a while I felt that maybe I should involve other people who could be of assistance regarding this matter. Thanks in advance =.
11 months ago
I somehow managed to do part of it. I created a demo system as a test (using text field instead of JTable to show information by clicking a button) and it was a  success, I managed to create a txt file and the text field would read it and display the information.

Now I created a txt file for Cars, and am in the process of letting the JTable read it.

Below is the code I used to create the txt file. (Line 34 to be precise)

Making the TextField read was quite simple, making a JTable isn't as straight forward. I went to table events and clicked on propertychange since that makes the most since and inserted the same code I used for the TextField but there is an error on line 6. When I siwtched it out for the textfield variable name it worked fine. Did I choose the wrong events or do I have to do something else entirely.

2 years ago
Well I'm officially stumped, I've been trying to read and write the tables content to a txt file for the past 3 days. Watched countless videos and read way too many similar question asked on this forum and other forums.

What Campbell Ritchie said makes sense but I simply don't know how to act on it. As for Paul is latest comment I fixed those parts.

As it turns out I simply have not put in enough practice into JAVA to make this system.

Thanks everyone for helping out. Also I'm not sure whether to mark this page as solved or just leave it as it is.
2 years ago
I'm a bit lost now I understand what both of you are saying but I cant seem to do the code.

Now I'm having troubles writing the JTable data to text and reading text file in order for the information to stay on the table even when i close the application.

I don't understand what I'm doing wrong the application runs fine and when I checked an hour ago it even wrote information to a txt file (only worked once).

2 years ago
Thanks for organizing the code.

Do you know how to write something to a text file?  

Yes I do, but I'm having troubles implementing it with the Jtable that I've created. No videos on YouTube so far explain how to do it.

As for the date handling, I agree but just haven't gotten around to refactoring it yet.

In fact I don't like subclassing GUI classes if at all possible.

If you don't mind me asking, why ?

I'm currently in my first semester of university and this is an assignment. I'm using the exact same methods that the lecturer showed me.

Sorry for the late reply didn't think anyone would reply this quick.
2 years ago
Hi all. I'm new to programming so I apologize if the question may seem stupid, I've searched many websites to help resolve the issue, but couldn't find any answers.

I'm currently making a car transport system and need help storing the information I input to the table to a txt file so the information can remain when ever I close the table.

I didn't do much coding since I don't know exactly what to do. I would appreciate it if you could also explain the process. The coding I did though is down below.

Image of table >  http://imgur.com/WqbhDer

2 years ago