If I asked the user to enter their favorite song what type of variable would I store it as?
String
Write the code that will display the words (spelling and punctuation matter):
Hello Class
System.out.println("Hello Class");
What is the mistake in the following lines?
int x = 24;
System.out.println("The total is " + x )
Missing semicolon on the print line
What is my favorite food?
Chicken Pot Pie
If I asked the user to enter the most amount bottles of water they have drank in a day (to the near whole slice), what type of variable would I store it as
int
Write the code that creates a variable called myNumber of type int and store the value 7
int myNumber = 7;
value = 70;
System.out.println("The value is " + value );
What is my class room number? I want the number and letter.
For example
A 103
C 201
If I asked the user to enter in their latest test score (can have decimals), what type of variable would I store it as?
double
Write a line of code that asks the user to enter if they did their homework last night?
boolean didHomework = readBoolean("did you do your homework last night?");
What is the mistake?
boolean x = (int) 5.6;
The variable type should be int not boolean
True or False: Mr. Tocci is a junior
True
What type of variable would I use to store the value 3.1415
double
Write the code that asks the user for their name and displays Hello +whatever name they entered.
String name = readLine("Enter your name:");
System.out.println("Hello "+ name);
What is the mistake?
double x = readdouble("Enter a value:");
System.out.println(x);
The second D in readDouble should be capitalized.
How old is Mr. Tocci?
26
What variable type would I used to store the value "N0tMyP4assword"
String
Write the code that asks the user to enter two test scores (can have decimals) and calculate the average. You need to round this to the near whole number as well.
double score1 = readDouble("Enter score:");
double score2 = readDouble("Enter score:");
int rounded = (int) (((score1+score2)/2)+0.5);
System.out.println(rounded);
What is the mistake?
String name = readString("Enter your name");
System.out.println(name);
It is readLine not readString
What school did Mr. Tocci go to for college?
UMass Dartmouth