Consider the following class definition:
class Link{
Object data;
Link next;
}
List L has a reference p to the first node. Write code...
Search Results
Searching for: Java
Individual Exercises
Consider the following class definition:
class Link{
Object data;
Link next;
}
p is a reference to the first node in a list L. Return a...
Consider the following class definition:
class Link{
Object data;
Link next;
}
List L has a reference p to the first node. Write code...
Consider the following class definition:
class Link{
Object data;
Link next;
}
Return a reference to the second to last node (null if...
Consider the following class definition:
class Link{
Object data;
Link next;
}
List L has a reference p to the first node. Write code...
Consider the following class definition:
class Link{
Object data;
Link next;
}
p is a reference to the first node in a List L. Integer...
Consider the following class definition:
class Link{
Object data;
Link next;
}
p is a reference to the first node in list L. Integer val...
Declare a String variable, name it student
and assign it the value "Malcolm".
Write a function called repeat(s, n)
with two parameters, a String s
and an int n
. The routine should return a string with s
repated n
...
Write a function untilSpace(s)
that returns a substring of s
starting at the beginning and extending until a space is found. The space is...
Given an array of integers, return the largest value in the array. Assume the array has only posivitive numbers. If the array is empty,...
Given an array of int
s, return the smallest value in the array. Assume the array has only posivitive numbers. If the array has no values...
Write a function first10(s)
that returns the first 10 characters of s
. If s
is longer than 10 characters, just truncate it. If s
is...
Given an array of Strings, return the longest String in the array. If the array is empty, return null.
Consider the following class definition:
class Link{
Object data;
Link next;
}
Return a reference to the second to last node (null if...
Consider the following class definition:
class Link{
Object data;
Link next;
}
List L has a reference p to the first node. Write code...
Complete the class MyClass
below by adding a print statement to the run()
method. It should print "Hello " followed by the content of the...
Write a function fullWords(s)
that returns a string no longer than 20 characters. If the string s
is longer than 20 characters, just...
Rewrite the following while
loop using a for
loop.
call_a(); while (call_b()) call_c();
Rewrite the following do while
loop using a for
loop.
call_a(); do { call_c(); } while (call_b());
Rewrite the following for
loop using a while
loop.
call_a(); for(; call_b(); call_c()) call_d();
Given an array of integers, return the sum of all the values in the array.
Given an array of doubles, return the average of all the values in the array.
Write a function toTitleCase(s)
that returns the s
converted to Title Case. Title case has each word in the s
with its first letter in...
Write a function toTitleCase(s)
that returns the s
converted to Title Case. Title case has each word in the s
with its first letter in...