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...
This assignment is an individual assignment. For Questions 1-3: consider the following code: public class A...
This assignment is an individual assignment. For Questions 1-3: consider the following code: public class A { private int number; protected String name; public double price; public A() { System.out.println(“A() called”); } private void foo1() { System.out.println(“A version of foo1() called”); } protected int foo2() { Sysem.out.println(“A version of foo2() called); return number; } public String foo3() { System.out.println(“A version of foo3() called”); Return “Hi”; } }//end class A public class B extends A { private char service; public B()...
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))
3. What will be the value of w after the following section of code executes: int...
3. What will be the value of w after the following section of code executes: int w = 4, q = 3; if (q > 5)       if (w == 7)           w == 3;       else            if (w > 3)               w = 1;            else               w = 0; A.0            B.1              C.2          D.3 4. What will be the value of b after the following section of code executes: int a = 4, b = 0; if (a...
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
Huffman Code Scenario: There are 4 symbols (A, B, C and D) in a special language....
Huffman Code Scenario: There are 4 symbols (A, B, C and D) in a special language. The frequencies of the symbols in a text written in the language are: A 40, B 20, C 10, and D 5. Answer the following questions. 1. How many bits do you need to represent the symbols? 2. What is the total number of bits needed in order to encode the entire text? 3. Construct the Huffman tree based on the scenario (paste the...
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
Pointers in C++ may have potential problems if not properly used. For the following C++ code,...
Pointers in C++ may have potential problems if not properly used. For the following C++ code, identify the problem, briefly explain the problem, and also state Java's handling of such cases.     int *p1;    p1 = new int [1000];                                     p1 = new int [10]; (a) Name the problem: (b) Brief explain what caused the problem: (c) Does Java suffer similar problem? If yes, say so. If no, how does Java avoid such problem?
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT