qais4002
11.12.2019 •
Computers and Technology
Write a function max that has two string parameters and returns the larger of the two, that is, a string should be returned. (by larger we mean alphabetically, thus the string "b" is greater then the string "apple". the lengths of the two strings are not being compared.)
Solved
Show answers
More tips
- S Sport How to Do a Jumping Split...
- A Animals and plants What Do Terriers Eat?...
- F Food and Cooking Discover the Benefits and Properties of Dates...
- C Computers and Internet Dynamically Assigned IP Address: What Is It and How Does It Work?...
- S Style and Beauty How to Get Rid of Acne: Scientifically Proven Methods...
- H Health and Medicine Simple Ways to Lower Cholesterol in the Blood: Tips and Tricks...
- O Other How to Choose the Best Answer to Your Question on The Grand Question ?...
- L Leisure and Entertainment History of International Women s Day: When Did the Celebration of March 8th Begin?...
- S Style and Beauty Intimate Haircut: The Reasons, Popularity, and Risks...
- A Art and Culture When Will Eurovision 2011 Take Place?...
Answers on questions: Computers and Technology
- M Mathematics Help me with this :))))...
- B Business Direct Materials Variances Silicone Engine Inc. produces wrist-worn tablet computers. The company uses Thin Film Crystal (TFC) LCD displays for its products. Each...
- B Business Abuyer with a $242,000 loan has a monthly principal and interest payment of $1,317.66. if $1,033.54 is interest, what’s the new principal balance after the first...
- E English OU_i_1 hint: person who is on vacation...
- M Mathematics h(x)= 4/x-5 What is the domain of h? A: All real values of x such that x ≠ 4 B:All real values of x such that x ≥ 4 C: All real values of x such that x ≠5 D: All...
Ответ:
import java.util.Scanner;
public class Question {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
System.out.println("Enter first string: ");
String first = scan.nextLine().toLowerCase();
System.out.println("Enter second string: ");
String second = scan.nextLine().toLowerCase();
maxOfTwoString(first, second);
}
public static void maxOfTwoString(String firstString, String secondString){
if((firstString.compareTo(secondString)) < 0){
System.out.println(secondString);
} else if ((firstString.compareTo(secondString)) > 0){
System.out.println(firstString);
}
}
Explanation:
First, the import statement was use to import the Scanner class which allow user to enter input.
Then, the class was defined named Question
The main function was also defined. Then, the scanner object 'scan' was declared and initialized.
After that, the user was prompt to enter first string, which was assigned to 'first', then the user is also prompt to enter second string, which was assigned to 'second'. As the input are been collected from the user, they are also converted to lowercase for ease comparison. They are converted to lowercase before been assigned to first and second. The two string (first and second) are passed as arguments to the function 'maxOfTwoString'.
The maxOfTwoString function is defined and the two string is compared using Java String compareTo method. If a compareTo b is less than zero; it means b is greater. And if a compareTo b is greater than zero; it means a is greater. The function also output the string that is greater.
Ответ:
Users are discouraged from interacting directly with tables because this may result in unintended changes to source data.
Explanation:
The workbook provided is the original database source or the source data. If the user works directly on this table, there can be unintended changes in the source data. And hence we will lose the real information, and that is not required. And hence, the users are discouraged to interact directly with source data and are asked to create pivot tables first.