• Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in b+tree code to insert file

    This is not a "we write code for you for free" service. If you are having a problem with some specific code you are writing then please explain exactly what …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Grading system

    No. If you want to test for numbers being in particular ranges you need if/elseif/else. Switch only works for specific values, not for ranges.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Grading system

    At last! You have a switch with cases for 1,2,3,4 and 5. You enter 70, which is not 1,2,3,4 or 5, so it executes the default. That's how switch is …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Grading system

    From the very first post it was clear that score was a number up to at least 49, so I suspected the value being used was > 5. But since …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Grading system

    OK, one last chance. You have been asked repeatedly what value for `score` is printed when you run the program. You have ignored those requests. What does it print?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Grading system

    I think gh.fuz is just having fun with us. Anyway, joke over as far as I'm concerned. Bye. J.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Grading system

    Yes you already said that. Repeating it is just a waste of time. Printing "INVALID" implies that the value you are switching on is not 1, 2, 3, 4, or …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Grading system

    NO! I meant print the value of the *variable* `score` so you can confirm that it is 1, 2, 3, 4, or 5
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Grading system

    On line 12 try printing the value of score, maybe that will clarify what's happening
  • Member Avatar for JamesCherrill
    JamesCherrill

    Gave Reputation to Ewald Horn in groovy code explanation

    Hi. Sorry I only saw this now. Let's take it line by line: 1. create a static method called analyAPI that takes a single parameter, pkgname. In Groovy, you do …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Experimenting with GridBagLayout

    > Any particular reason why you're not using a GUI builder? Personally I find it easier and quicker to make a quick sketch on paper or in my head, then …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Imports Question: Better to Import everything?

    Once again JIT compiles byte code into native machine code at runtime. It has nothing to do with the javac compiler that compiles source code into byte code. You are …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Encryption/Decryption

    OK, I finally managed to download a copy of the book. It explains exactly what the encode and decode methods should do. Read it properly before asking for more help.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Encryption/Decryption

    Doesn't the book give you any lead on this? If not, the easiest thing to start with is the Caeser Cypher (Google it). To do it properly, use classes from …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Marked Solved Status for add em up revised

    I have figured out how to do this. All that is needed is the .useDelimeter error. help? `import java.io.*;` `import java.util.*;` `public class AddEmUp `{` `public static void main(String args[]) …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in add em up revised

    That's odd, but never mind - I'll mark it for you.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Experimenting with GridBagLayout

    1. I don't believe you can use negative insets... has anyone tried it? You can get components to touch by aligning them with the appropriate edge of their grid and …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Imports Question: Better to Import everything?

    ^ that's very confused. `import` has nothing to do with loading classes, and has zero effect on anything at all at runtime. It is simply a way to avoid having …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in add em up revised

    Its the pale blue button "Mark Question Solved" just below the entry field for submitting a reply, which is just below this message.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Experimenting with GridBagLayout

    > is there an explicit way to specify that a cell should be empty Not that I know of. Just don't put anything in it! SOmetimes I have had dynamic …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Experimenting with GridBagLayout

    Excellent Questions! The constructor for Insets is `Insets(int top, int left, int bottom, int right)` (source: API doc) so you added 10 at the top. Re your 5x5 grid... yes …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Implementing get(object key) method? (Maps newbie)

    How are the classes Key and Value defined? In your method calls you are passing Strings for both those.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Unit of width and height in Set Size method of java swing

    Yes, but of course components calulate their preferred size using the metrics of their current font etc, so they scale properly with different environments.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Unit of width and height in Set Size method of java swing

    Most components calculate a preferred size based on their contents, eg the text in a JLabel or the overall size of the children of a JPanel. Most layout managers use …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Unit of width and height in Set Size method of java swing

    It's pixels If you are using a layout manager like you should, then setSize is pretty much useless. With a null layout manager it sets the component size in pixels, …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Imports Question: Better to Import everything?

    That's all wrong! `import` just affects the way that names are resolved at compile time. It has absolutely zero effect on what classes get jarred, or on the run time. …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Question about Threads/Events

    Doogledude has got it - ball A collides with ball B, and ball B colides with ball A.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Implementing get(object key) method? (Maps newbie)

    You still are not putting the new key/value pair into your map. You create the Pair, but never add that to the map. You don't say how the map is …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in add em up revised

    It's in the API documentation, which should be open on your desktop all the time you are writing anything in Java. It's your absolutly essential reference doc. http://docs.oracle.com/javase/7/docs/api/
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Encryption/Decryption

    I don't have the Blue Pelican book, but I assume it does explain what you are supposed to do?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in add em up revised

    OK, in that case, after another look I can see the problem. Check the API documentation for Scanner, you have mis-spelled the name of the method. Next time please post …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Encryption/Decryption

    Judging by the code you posted, Crypto is the name of a class that has instance methods called encrypt and decrypt. You haven't provided any other information about your project, …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Encryption/Decryption

    The code you posted seems OK. What exactly are you having difficulty with?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Learning on GUI

    Tables are split into two main parts - the visible GUI stuff, and the data for the table. This allows you to chose how to store the data any way …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in GUI Project

    Your question is very vague and general - it sounds like you have missed some essential part of your course regarding GUI basics. There are many excellent Swing GUI tutorials …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Implementing get(object key) method? (Maps newbie)

    It's your put method. You check to see if that key is already there, and return true, but if it's not there you increment the size but you forgot to …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Build GUI with complex GridBagLayout

    You're still missing import java.awt.GridBagConstraints; You need to import java.awt.GridBagConstraints so you can use the name GridBagConstraints without having to fully-qualify it all the time. You need to import static …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Serialization fails when I use non-Java bean methods

    If you are using Serialization (ie write/readObject) then bean standards are irrelevant, but you must declare every class involved as "implements Serializable" as a way of asserting that your classes …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in PairTest Program

    You can do calculations when initialising variables, but only using values that are known at the time, eg int a = 3; int b = a+1;
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in add em up revised

    Literal \ characters in Java Strings need to be "escaped" - ie replaced with a double \ You did that in the findInLine, but not in your useDelimiter
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Encryption/Decryption

    Hello ZaneDarklace, welcome to DaniWeb. Is there a question associated with this code?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Build GUI with complex GridBagLayout

    `import static` imports the names of the `public static final` members of a class - ie the public constants [update] ... that description was a little too simplified, although right …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Build GUI with complex GridBagLayout

    What you did didn't work becuase it wasn't the the change I suggested! Notice the `static` keyword in the import?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Help with Declarations

    Maybe that's what was asked for, but it's poor coding practice. Any variable should have a scope that's just as big as is needed, but no bigger. By moving declarations …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Build GUI with complex GridBagLayout

    To avoid typing too much I import static java.awt.GridBagConstraints.*; .. which lets me use the named constraint constants without having to fully-qualify them every time. > Do I have to …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Throwing package not found error when compiling using Jar File

    I'm not sure how it will interpret that classpath. Try specifying a complete explicit path to the jar file.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Help with Declarations

    This is confusing. That code is perfectly valid Java; everything that needs to be declared is declared. Do you mean declaration like ricewtnd said, eg something like // I declare …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Throwing package not found error when compiling using Jar File

    Yes, i n that case the jar should contain a folder A with the class file in that, and the classpath should include the jar file.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Throwing package not found error when compiling using Jar File

    The package A has to be in a place that's in your classpath. If you have C:\Z\A\B\A\Print.class then A.Print is in C:\Z\A\B, so that's what has to be in the …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Edited Help with Declarations

    This is just a simple program that acts as a calculator for school age children. My professor requested that I add a declarations section. If possible could someone help me …

The End.