JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

fpru: Forensic Psychiatric Rehabilitation Unit, according to Google. Appropriate?

rproffitt commented: With bots committing suicide today, sounds right. +0
diafol commented: ha ha ha. Give it a label :) +0
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Don't get too excited... I cannot confirm that your ideas (which I am not privy to) are not crazy nor plain stupid. All I'm saying is that paradigm busting ideas seem crazy at first, and most of them are crazy, but once in a blue moon there's one that's not. Only time will tell.
I wasn't suggesting that you are a criminal, just that wasting the talents you have like this should be a criminal offense :)

Your last paragraph is spot on.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

If it's not code for the startup or for the GUI then probably yes.
This is such a tiny program you should just get on and do it without any more worrying. If you get stuck people here will help.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

OK. In that case just re-write it. It's far too small to have much in the way of reusable parts.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

The tragedy here is that UI is obviously a highly intelligent and articulate person, but those attributes are being criminally wasted trolling an irrelevant web site when he should be building a demo or proof of concept for his ideas and seeking partners to bring them to fruition. OK, maybe the odds are against him, but that's true of every new idea. What's certain is that wasting time composing drivel isn't going to improve those odds.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Without seeing your code there's not a lot more I can say. IF it's modularised well then you will just need to replace the startup code (p s v main) to fit with Android, and replace the Swing GUI elements. If it's not well modularised then you'll have to re-write it.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Still running 30 minutes already...

Unless you have some horrendous recursive algorithm, anything more than a few seconds is wrong. Sounds like you have an infinite loop.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Maybe because you have four ? parameters but you set only 2 of them???

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

In your driver you are calling add etc BUT you don't say which object to call them on - so it defaults to the current object, which is the Driver class.

ie. you should be saying avlTree.printTree(); not just printTree(); and it will call the versions that are defined in AVLtree.

