Answer:
import java.util.*;
public class Main
{
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter the first: ");
int first = input.nextInt();
System.out.print("Enter the second: ");
int second = input.nextInt();
input.nextLine();
System.out.print("Enter your name: ");
String name = input.nextLine();
int difference = Math.abs(second - first);
System.out.println(name + ", the difference is " + difference);
}
}
Explanation:
*The code is in Java.
Create a Scanner object to get input from the user
Ask the user to enter the first, second, and name
Calculate the difference, subtract the second from the first and then get the absolute value of the result by using Math.abs() method
Print the name and the difference as in required format
Answer:
D. smart phone
explanation;
a. what the heck is a radio going to do?
b. an HD television? is his job watching movies?
d. he already has a form of communication he uses, he needs something that can to both things at the same time
c. a smart phone can do everything he needs to do, likely faster than a landline phone or laptop.
Answer:
Each variable is named so it is clear which variable is being used at any time. It is important to use meaningful names for variables: ... The name given to each variable is up to the programmer, but ideally a variable name should have meaning, ie it should reflect the value that it is holding.
Variables make code more than a static set of instructions. They allow logic to occur, enabling developers to measure time, analyze data, and customize the program to the user. Variables are so important to the code that they deserve a good name that accurately describes their purpose
Explanation:
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.
The best and most correct answer among the choices provided by the question is the third choice "It will be a space laboratory for scientists"<span>
The main purpose of the International Space Station<span> is to provide an </span>international<span> laboratory for experiments within the </span>space<span> environment. Which, despite all our technological advances, is nearly impossible to replicate here on Earth.
</span>
I hope my answer has come to your help. God bless and have a nice day ahead!</span>