Search:

Type: Posts; User: JohnJohnson123

Search: Search took 0.07 seconds.

  1. Replies
    3
    Views
    1,240

    Re: Instance method

    Thanks Norm.

    I don't get it. I'm trying to turn x into a string. And x is all over the place.

    There are a lot of problems in this code.
  2. Replies
    3
    Views
    1,240

    Instance method

    public class Rectangle {
    private final int width = 0;
    private final int height = 0;
    public Point origin;

    // use:
    public Rectangle() {
    origin = new Point(0, 0);
    ...
  3. Replies
    6
    Views
    1,308

    Re: Second largest

    I thought it was more fun like this. I saw it on stackverflow.

    Thanks for the ongoing support.
  4. Replies
    6
    Views
    1,308

    Re: Second largest

    It did not work out for me.

    How about this. Find the three largest numbers and print them out.



    public class Minmax2 {
    public static void main(String[] args) {

    int max =...
  5. Replies
    6
    Views
    1,308

    Re: Second largest

    StdIn is used in my textbook, Introduction to programming in java. It's a library thing for all kinds of inputs.

    Your right. But I think I can use it like that and press ctrl+enter

    --- Update...
  6. Replies
    6
    Views
    1,308

    Second largest

    Hi.

    I'm trying to find the largest and the second largest number in vector. But I can't.

    Can you help?



    public class Minmax{
    public static void main(String[] args) {
  7. Replies
    1
    Views
    824

    Algorithm theater?

    Hi.

    I'm wondering, does anyone know of another program like Jeliot?

    I'm looking for a new one because Jeliot does not support StdIn or StdOut and I'm hoping
    that there exists another one that...
  8. Replies
    1
    Views
    938

    String O string where are you?

    I'm trying to write a program that splits string up and prints it backwards. But it does not work.

    My questione: When I type domain name www.apple.com after pressing enter nothing happens until I...
  9. [SOLVED] Re: Put a random number from one vector to another

    It seems that #13 was correct. Thanks for your help and patiance.:)
  10. [SOLVED] Re: Put a random number from one vector to another

    I'm wondering. Is this something to build on...

    I'll have to ''build'' the methods again...but than again the other stuff I got is trash...



    public class Sample1{

    //public class Sample1...
  11. [SOLVED] Re: Put a random number from one vector to another

    I'm lost...



    public class Permexamp1{

    //Reading the vector with StdIn
    public static int [] getUserInput(int N)
    {
    //int N = args.lenght;
  12. [SOLVED] Re: Put a random number from one vector to another

    I tried some changes at the bottom, I tried changing the sequence of the creation of the arrays. With the input {2,2,2,2} the program prints out:0
    ...
  13. [SOLVED] Re: Put a random number from one vector to another

    I'm thinking...two things perhaps I can ''ask'' first for N and then do system out print to ask for M. Or keep the code that I've got[ain't that just the code of my dreams...hahah] and create N...
  14. [SOLVED] Re: Put a random number from one vector to another

    I think the problem is that I'm not thinking this correctly. If I put for example 5 and 2 in command line the vectora.length(N) is 5. Then the program starts to parse(move) 5 and 2 into vectora but...
  15. [SOLVED] Re: Put a random number from one vector to another

    Thanks man.

    That goes a long way.

    I still get this error message. I'll look in tomorrow.

    >java Permexamp 5 2
    Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2
    ...
  16. [SOLVED] Re: Put a random number from one vector to another

    I don't get it. How do I make it public? (Do you put it like that?)
  17. [SOLVED] Re: Put a random number from one vector to another

    Example values: Well the Vectora is supposed to be larger, because that is the array wich M is suppose to read from. So N>M, hopefully. I tried with 5 and 2 from the command line, nothing happened,...
  18. [SOLVED] Put a random number from one vector to another

    I have a problem with this code. The program is supposed to read a vector with Standard Input and choose randomly from that vector, put those numbers in another array and then print that array out....
  19. Re: Trying to write a program that reads from StdIn and findes the highest value

    Check this out.

    What is wrong?


    public class
    {
    //Finding the max and counting them
    public static double max(double[] a, int lo, int hi) {
    if (lo < 0 || hi >= a.length || lo > hi)
  20. Re: Trying to write a program that reads from StdIn and findes the highest value

    When I put the print statement in main and the second error message in static.

    This is my problem a have got the concept, almost(hahah), my problem is the scope and chooing the right method and...
  21. Re: Trying to write a program that reads from StdIn and findes the highest value

    My program is supposed to read a file and return the number of highest value in the terrain, count the peaks so to speak.

    My problem is the scope and print out.
  22. Trying to write a program that reads from StdIn and findes the highest value

    Hi!
    I'm trying to write a program that counts the highest value in a matrix .
    It does'nt work. What is wrong with it? If I put System.out print at bottom of main all hell breaks loose.
    So...here...
Results 1 to 22 of 22