Search:

Type: Posts; User: nepperso

Page 1 of 2 1 2

Search: Search took 0.47 seconds.

  1. Replies
    19
    Views
    304

    Re: method array list

    i'm not sure. I was only following what the book did for the coding.
    hrm okay I see what you mean.

    This is the first java class I've ever taken and the last lol. It's a strange requirement...
  2. Replies
    19
    Views
    304

    Re: method array list

    so my 3 problems for the assignment were:
    a method returning the book with the lowest price in the library
    a method searching the library for Books of a given author and returning an ArrayList...
  3. Replies
    19
    Views
    304

    Re: method array list

    ahh so take out the arraylist comment since i already have it but keep the results and make it price!

    though i had to add in the bs. for it to work- works correctly now too! YAY!!!

    String Price...
  4. Replies
    19
    Views
    304

    Re: method array list

    so if i fix it to

    String Price = JOptionPane.showInputDialog(null,
    "Enter a Price ");

    System.out.println("The search results for "+Price
    +" are: ");
    ...
  5. Replies
    19
    Views
    304

    Re: method array list

    Okay now I am trying to do the client test for it.
    I have
    public static void main(String[]args)
    {
    BookStore bs = new BookStore();

    String keyword =...
  6. Replies
    19
    Views
    304

    Re: method array list

    i figured double cause that's what i have for the price in the class:

    package natashaepperson_chapter_09_exercise_94;

    public class Book {
    private String title;
    private String author;
    private...
  7. Replies
    19
    Views
    304

    Re: method array list

    lol. I'm just copying what was written in the book, than doing what the question says i'm to do.

    • a method returning the book with the lowest price in the library
    • a method searching the...
  8. Replies
    19
    Views
    304

    Re: method array list

    when i change that it causes the arralist trimtosize to give an error:


    library.trimToSize();
    }
    says can't find it

    --- Update ---

    what would be better to use do you think?
  9. Replies
    19
    Views
    304

    Re: method array list

    So instead of saying

    private ArrayList<Book> library;
    write it as
    private List<Book> library;
    library = new ArrayList<Book>();
  10. Replies
    19
    Views
    304

    Re: method array list

    Actually - wait ? i think it should be this?

    public ArrayList<Book> searchForPrice(String searchString)
    {
    ArrayList<Book> searchResult = new ArrayList<>();
    //converts search string to...
  11. Replies
    19
    Views
    304

    method array list

    i just want to make sure I did this correctly. Does it look right?

    /** a method returning an ArrayList of Books whose price is less than a given number
    * @param searchDouble
    * @return
    */...
  12. Replies
    15
    Views
    268

    Re: Client and Class - Error

    no gave me the same error lol
  13. Replies
    15
    Views
    268

    Re: Client and Class - Error

    and I should change it where i have numOfhits with i to r? on the client or the class?

    Like so? :

    /*
    62. Write a class encapsulating the concept of statistics for a baseball
    team, which has...
  14. Replies
    15
    Views
    268

    Re: Client and Class - Error

    so instead of having it be [i]? have it be like [r]?
  15. Replies
    15
    Views
    268

    Re: Client and Class - Error

    how would you suggest to fix it?
  16. Replies
    15
    Views
    268

    Re: Client and Class - Error

    2501

    i am not sure why it's exceeding the elements, it should be right

    it's saying here:
    public String toString()
    {
    String returnString="";
    for(int i=0;i<numOfhits.length;i++)
    ...
  17. Replies
    15
    Views
    268

    Re: Client and Class - Error

    sorry, didn't copy the right thing
  18. Replies
    15
    Views
    268

    Re: Client and Class - Error

    haha DUH
    Thanks :D

    --- Update ---

    Okay My Client is now correct:

    import java.util.Arrays;

    /**
  19. Replies
    15
    Views
    268

    Client and Class - Error

    I've got my client and my class.
    My class seems to be okay, at least on the written part i'm not getting any errors.

    import java.text.DecimalFormat;

    public class EncapTest {
    public static...
  20. Replies
    5
    Views
    456

    Re: constructor and class

    Okay, how does this look now? I'm adding more to the code


    package natashaepperson_chapter_08_exercise_63;
    import java.util.Random;
    /**
    *
    * @author Natasha.Epperson
    */
    public class...
  21. Replies
    5
    Views
    456

    Re: constructor and class

    I think I understand, I get a little lost in some of the naming conventions. I havent had as much time to devote to java as Id like to since Im taking Calc III at the same time.


    public class...
  22. Replies
    5
    Views
    456

    constructor and class

    I'm trying to tackle the problem step by step. What I am having trouble is where to start lol
    I started with writing the constructor but not sure if i'm going in the right direction for this...
  23. Replies
    1
    Views
    217

    class and check method

    I have the following code which has no errors when i run it:

    /*
    * 63. Write a class encapsulating the concept of the weather forecast, assuming
    * that it has the following attributes: the...
  24. Replies
    6
    Views
    218

    Re: public expect statement error

    awesome okay thanks !
  25. Replies
    6
    Views
    218

    Re: public expect statement error

    ahh okay. no i hadn't used a driver class to test it. I wasn't sure how to do that yet I mean i know how to use import java class method and use main () methods. But not sure how to call a class i...
Results 1 to 25 of 35
Page 1 of 2 1 2