Java
Write an expression that evaluates to true if the value x is greater than or equal to y.
LANGUAGE: JAVA CHALLENGE: Write an expression that evaluates to true if the value x is greater than or equal to y.
Read MoreGiven the variables numberOfMen and numberOfWomen, write an expression that evaluates to true if the number of men is greater than or equal to the number of women.
LANGUAGE: JAVA CHALLENGE: Given the variables numberOfMen and numberOfWomen, write an expression that evaluates to true if the number of men is greater than or equal to the number of women.
Read MoreGiven a double variable called average, write an expression that is true if and only if the variable ‘s value is less than 60.0.
LANGUAGE: JAVA CHALLENGE: Given a double variable called average, write an expression that is true if and only if the variable ‘s value is less than 60.0.
Read MoreGiven an int variable grossPay, write an expression that evaluates to true if and only if the value of grossPay is less than 10,000.
LANGUAGE: JAVA CHALLENGE: Given an int variable grossPay, write an expression that evaluates to true if and only if the value of grossPay is less than 10,000.
Read MoreWrite an expression that evaluates to true if the value of the integer variable numberOfPrizes is divisible (with no remainder) by the integer variable numberOfParticipants. Assume that numberOfParticipants is not zero.
LANGUAGE: JAVA CHALLENGE: Write an expression that evaluates to true if the value of the integer variable numberOfPrizes is divisible (with no remainder) by the integer variable numberOfParticipants. Assume that numberOfParticipants is not zero.
Read MoreWrite an expression that evaluates to true if the value of the integer variable widthOfBox is not divisible by the value of the integer variable widthOfBook. Assume that widthOfBook is not zero. (“Not divisible” means has a remainder.)
LANGUAGE: JAVA CHALLENGE: Write an expression that evaluates to true if the value of the integer variable widthOfBox is not divisible by the value of the integer variable widthOfBook. Assume that widthOfBook is not zero. (“Not divisible” means has a remainder.)
Read MoreAssume that dataTransmitter is a variable that refers to an object that provides a method, sendSignal that takes no arguments. Write the code for invoking this method.
LANGUAGE: JAVA CHALLENGE: Assume that dataTransmitter is a variable that refers to an object that provides a method, sendSignal that takes no arguments. Write the code for invoking this method.
Read MoreAssume that dateManager is a reference to an object that has a method named printTodaysDate, that accepts no arguments and returns no value . Write a statement that calls printTodaysDate.
LANGUAGE: JAVA CHALLENGE: Assume that dateManager is a reference to an object that has a method named printTodaysDate, that accepts no arguments and returns no value . Write a statement that calls printTodaysDate.
Read MoreAssume there is a class AirConditioner that supports the following behaviors : turning the air conditioner on and off. The following methods provide these behaviors : turnOn and turnOff. Both methods accept no arguments and return no value.
LANGUAGE: JAVA CHALLENGE: Assume there is a class AirConditioner that supports the following behaviors : turning the air conditioner on and off. The following methods provide these behaviors : turnOn and turnOff. Both methods accept no arguments and return no value. Assume there is a reference variable officeAC of type AirConditioner. Create a new object…
Read MoreAssume that dataTransmitter is a variable that refers to an object that provides a method, named sendNumber. There is one int argument for this method. Invoke this method and use the number 5 as an argument.
LANGUAGE: JAVA CHALLENGE: Assume that dataTransmitter is a variable that refers to an object that provides a method, named sendNumber. There is one int argument for this method. Invoke this method and use the number 5 as an argument.
Read MoreAssume that logger is a reference to an object that has a method named printErrorDescription, that accepts one int argument and returns no value . Write a statement that invokes the method printErrorDescription, passing it the value 14.
LANGUAGE: JAVA CHALLENGE: Assume that logger is a reference to an object that has a method named printErrorDescription, that accepts one int argument and returns no value. Write a statement that invokes the method printErrorDescription, passing it the value 14.
Read MoreAssume that logger is a reference to an object that has a method named printLarger that accepts two int arguments and returns no value . Two int variables , sales1 and sales2, have already been declared and initialized.
LANGUAGE: JAVA CHALLENGE: Assume that logger is a reference to an object that has a method named printLarger that accepts two int arguments and returns no value. Two int variables , sales1 and sales2, have already been declared and initialized. Write a statement that calls printLarger, passing it sales1 and sales2.
Read More