Question: Question 26 (12 points) Saved Which statement could be used to generate a random number between 1 and 6, inclusive, and assign it to the

Question 26 (12 points)

Saved

Which statement could be used to generate a random number between 1 and 6, inclusive, and assign it to the variable dice? (2 points)

Question 26 options:

1)

int dice = Math.random(6);

2)

int dice = Math.random(6) + 1;

3)

int dice = Math.random() * 6;

4)

int dice = (Math.random() * 6) + 0.5;

5)

int dice = (int)(Math.random() * 6) + 1;

Question 27 (12 points)

Saved

Suppose a class named SportsCar is a subclass of a class called Automobile. Automobile has only two methods: accelerate and addGas. Which statement is true? (2 points)

Question 27 options:

1)

A SportsCar object has the methods accelerate and addGas only. No other methods are allowed, since no other methods are inherited.

2)

A SportsCar object has at least the methods accelerate and addGas. It might add its own methods.

3)

A SportsCar object has the methods accelerate and addGas only if it is cast to Automobile.

4)

A SportsCar object has the methods accelerate and addGas only if they are static.

5)

A SportsCar object has the methods accelerate and addGas only if they are abstract.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!