Answer:
<h2> hi. here's your answer ....</h2>
<h3>print statement provides output on the screen . it prints the value of the expression on the screen . if the expression list is blank , no character is print . the expression in the list may be numeric or string .</h3><h2>Hope you like it..</h2><h2>(◕ᴗ◕✿)</h2>
Answer:
1.trees_destroyed_per_hectare = 456/2.47
2. input(no_of_hectares)
3. no_of_trees_destroyed =no_of_hectares * trees_destroyed_per_hectare
4. print(no_of_trees_destroyed)
Explanation:
1.trees_destroyed_per_hectare = 456/2.47 //conversion of tress destroyed per acres to hectare
2. input(no_of_hectares) // get input from user in hectares that how many hectares are destroyed
3. no_of_trees_destroyed =no_of_hectares * trees_destroyed_per_hectare // total number of trees destroyed by fire on given day and given area
4. print(no_of_trees_destroyed)
33.33 minutes of video
3 GB already used which means you have 5 GB left, 5GB is the same as 5000 MB
So 5000 MB divided by 150 MB is 33.33 minutes of video that can be stored on the iPhone
Answer:
static int checkSymbol(char ch)
{
switch (ch)
{
case '+':
case '-':
return 1;
case '*':
case '/':
return 2;
case '^':
return 3;
}
return -1;
}
static String convertInfixToPostfix(String expression)
{
String calculation = new String("");
Stack<Character> operands = new Stack<>();
Stack<Character> operators = new Stack<>();
for (int i = 0; i<expression.length(); ++i)
{
char c = expression.charAt(i);
if (Character.isLetterOrDigit(c))
operands.push(c);
else if (c == '(')
operators.push(c);
else if (c == ')')
{
while (!operators.isEmpty() && operators.peek() != '(')
operands.push(operators.pop());
if (!operators.isEmpty() && operators.peek() != '(')
return NULL;
else
operators.pop();
}
else
{
while (!operators.isEmpty() && checkSymbol(c) <= checkSymbol(operators.peek()))
operands.push(operators.pop());
operators.push(c);
}
}
while (!operators.isEmpty())
operands.push(operators.pop());
while (!operands.isEmpty())
calculation+=operands.pop();
calculation=calculation.reverse();
return calculation;
}
Explanation:
- Create the checkSymbol function to see what symbol is being passed to the stack.
- Create the convertInfixToPostfix function that keeps track of the operands and the operators stack.
- Use conditional statements to check whether the character being passed is a letter, digit, symbol or a bracket.
- While the operators is not empty, keep pushing the character to the operators stack.
- At last reverse and return the calculation which has all the results.