Given an int
, return a double
of precisely half the initial value. The int
will need to be converted into a double
before any other...
Search Results
Individual Exercises
create a print line that will cast integer division m as an double.
This method simulates flipping a fair coin. It takes an integer parameter, which specifies the number of times that the coin is to be...
This method simulates flipping a fair coin. The coin is flipped repeatedly until three consecutive heads are seen. The method takes an...
This method simulates flipping a fair coin. The coin is flipped repeatedly until three heads are seen. The method takes an integer...
This method returns the price of bread. Declare a variable called “price of bread” using camel case and the correct data type in the...
What loop would you use to increase the adult years once the age reaches 18?
Given an array of doubles, return the average of all the values in the array.
Complete the while loop so that the variable repetition
keeps track of how many times the first character in word
is repeated in a row at...
Given a current
temperature and the desired minimum
temperature, keep increasing current
by 0.5
degrees until it has either reached or...
Write a program that prompts the user:
"How many degrees is it inside today? "
and then starting at that number entered, displays the...
Complete a program to encourage the user to do their chores before going to sleep. Begin by prompting the user Did you clean your room?...
Create a program that asks the user "In one word, how do you feel?\n"
and then gathers the user's response.
When the user enters either ...
The method skeleton below takes in an integer variable top
.
Using a while
loop, write a method that will return the sum of all numbers...
The method skeleton below takes in an integer variable top
.
Using a for
loop, write a method that will return the sum of all numbers from...
Given two strings, return true if either of the strings appears at the very end of the other string, ignoring upper/lower case...
Return true
if the string "cat" and "dog" appear the same number of times in the given string.
Given a string, return a string where for every char in the original, there are two chars.
Which operation has a different Big O complexity from the others?
If the class Pug
extends the class Dog
, what can't be said about the classes?
Write a function in Java that takes the int array arr
and returns a new array with each number being doubled. Be sure to make use of...
What would be the Big O Complexity for the following method?
public static void arrayDoubleValue(int[] nums, int[][] nums2) { for (int i...
We want to count how many times we walked the family dog in a week. Provided an array of seven integers, representing how many times the...
For this question, assume the following implementation of a doubly linked list:
public static class DLList<T> implements Iterable...
For this question, assume the following implementation of a doubly linked list:
public static class DLList<T> implements Iterable...