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...
Type: Posts; User: Newoor
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...
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...
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;
import java.util.*;
class WordStore
{
public WordStore(int n){
int number = n;
}
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...
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...
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...
ok i sorted that problme out,
so why doesn't the size method work for LispLists (they work for Array Lists)
ahhh missing method
public static LispList<Integer> parseIntLispList(String str)
{
String line = str.trim();
String contents = line.substring(1,line.length()-1).trim();
...
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...
and dont need first loop
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...
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...