Rewrite the following while
loop using a for
loop.
call_a(); while (call_b()) call_c();
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...
Complete the function joinStrings()
so that it returns a string with all the strings in words
concatenated. You should use sep
as a...
Complete the function joinStrings()
so that it returns a string with all the strings in words
concatenated. You may assume that the array...
Given an array of integers, return the first element in the array that is larger than maxVal
. Assume the array has only posivitive...
Given an array of integers numbers
, return the nth
element in the array that is larger than maxVal
. Assume the array has only posivitive...
Given an array of integers numbers
, return a new array with just the values in numbers
that are odd. The new array should just be of the...
Given a size
for an array and the initial
value, create and return a new int
array that is initialized with initial
stored in all the...
Given two integers a
and b
passed as arguments to sumints
, return the sum of their values.
For this assignment, create a method that will turn a fixed-size arrayBag into a set.
A Set is an abstract data type somewhat similar...
Write the member method 'playBagBingo()' that implements the player logic for the game described below. Bag Bingo is a game of chance...
Given two Point
s a
and b
, return the distance between the two points. You should use the Math.sqrt to compute the square root.
Given two Point
s p1
and p2
, return the slope of the line defined by the two points. If the line is vertical the slope is not defined and...
Given two Point
s a
and b
and a delta
, return true
if the two points are within delta
units of each other. That is, return true
if the...
Given two Point
s a
and b
return a rectangle. You must compute the top-left corner of the rectangle and the desired width and height for...
Given a rectangle r
, return true if the rectangle is a square. That is, if the width
of r
equals the height
then the rectangle is a...
Given two Point
s a
and b
return true
if a
is the left of b
. Returns false
otherwise.
Given two Point
s a
and b
return true
if a
is the right of b
. Returns false
otherwise.
For this question assume the following code:
public class LinkedBag<T> implements BagInterface<T>{ private Node firstNode; ...
For this question assume the following code:
public class LinkedBag<T> implements BagInterface<T>{ private Node firstNode; ...