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
...
Search Results
Searching for: parameter
Individual Exercises
Write a function called countVowels
that receives a string
and returns the count of how many vowels it has, including a
,e
,i
,o
, and u
and...
Write a function called makeExcited
that receives a char
and permanently changes the value of it so that it becomes an exclamation mark (...
Write a function called punctuate
that receives a string
and permanently changes the value of that same string so that if there is a...
Write a function called exchange
that receives two char
s and permanently exchanges their values so each one has the value that the other...
Assume you have access to the following method.
public int add3Ints(int a, int b, int c){ return a + b + c; }
Call add3Ints
and pass the...
Assume you have access to the following method.
public int add3Ints(int a, int b, int c){ return a + b + c; }
Call add3Ints
and pass the...
Assume you have access to the following method.
public int add3Ints(int a, int b, int c){ return a + b + c; }
Call add3Ints
and pass the...
For this problem assume you have access to a Person class. Below, you'll see the start of a Student class that is a subclass of Person....
For this problem assume you have access to a Shape class. Below, you'll see the start of a Square class that is a subclass of Shape....
For this problem assume you have access to a Person class defined here:
public class Person{ public String name; private int age; public...
For this problem assume you have access to a Person class defined here:
public class Person{ public String name; private int age; public...
public int subtract(int a, int b){ return a - b; }
Use the method defined above to subtract 10 from 100 (as in 100 - 10).
public int subtract(int a, int b){ return a - b; }
Use the method defined above to subtract 35 from 45 (as in 45 - 35).
public int subtract(int a, int b){ return a - b; }
Use the method defined above to subtract 32 from 124 (as in 124 - 32).
Below is a ChessPiece
class that we will be using as a superclass for a Queen
subclass.
public class ChessPiece { // the location of this...
For this problem you will use this class:
public class Rectangle { private int length; private int width; public void setLength(int len)...
For this problem you will have access to the following class:
public class Ball{ private int diameter; private String color; public void...
For this program you will be creating a method that calculates the product of three numbers.
Your method will need to be named product
...
For this program you will be creating a method that calculates the average of three numbers.
Recall that an average is calculated by...
For this problem you will use this class:
public class Rectangle { private int length; private int width; public void setLength(int len)...
Write a method called product()
that calculates the product of three integers. Your method will need to be named product
. It will take in...
Write a method called average()
that calculates the average of three numbers. Recall that an average is calculated by adding a group of...
The following method takes in an int called size
. For this question, create an array of booleans of length size
. You do not need to...
Write a function called school
that takes a string
that represents the day of the week and displays the corresponding message:
- monday:...