AutoNumber it can do it all alone and put the number(If you don’t know the number to put).
Using a linear search to find a value that is stored in the last element of an array of 20,000 elements, 20,000 element(s) must be compared.
Answer:
if(soldYesterday > soldToday){
salesTrend = -1;
} else if(soldToday > soldYesterday){
salesTrend = 1;
}
Explanation:
The if/else statement is more explicit. The first if condition check if soldYesterday is greater than soldToday, if true, then -1 is assigned to salesTrend.
Else if soldToday is greater than soldYesterday, if true, then 1 is assigned to salesTrend.
Answer:
import java.util.Scanner;
public class TestClock {
public static void main(String[] args) {
Scanner in = new Scanner (System.in);
System.out.print("Enter favorite color:");
String word1 = in.next();
System.out.print("Enter pet's name:");
String word2 = in.next();
System.out.print("Enter a number:");
int num = in.nextInt();
System.out.println("you entered: "+word1+" "+word2+" "+num);
}
}
Explanation:
Using Java Programming language
- Import the Scanner class
- create an object of the scanner class
- Prompt user to enter the values for the variables (word1, word2, num)
- Use String concatenation in System.out.println to display the output as required by the question.
Errors in compilation happen, or it runs but then doesn't recognize the input. Also you can't transform into other types of variables.