Write a function in Java that implements the following logic: Given 2 ints, a and b, return their sum. However, sums in the range 10..19...
Assignment 4
Score: 0 / 15.0
Exercises
Write a function in Java that implements the following logic: We are having a party with amounts of tea and candy. Return the int outcome...
Write a function in Java that implements the following logic: Given a string, if the string begins with "red" or "blue" return that color...
Write a function in Java that implements the following logic: Given 2 strings, a and b, return a string of the form short+long+short,...
Write a function in Java that implements the following logic: You are driving a little too fast, and a police officer stops you. Write...
We'll say that a string is xy-balanced if for all the 'x' characterss in the string, there exists a 'y' character somewhere later in the...
If the class Pug
extends the class Dog
, what can't be said about the classes?
What's wrong with the following code? Assume both the interface and class share the same package.
public interface Account { int...
There exists an abstract class Bird.
public abstract class Bird { public Bird() {} public String eat() { return "worms"; } public...
Design a class Dog, making sure it is appropriately encapsulated. The class will have the properties 'name' and 'breed' (both Strings), a...
Write a function in Java that takes an int
array as its parameter and returns the number of even int
s it contains. Note: the %
"mod"...
Write a function in Java that takes an array and returns the sum of the numbers in the array, or 0 if the array is empty. Except the...
Given an array of int
s, return true
if the sum of all the 2's in the array is exactly 8.
Given an array of integers, return the sum of all values in the array.
Given an array of integers, swap each pair of adjacent elements starting with the first two. For example, if the array contains the...