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
Please program this in Python.
Create a list of your favorite 4 movies. Print out the 0th element in the list. Now set the 0th element to be “Star Wars” and try printing it out again.
lst = ["Star Wars", "Movie 2", "Movie 3", "Movie 4"]
print(lst[0])
I wrote my code in python 3.8. Best of luck
Another technique that makes use of the colon slicing technique to directly refer to element places is list slicing. Use a blank value before the first colon to access the first element, then use len() with -1 as the input to access the last element.
What is the 0th element in the list?The element of the current ArrayList object at the provided index is returned by the get() function of the ArrayList class, which accepts an integer indicating the index value.
As a result, if you supply 0 or list to this method, you can obtain the first element of the current ArrayList.
Use a for loop with range (0, N) to get the first N members of a list. Then, make a new empty list and append the elements of the source list to the new list within the for loop. Range(0, N) iterates in steps of 1 from 0 to N-1. N is not comprised.
Therefore,lst = ["Star Wars", "Movie 2", "Movie 3", "Movie 4"] print(lst[0]).
Learn more about element here:
https://brainly.com/question/19312961
#SPJ2
Identify the symbol. please help!!
Explanation:
counter bore
Answer:
Diameter
Explanation:
On technical literature or drawings, it could be a symbol to mean diameter.
There's a chupacabra that looks like a mixed alligator , gecko it looks' like that but if you try harming it will it eat you "look up chupacabra only don't try looking up if it eats meat because that thing is a legendary animal and barely haves answers and has been cured alot and lives in the folklore mostly like the woods" it looks scary and cool the same time but some people said it has been instinct but it isn't it is spanish "which is puerto rican" lives in the united states, and mexico.. ( does it eat meat ) hasn't been seen around but you'll see a picture of it..
Answer:
wait. is this even a question or is it just informing us?
Explanation:
either way it is cool