The problem with the Node types looks like (but I don't have time to check it all out)... you are getting a Node object from somewhere and trying to call methods from AVLNode on it - which fails because the superclass knows nothing a bout the subclass. If you happen to know that the object is really an AVLNode then use the cast recommended in the message so the Java compiler knows the calls are OK.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

I have some idea based on prior research that I need to leave my superclass methods as stubs.

No, that's wrong. If you create a method in a subclass that has the same signature (name, return type, parameter types) as a method in the superclass then that's an override. The superclass method does not have to be "stub" or abstract - it can be (usually is) a full method definition.
If yours isn't working then either the signatures are different or there's something wrong with the way you are calling them.

Oracle's tutorial may clear up your confusion, but if not, post your code here for more help.

ps: A simple example: The Object class defines and implements a method String toString() that returns its class and hash as text for any object.
Every class extends Object (directly or indirectly) and most implement their own version of toString that returns something more relevant. Java automatically uses the correct version of toString whenever it is called eg when you print an object using println

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Yes, but the guys at SO seem to be doing a good job, so there's no point duplicating it unless you get stuck again.

rproffitt commented: Many chefs make a fine stew. But not much else. +12
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

A perfctly good suggestion, but it would be simpler to let the array elements default to zero, then you wouldn't need to initialise it or add 1 at the end!

thines01 commented: A better option for the solution! +13
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Java is HUGE in scope - I doubt that any Java developer ever knows all its aspects.

Have a look at Oracle's Java tutorials - in my opinion the best and only ones worth working with. The overview is here. You definitly need to be familiar with all the stuff in the "Basics" trail, the JDBC database access section, and most probably either the Swing or JavaFX GUI section. After that it depends on what applications you will be writing. Note that this is just Java SE - the core language and APIs. After that there's Java EE ("Enterprise Edition") that adds lots of extra stuff, most notably for writing large-scale corporate web server database apps. There's also Java for Android which is very similar to Java SE with some extra stuff to interface with the Android OS in the way Android expects.

So, that's an overview of the whole thing. I hope you realise now that you will need to start with a small subset of all that, and that which subset you chose depends entirely on what kind of application you will be writing. If you can clarify that then people here can help you focus in the right areas.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

i haven't figured out how to read the file starting from the third line

Just read and discard the first two lines.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Read this https://www.daniweb.com/programming/threads/435023/read-this-before-posting-a-question then start again with all the required content.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

26: double apr = 0;
30: HNUnit4Ch13Investor.setInterestRate(apr); // sets rate to zero
33: apr = input.nextDouble(); // this is the real rate, but too late. You never use it

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

I agree you're not going to get rich on up-front pricing, but in-app purchases are a different animal - all you need is a couple of thousand $1 purchases to get your investment back.
So maybe your marketing with bloggers etc will fail and nobody will ever hear of, let alone download your game. Or maybe you can get one good mention on a key blog and it will go viral. Nobody ever made their first fortune by avoiding risk!

Here's a very relevant and interesting case study... https://medium.com/@alpsoy/how-much-can-you-make-from-a-20k-downloaded-ios-game-ed91e5caf67d

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Hint: What is the largest number you can store in an integer?

rproffitt commented: Also, https://www.google.com/search?q=vb.net+integer+max+value +12
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
  1. Read this before posting again
    https://www.daniweb.com/programming/threads/435023/read-this-before-posting-a-question

  2. We only help people who are making some kind of effort themselves. All you did was to violate your teacher's copyright by posting the whole assignment without any attempt to show any work or even ask a question.

  3. No, we are not going to download a zip file from an unknown source. I know it's probably its someone else's software that you have decided to publish without their permission, but maybe it's more malicious than that.

Now that's clear, let's reset the scorecard. Start again.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

This is why Swing has Layout Managers. You start with the components (text fields, drop-down lists, whatever) which Java sizes to fit the text in them - nb this depends on the font you are using and the screen resolution. You use a layout manager to add these to the JFrame according to where you want them to go (top, bottom, etc). The Layout Manager then sets the size of the JFrame to fit your components according to the layout you wanted. This is done at run time so when you run on a different machine the frame is still sized appropriately. There is a decent choice of Layouit Managers, some simple, some less simple giving you detailed control over how things are spaced out, how they share the space when the frame is re-sized etc.
See https://docs.oracle.com/javase/tutorial/uiswing/layout/index.html

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Your mistake was to use a message dialog. That's intended to show a message and then close. If you want the user to be able to chose between OK and cancel/close then you need to use another type of dialog.

You could use a confirm dialog with OK and Cancel buttons . That returns an int showing whenther it was OK, Cancel, or close that was clicked.

Even better, ditch your whole thing and just use an input dialog to prompt for a store and accept user input. If the user presses OK it returns the input. If the user presses Cancel or closes the dialog it returns a null. Just test that return value to decide whether to save or do nothing. This is the obvious "right" solution.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Try displaying the arraylist - it looks like maybe you have words and meanings originally adjacent (?), but after sorting there's no relationship between the word to its meaning

I see no code to display a meaning anyway

you have an empty catch, so there may be a serious error that you are ignoring

lines 28 etc you keep changing the text ina loop so only the last pass will have any effect (other than to slow things down)

... I:m sure there's more.
It's better to write your code in small sections and test each before moving on. That way you only have one or two bugs at a time, and you know where to look for them.

ps Why not use a map<word, meaning>?

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

OK, you have most of the right pieces, but in the wrong place and some missing!

Let's look at the overall class structure.
Here's a template that will work for all kinds of GUI apps:

A class that starts up the whole application, and has the main method
Some classes that represent the "model" or data (Car etc)
Some classes that provide the GUI (MainMenu etc)
Other lower-level utility classes as required

What you have doe is the put main inside a GUI class and missed out the bit in main where the carList is created. Hence your problems

So the structure should be:

class MyCarApp { // this is the main (startup) class of the app

    // probably no need to code a constructor for this class
    // because you won't create any instances (just static)

    p s v main(...) {
        // initialise everything (eg lines 12-27 in your code above)
        // create a car list
        // create the first window (MainMenu) of the GUI,
        //    passing it the car list (eg lines 30-34 above)

  }

  // other classes as per our previous posts

I know at this stage it looks like the "application" class looks a bit silly, with just one method, but as you do more complex applications you will have all kinds of initialisation (logons, loading configurations, defaults, user defaults, opening databases, holding public constants that are needed throughout the app etc etc) and that first class gets plenty big and complicated. …

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

I understand that you have multiple GUI classes that all need to access the same list of cars?

If so, a common approach is to create one list of Cars and pass it to each of the GUI classes via their constructors, eg (abbreviated code)

p s v  main(...) {

   List<Car> carList = new CarInitialData().getCarList();

   new MainMenu(carList);  
   ...
   new EditPage(carList);  
   etc
}

public class MainMenu extends javax.swing.JFrame {
   private List<Car> carList;

   public MainMenu(List<Car> carList) {
        this.carList = carList; 
        // now I have a reference in this class to the master car list
         initComponents();
        ...

public class EditPage extends javax.swing.JFrame {
   private List<Car> carList;

   public EditPage(List<Car> carList) {
        this.carList = carList; 
        // now I have a reference in this class to the master car list
         initComponents();
        ...

If it's the MainMenu that calls the new EditPage then it can pass in the carList in exactly the same way.

Notes:

This is a common pattern called model-view-controiller (MVC). The Model is the data etc, the View is the form and its fields etc, the Controller is the code that ties them together (in Java you often combine the view and controller in a single class). So when you create a View you pass it the Model that it;s going to display, and that's how it works.

I suggested names for classes and variables that fit normal Java coding standards.

I see you have not compiled the CAR class. YOu should compile small secions of code as early as possible, so you only …

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

You can put them in a table... one row three columns. Worked for me!

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Sadly the nonsense has continued, so I just banned UI for repeated unrepentant irrelevant trolling of valued DaiWeb members.
Maybe that will cost me my Moderator badge, but someone had to do something.
JC

Update: happygeek disagrees. He's an admin and has overridden my ban (as is his right). Its out of my hands now <sigh of relief>.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

I just banned UI for repeated unrepentant irrelevant trolling of valued DaiWeb members.
Maybe that will cost me my Moderator badge, but someone had to do something.
JC

Update: happygeek disagrees. He's an admin and has overridden my ban (as is his right). It's out of my hands now <sigh of relief>.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

See my post here re the rules and members expressing their views.

the mod doesn't like anyone going offtopic

DaniWeb is moderated according to the TOS and Posting Rules. Any likes or dislikes that a mod may have can be expressed just like any other member's, but they do not influence their activity as a moderator. The Posting Rules include "Do ensure that all posts contain relevant content and substance"

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

I would do something with your current employer's software - that will help you "get" the local style and coding standards, and increase your value to your employer. Maybe reverse-engineering the class and sequence diagrams for one of their apps would be good learning for you and show them how you can add value.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Troll alert:
UI posts the same questions on multiple sites and doesn't mark threads "solved" when he has an answer.
Just sayin'

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

UI
You're not listening.
Nobody here is going to waste their time posting to help you when you probably already have an answer from another site.
You don't even have the basic decency to mark thread "solved" so people don't put effort in when you already have a solution.

You blew it. You're on your own now.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Tanisha: see http://bfy.tw/C1JI or read the very first post in this thread.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

that is a great idea, but I don't believe the organisation I work for has any...shame because it would be reallly helpful.

In that case why not take a small example from their current software and build the seq diagram for an easy part (eg user logon). You could even impress them into using seq diagrams more! For me they are the most useful part of the UML toolset.

is it still worth me looking at the Java theory... or just doing some practice

I say practice. Doesn't matter what as long as (a) it's not TOO simple and (b) you don't skip over the tricky bits like handling errors etc.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Maybe Sequence Diagrams would help you to visualise. I'm a massive fan of using them to refine and validate how classes (and modules) interact.
Quick intro: https://en.wikipedia.org/wiki/System_sequence_diagram
More examples: http://www.agilemodeling.com/artifacts/sequenceDiagram.htm

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

People aren't tagging their posts effectively is at least part of the problem

When people have a problem using something blame the people?

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

I wouldn't get too hung up about design patterns. Use them when they fit is all.
In a large or complex system you will probably find that some were used at quite a low level, and others (eg MVC) at a very high level - in which case you won't see them in the code but you will in the overall module design. Many designers have them in their metal toolkit when designing, but apply them loosely or in a way that's adapted to the situation

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Well, here are some ideas about debugging in the real world...

Debugging is an art as well as a science! The best deguggers I ever knew were people with huge experience of that kind of program, which enabled them to make really good educated guesses as to the kind of mistakes that usually lead to that kind of problem.

But as a science it's all about small logical reproducable steps. (That's the opposite of making some random change and seeing if that helped.

Start by pinning down the circumstances under which the bug does or does not appear. Keep copies of the cases that fail so you test your fix later. Write them down. You'll need this to test your hypothesis about whet went wrong.
If it's possible to reproduce the bug in a subset of the full system, or in a stand-alone test program, that wil save a lot of time.
If you have a bug that can't be reproduced reliably then settle in for a long and painful process - thread race bugs for example are always a nightmare.
Obviously: read all the log and error files very carefully indeed.
If there is configurable logging turn it to max and reproduce the bug.

Now it's typically a process of working backwards through the code starting from where the bug appears. Reading the code is probably a good idea, but you probably won't see the error - neither did the original programmer or the …

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

If someone has code or a question re Java I'd be happy to see it no matter where they posted it. When we had specific forums for specific topics we didn't have this problem. Now all we have is tumbleweed blowing and settling at random. :(

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

php knows that 123 is a number. It can't be the name of a constant, or anything else beause the definition of the language does not allow you to use a number in any of those ways. But abc could be a name of a constant, or anything else, so you need the quotes to show that it's a literal string, not a name.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

You need to go back and review the use of quote marks when defining Strings. Your strings are missing their quote marks. That's what those Notices are telling you - PHP has fixed some of your code by adding the missing quotes.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Well, that's interesting code, but did you think that after 9 years anyone was still waiting for it?
And if you had bothered to read the thread before posting you would know that a CSV file may have quoted strings containing commas. People have already thought about that, discussed it here, and posted code that works (unlike your code).
I'm sure you posted with the best of intentions, but maybe next time you should check the dates, then read the entire thread before asking yourself how your post will add to whatever is already there.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

You could add a boolean parameter to Player:: displayPlayer to control whether the first card should be displayed or not.

ps: Immutable classes are a good thing!
You have setters in Card for value and suit, probably because that's a thing people do without thinking. In this case it's a mistake because:
Classes like that can be / should be immutable to eliminate a whole raft of possible errors and,
If you do call those methods then valueString or suitString will be wrong.

Far better to delete those methods and declare all the variables in Card as final. Then you can also make them public and get rid of the getters as well.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Quinton_1:

If you don't explain what help you need then there's nothing we can do.

Read this https://www.daniweb.com/programming/threads/435023/read-this-before-posting-a-question then post again

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Ken_10 and anyone else who thinks like that:

Getting someone to do your school work is stupid. You'll learn nothing and just waste the opportunity for education. It also penalises genuine students who are competing with you using their own effort and skills. You're also like to get caught and fail the class as a minimum penalty.

People providing and promoting such services are parasites. They take your money in exchange for doing you harm.

If you are involved in this then shame on you. We don't want you here.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

TLDR

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

I'm looking at line 14 where the last argument is arcEnd (also line 17) which should be 2 but is actually increasing by 4 on each pass of the loop.
It looks like you think the last two parameters are the starting and ending angle for the arc, but they are not. To quote the api doc "The resulting arc begins at startAngle and extends for arcAngle degrees".
Your last parameter should be 2, and you do not need endArc at all.

Start4me commented: That makes sense. I must've overlooked the fact that the second parameter is the degrees to which it needs to draw for. Thank you so much. Now it work +3
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Rproffitt...
What's going on here? Who are you quoting?

rproffitt commented: I worry their spelling may be causing other troubles. http://marcoiannicelli.com/portfolio-posts/algorith/ (the web) +12
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Your threads are created with a Runnable that is null.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

@xrj: Because, as I have already explained, only one of the tosses is random. The other 2 are brought forward from the previous pass and are known