Answer:
Decomposition is when we break a problem down into smaller parts to make it easier to tackle.
Hope this helps I am in high school and I’m gonna work for Apple so I know a lot about computers and electronics
Answer:
/*
Find Largest and Smallest Number in an Array Example
This Java Example shows how to find largest and smallest number in an
array.
*/
public class FindLargestSmallestNumber {
public static void main(String[] args) {
//array of 10 numbers
int numbers[] = new int[]{32,43,53,54,32,65,63,98,43,23};
//assign first element of an array to largest and smallest
int smallest = numbers[0];
int largetst = numbers[0];
for(int i=1; i< numbers.length; i++)
{
if(numbers[i] > largetst)
largetst = numbers[i];
else if (numbers[i] < smallest)
smallest = numbers[i];
}
System.out.println("Largest Number is : " + largetst);
System.out.println("Smallest Number is : " + smallest);
}
}
/*
Output of this program would be
Largest Number is : 98
Smallest Number is : 23
*/
Explanation:
Answer:
You may use a different variable type for input in order to process the data appropriately and may use a different variable type to accommodate your program.
Explanation:
Your input may have to be different then output varying on what data you are processing.
For example, just like the last question you asked about calculating the area of the rectangle, your input MUST be converted to a different a numerical data type (i.e int or float) in order to do the math.
Based on your last question, if we didn't convert your input into a string your results wouldn't add the numbers together but only concatenate them. If I typed 3 & 5 as length & width, I would get 35 instead of 15.
Now another example is using functions (or methods whatever you want to call them), your input can be one thing and outputs another.
Let's say I want a function to tell me if I am smart. The way I want it to determine if its smart is by inputting my GPA into it, which is a numerical value. So the function would look something like this:
<u>Code (Python)</u>
def IsSmart(gpa):
if (gpa >= 4):
return True
else
return False
As you can see I am inputting a numerical value and it is outputting a boolean value. I can use this in a if else chain to spit out an output to the user.
Answer:
The answer to this question is given below in the explanation section.
Explanation:
The correct answer to this question is C i.e. String s = "apluse";
The rule or syntax of declaring string in any programming language is given below:
String variable-name = "yourString";
For declaring string variable, first, you write "String" that is a keyword of a programming languages for declaring string variables, such as int before the variable name for declaring integer variable. Then, you need to write a meaningful name of the string as a variable. After string variable name, you need to put the equal operator and then write the string in double quotation("") marks and after that put the instruction terminator that is ";".
So, according to this syntax, option C is correct.
While other options are not correct because:
In option a, string is not encapsulated in double quotation. Option B does not have varaible type such as String and Option E does not have variable name and its value also. So, only option C is correct and all other except C are incorrect.
twitter
they will allow you to share comments about any topic you want