Answer:
informative, discrimiitive,critical thats the order
Answer:
public class Calculator {
private int total;
private int value;
public Calculator(int startingValue){
// no need to create a new total variable here, we need to set to the our instance total variable
total = startingValue;
value = 0;
}
public int add(int value){
//same here, no need to create a new total variable. We need to add the value to the instance total variable
total = total + value;
return total;
}
/**
* Adds the instance variable value to the total
*/
public int add(){
// no need to create a new total variable. We need to add the value to the instance total variable
total += value;
return total;
}
public int multiple(int value){
// no need to create a new total variable. We need to multiply the instance total variable by value.
total *= value;
return total;
}
//We need to specify which value refers to which variable. Otherwise, there will be confusion. Since you declare the parameter as value, you need to put this keyword before the instance variable so that it will be distinguishable by the compiler.
public void setValue(int value){
this.value = value;
}
public int getValue(){
return value;
}
}
Explanation:
I fixed the errors. You may see them as comments in the code
Answer:
Option D: If it is the month of January, then the temperature is cool.
Explanation:
A conditional statement is the one having an if condition in it that says, if the condition is true proceed to the next statement, else not.
Given statements are:
- If it is the month of January, then it is winter.
This can be written as: if (January)⇒Winter
- If it is winter, then the temperature is cool.
This can be written as: if (winter)⇒ Temperature(cool)
So by combining both the statements, the winter clause will be connected and we get:
if(January)⇒Temperature (cool)
This can be written as:
- If it is the month of January, then the temperature is cool.
So, Option D is the correct answer.
i hope it will help you!
Answer:
bears = {"Grizzly":"angry", "Brown":"friendly", "Polar":"friendly"}
for bear in bears:
if bears[bear] == "friendly":
print("Hello, "+bear+" bear!")
else:
print("odd")
Explanation:
A dictionary called bears is given. A dictionary consists of key-value pairs.
You need to check each key-value pairs in bears and find the ones that have "friendly" as value using a for loop and if-else structure. In order to access the values of the dictionary, use the dictionary name and the key (inside the loop, the key is represented as bear variable). If a key has a value of "friendly", print the greeting. Otherwise, print "odd".
Answer:
formatted
Explanation:
In order for storage devices to be prepared for use, they must be formatted.