Posts Tagged ‘Java’
Of the following variable names, which is the best one for keeping track of whether a patient has a fever or not?
LANGUAGE: JAVA CHALLENGE: Of the following variable names, which is the best one for keeping track of whether a patient has a fever or not?
Read MoreWhich is the best identifier for a variable to represent the amount of money your boss pays you each month?
LANGUAGE: JAVA CHALLENGE: Which is the best identifier for a variable to represent the amount of money your boss pays you each month?
Read MoreAssume that word is a String variable. Write a statement to display the message “Today’s Word-Of-The-Day is: “followed by the value of word on a line by itself on standard output.
LANGUAGE: JAVA CHALLENGE: Assume that word is a String variable. Write a statement to display the message “Today’s Word-Of-The-Day is: “followed by the value of word on a line by itself on standard output.
Read MoreWrite a single statement that outputs num and cost to standard output. Print both values (num first, then cost), separated by a space on a single line that is terminated with a newline character.
LANGUAGE: JAVA CHALLENGE: Two variables, num and cost have been declared and given values : num is an integer and cost is a double. Write a single statement that outputs num and cost to standard output. Print both values (num first, then cost), separated by a space on a single line that is terminated with a newline character. Do not…
Read MoreGiven an integer variable count, write a statement that displays the value of count on the screen.
LANGUAGE: JAVA CHALLENGE: Given an integer variable count, write a statement that displays the value of count on the screen. Do not display anything else on the screen — just the value of count.
Read MoreGiven a floating point variable fraction, write a statement that displays the value of fraction on the screen.
LANGUAGE: JAVA CHALLENGE: Given a floating point variable fraction, write a statement that displays the value of fraction on the screen. Do not display anything else on the screen– just the value of fraction.
Read MoreAssume 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; System.out.println(v++);”. What value is printed, what value is v left with?
LANGUAGE: JAVA CHALLENGE: Consider this code: “int v = 20; –v; System.out.println(v++);”. What value is printed, what value is v left with?
Read More