Posts by Matthew Maennche
Assume that message is a String variable. Write a statement to display its value on standard output.
LANGUAGE: JAVA CHALLENGE: Assume that message is a String variable. Write a statement to display its value on standard output.
Read MoreAssume that the variables gpa, deansList and studentName, have been declared and initialized . Write a statement that adds 1 to deansList and prints studentName to standard out if gpa exceeds 3.5.
LANGUAGE: JAVA CHALLENGE: Assume that the variables gpa, deansList and studentName, have been declared and initialized . Write a statement that adds 1 to deansList and prints studentName to standard out if gpa exceeds 3.5.
Read MoreWrite an if/else statement that compares the value of the variables soldYesterday and soldToday, and based upon that comparison assigns salesTrend the value -1 or 1.
LANGUAGE: JAVA CHALLENGE: Write an if/else statement that compares the value of the variables soldYesterday and soldToday, and based upon that comparison assigns salesTrend the value -1 or 1. -1 represents the case where soldYesterday is greater than soldToday; 1 represents the case where soldYesterday is not greater than soldToday.
Read MoreWrite an if/else statement that compares the variable age with 65, adds 1 to the variable seniorCitizens if age is greater than or equal to 65, and adds 1 to the variable nonSeniors otherwise.
LANGUAGE: JAVA CHALLENGE: Write an if/else statement that compares the variable age with 65, adds 1 to the variable seniorCitizens if age is greater than or equal to 65, and adds 1 to the variable nonSeniors otherwise.
Read MoreWrite a conditional that assigns 10,000 to the variable bonus if the value of the variable goodsSold is greater than 500,000.
LANGUAGE: JAVA CHALLENGE: Write a conditional that assigns 10,000 to the variable bonus if the value of the variable goodsSold is greater than 500,000.
Read MoreConsider this code: “int v = 20; –v; cout << v++;". What value is printed, what value is v left with?
LANGUAGE: C++ CHALLENGE: Consider this code: “int v = 20; –v; cout << v++;”. What value is printed, what value is v left with?
Read MoreGiven an integer variable timer, write a statement that uses the auto-decrement operator to decrease the value of that variable by 1.
LANGUAGE: C++ CHALLENGE: Given an integer variable timer, write a statement that uses the auto-decrement operator to decrease the value of that variable by 1.
Read MoreWrite a statement using the decrement operator to decrease the value of count (an already declared integer variable ) by 1.
LANGUAGE: C++ CHALLENGE: Write a statement using the decrement operator to decrease the value of count (an already declared integer variable ) by 1.
Read MoreWrite a statement using the increment operator to increase the value of num_items (an already declared integer variable ) by 1.
LANGUAGE: C++ CHALLENGE: Write a statement using the increment operator to increase the value of num_items (an already declared integer variable ) by 1.
Read MoreGiven an integer variable strawsOnCamel, write a statement that uses the auto-increment operator to increase the value of that variable by 1.
LANGUAGE: C++ CHALLENGE: Given an integer variable strawsOnCamel, write a statement that uses the auto-increment operator to increase the value of that variable by 1.
Read MoreWrite a statement using a compound assignment operator to change val to the remainder when val is divided by 16 (val has already been declared and initialized )
LANGUAGE: C++ CHALLENGE: Write a statement using a compound assignment operator to change val to the remainder when val is divided by 16 (val has already been declared and initialized )
Read MoreWrite a statement using a compound assignment operator to multiply num_rabbits by 4, changing the value of num_rabbits (num_rabbits has already been declared and initialized ).
LANGUAGE: C++ CHALLENGE: Write a statement using a compound assignment operator to multiply num_rabbits by 4, changing the value of num_rabbits (num_rabbits has already been declared and initialized ).
Read More