asked 84.9k views
3 votes
1. Assume a double variable named number has been defined. Write a statement that calculates 100 divided by 5 and assigns the result to the number variable.

2. Assume that three double variables named result, number1, and number2 have been defined, and have been assigned values. Write a statement that assigns the value of number1 multiplied by number2 to result.
3. Write a statement that defines a named constant named SPEED. The constant's data type should be int, and its value should be 75.

1 Answer

5 votes

Answer:

public class num4 {

public static void main(String[] args) {

// Question One

double number = 100/5;

// Question Two

double result =0.0;

double number1 =0.0;

double number2 =0.0;

result = number1*number2;

// Question Three

final int SPEED =75;

}

}

Step-by-step explanation:

As required, the different variables are created in Java programming language.

In question three the keyword final is used to indicate a constant in java since java does not have an implementation for constant values, final and static keywords are used for this purpose

answered
User Andrei Dobrin
by
8.4k points

No related questions found