Question

What does the following code do(explain)? a) Cinema cinema= new Cinema(4, 13, “5”); b) System.out.println(100%3); c)...

  1. What does the following code do(explain)?

    1. a) Cinema cinema= new Cinema(4, 13, “5”);

    2. b) System.out.println(100%3);

    3. c) currentRoom.setWallColor(color);

Homework Answers

Answer #1

a. Creating object for the class Cinema

Here cinema is the object name

The parameters 4,13,"5" are the constructor parameters .it will call the respective constructors in the Cinema class

B.

%always gives remainder

Output for the statement is 1

100 when divided by 3 produces a remainder of 1

C

Here currentRoom is the object

Color is a parameter it may be any one like red, green, blue etcc

It sets the respective color for the object

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
java: can anyone explain. why does my code print out ##### and ***** instead of just...
java: can anyone explain. why does my code print out ##### and ***** instead of just #####? int a=1, b=2, c=3;    if(a<b) System.out.println("####"); else System.out.println("&&&&"); System.out.println("****");
what output is produced by the following code and explain how it works. public class A...
what output is produced by the following code and explain how it works. public class A { int a = 1; int b = 2; public int getSum(int a, int b) {     this.a+=a;     this.b+=b;     return this.a + this.b; } } public class B extends A { int a = 3; int b = 4; public int getSum(int a, int b) {     this.b=a;     super.b=b+b;     return super.a+this.b; } } public class q2 { public static void...
After running the code check a line by line from 1 to 13 in Console what...
After running the code check a line by line from 1 to 13 in Console what each line of the code does? ( Clearly explain what each line mean with examples ) ?? 1-x<-rnorm(100, 3,2) 2-mean(x) 3-var(x) 4-y<- -2.5*x 5-mean(y) 6-var(y) 7-par(mfrow=c(1,2)) 8-hist(y, xlab='', main='Histogram Y') 9-boxplot(y, ylab="Y Sample", main='Boxplot Y') 10-abline(h=mean(y), lty=2) 11-#qqnorm(y, pch = 19) 12-#qqline(y, col = "steelblue", lwd = 2) 13-par(mfrow=c(1,1))
Given ID X Y A 10 15 B 4 5 C 13 16 D 7 9...
Given ID X Y A 10 15 B 4 5 C 13 16 D 7 9 E 13 4 F 1 5 What is the variation in Y that can be explained by X? please explain A) 50.7 B) 22.7 C) 36.3 D) 105.7 E) 91.3
q : explain the code for a beginner in c what each line do Question 2....
q : explain the code for a beginner in c what each line do Question 2. The following code defines an array size that sums elements of the defined array through the loop. Analyze the following code, and demonstrate the type of error if found? What we can do to make this code function correctly ? #include <stdio.h> #define A 10 int main(int argc, char** argv) { int Total = 0; int numbers[A]; for (int i=0; i < A; i++)...
What is the output of the following Java program? class Food { Food() { System.out.println(flavor); }...
What is the output of the following Java program? class Food { Food() { System.out.println(flavor); } String flavor = "bland"; } class Pepper extends Food { String flavor = "spicy"; } public class Lunch { public static void main(String[] args) { Food lunch = new Pepper(); } } Select one: a. spicy b. the program does not compile c. bland spicy d. no output e. bland
Java question, Please answer everything. Thank you Answer the following questions as briefly (but completely) as...
Java question, Please answer everything. Thank you Answer the following questions as briefly (but completely) as possible: What is a checked exception, and what is an unchecked exception? What is NullPointerException? Which of the following statements (if any) will throw an exception? If no exception is thrown, what is the output? 1: System.out.println( 1 / 0 ); 2: System.out.println( 1.0 / 0 ); Point out the problem in the following code. Does the code throw any exceptions? 1: long value...
[Java] I'm not sure how to implement the code. Please check my code at the bottom....
[Java] I'm not sure how to implement the code. Please check my code at the bottom. In this problem you will write several static methods to work with arrays and ArrayLists. Remember that a static method does not work on the instance variables of the class. All the data needed is provided in the parameters. Call the class Util. Notice how the methods are invoked in UtilTester. public static int min(int[] array) gets the minimum value in the array public...
Consider the following reaction: 2 A + 5 B → 3 C + 4 D Under...
Consider the following reaction: 2 A + 5 B → 3 C + 4 D Under a set of conditions, the average rate of reaction is 0.0256 M/s. What is the rate change with respect to B? Please it's necessary to answer this question based on the steps down below 1- what is this Question Classification? 2- Solve the problem 3- Provide and explain the "Final Answer" Please make your answer keyboard typing NOT Hand writting Thanks
Problem 4 - 5 Pts] Verilog [Part 4.1 - 5 Pts] What does the Verilog code...
Problem 4 - 5 Pts] Verilog [Part 4.1 - 5 Pts] What does the Verilog code below do? Provide as much detail as possible and provide informative descriptions/labels for the 4 input/outputs. module mystery (W, X, Y, Z); input W, X, Y; output Z; reg [7:0] P; always @ (posedge W or posedge X) begin if (X) P = 8'b00000000; else P = {P[6:0], Y); end assign Z = P[7]; endmodule