Search:

Type: Posts; User: Newoor

Search: Search took 0.26 seconds.

  1. Method Adding elements to an array with certain restrictions

    import java.util.Scanner;

    class WordTest1
    {
    public static void main(String[] args)
    {
    Scanner input = new Scanner(System.in);
    WordGen.initialise(input);
    System.out.print("Enter the...
  2. Replies
    2
    Views
    895

    Lists of Sets and Sets of Lists

    Write a program that reads several lines of integers. Each line of integers should be stored in
    an object of type List<Integer>, and all the lines should be stored in an object of type...
  3. Re: Declaring variables in constructor and compiling

    I have solved the problem, i declared another integer as public, then made it equal to the constructor argument.



    import java.util.*;

    class WordStore
    {

    public int number = 0;
  4. Declaring variables in constructor and compiling

    import java.util.*;

    class WordStore
    {

    public WordStore(int n){
    int number = n;

    }
  5. Replies
    1
    Views
    636

    Method parseIntArrayList

    This code was originally for lisp lists, i modifed it for ArrayLists. But it doesn't work properly. It supposed to take a string ( a list of numbers), convert them to integers and return an ArrayList...
  6. Replies
    3
    Views
    1,312

    I have algorithm problem

    Here is the problem:

    Given a list of integers, A0, A2, ... , An-1, each of which may be

    positive or negative, find the sublist of integers Ai, ..., Aj which has

    the maximum sum of any...
  7. Replies
    10
    Views
    1,519

    Re: Errors with LispList

    symbol : method size()
    location: class LispList<java.lang.Integer>
    int l = a.size();

    this is the error im getting, however reading my notes I think u can only use certain methods with LispList...
  8. Replies
    10
    Views
    1,519

    Re: Errors with LispList

    ok i sorted that problme out,
    so why doesn't the size method work for LispLists (they work for Array Lists)
  9. Replies
    10
    Views
    1,519

    Re: Errors with LispList

    ahhh missing method


    public static LispList<Integer> parseIntLispList(String str)
    {
    String line = str.trim();
    String contents = line.substring(1,line.length()-1).trim();
    ...
  10. Replies
    10
    Views
    1,519

    Errors with LispList

    Write static method which performs the following operation:
    length takes a list and returns the number of integers in it. For example, with [7,3,8,12,9,14]
    it would return 6.


    import...
  11. Replies
    3
    Views
    1,888

    Re: Substring program, not working

    and dont need first loop
  12. Replies
    3
    Views
    1,888

    Re: Substring program, not working

    I didn't spot the i++/j++ thing. So thanks, in the end I used

    str2.substring(j,j+str1.length()).equals(str1)

    that worked fine, and just did a couple of return statements

    My Program is...
  13. Replies
    3
    Views
    1,888

    Substring program, not working

    Hi

    Write a static method which takes two strings and returns a boolean saying whether the
    first string occurs as a substring within the second. For example, if the strings are
    “blis” and...
Results 1 to 13 of 13