1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
olya-2409 [2.1K]
4 years ago
5

Print the two strings in alphabetical order. assume the strings are lowercase. end with newline. sample output: capes rabbits

Computers and Technology
2 answers:
steposvetlana [31]4 years ago
4 0

Here you go,

Program:

import java.util.Scanner;

public class OrderStrings {

    public static void main(String[] args) {

         String firstString;

         String secondString;


         firstString = "rabbits";

         secondString = "capes";

         int status = firstString.compareTo(secondString);


         if(status<0)

         {

              System.out.println(firstString + " " +  secondString);

         }

         else

         {

              System.out.println(secondString + " " + firstString);

         }

         return;

    }

}

s2008m [1.1K]4 years ago
3 0

Answer:

To print the two strings in alphabetical order if the strings are in lower case and end with a new line, first define a class and store the values in string variables. After this, compare the string using compareTo() function and finally print the result.

Further Explanation:

Code: Following is the JAVA code that prints the two strings in alphabetical order where strings are in lower case and end with new line.

import java.util.Scanner;

//definition of the class

public class StringOrder  

{

public static void main(String[] args)  

{

// define the variables

String firstString;

String secondString;

// assign values to the strings

firstString = "rabbits";

secondString = "capes";

// compare the strings

if(firstString.compareTo(secondString)<0)

{

System.out.println(firstString+""+secondString);

}

else

{

System.out.println(secondString+""+firstString);

}

return;

}

Learn more:  

1. A company that allows you to license software monthly to use online is an example of ? brainly.com/question/10410011  

2. Prediction accuracy of a neural network depends on _______________ and ______________. brainly.com/question/10599832  

3. The shape of our galaxy was determined ‘on the inside looking out' by surveying the milky way using ____________ telescopes. brainly.com/question/7866623  

4. List 3 characteristics of the ideal encryption scheme. brainly.com/question/3000161

Answer details:

  • Grade: College Engineering
  • Subject: Computer Science and Engineering
  • Chapter: Java Programming

Keyword:  

Java programming, python, C++, print, two strings, alphabetical order, lower case, upper case, output, capes rabbits, compare, loops, variables, first string, second string, scanner class

You might be interested in
The activity spikes during black Friday sales in the holiday season but significant stress on a major retailers website what fea
Elza [17]

Answer:

My Nav is the right answer.

Explanation:

Net asset value (NAV) describes a fund's per part exchange value. NAV is calculated by separating the complete value of all the money and securities in a fund's responsibility, minus any mortgages, by the number of exceptional shares. The NAV estimation is necessary because it shows us how much one portion of the fund is worth.

4 0
3 years ago
What is common for all machines​
Fed [463]

Answer:

the question is a bit vague, but all machines exist to serve a purpose, or to do or accomplish a certain task.

6 0
3 years ago
Read 2 more answers
If byte stuffing is used to transmit Data, what is the byte sequence of the frame (including framing characters)? Format answer
Lerok [7]

Answer:

Correct Answers: 01h 79h 1Bh 78h 78h 1Bh 7Ah 04

Explanation:

Solution is attached below

4 0
3 years ago
Python
elixir [45]

print("welcome to the bill calculator")

minutes = float(input("number of minutes you used: "))

data = float(input("the amount of data you used in GB: "))

print("your basic plan costs $39.99 per month")

mcost = (minutes - 450) * .45

print("you will be charged " +  str(mcost) + " for the minutes you used")

print("the monthly data fee is $30.00")

dcost = (data - 3) * 10

print("you will be charged " + str(dcost) + " for the extra data you used")

total = mcost + dcost + 69.99

print("your total bill is " + str(total))

the 20 value your teacher gave may be incorrect, bc 4.2-3*10 = 12 not 20, making the total 109.89

4 0
3 years ago
If multiple people require the use of proprietary software at the same time, what type of license is needed?
docker41 [41]

Answer:

The anwer is C: Concurrent

Explanation:

Concurrent licensing is best known as per concurrent user. As the name suggests, this type of license occurs when a specific group of users in a network accesses a program simultaneously. Assume we have five users who have a per concurrent user license. The five users can access the program at the same time. If another user from the network tries to access this network, he or she will not be logged.

4 0
4 years ago
Other questions:
  • Create a single line comment that says ""Print results to screen""
    13·1 answer
  • Which statement is true
    12·1 answer
  • The c++ operator _______________ is used to destroy dynamic variables.
    5·1 answer
  • Your app needs to store the following information. For each type of information, decide whether you would use an array or a vari
    7·1 answer
  • An employee who interacts with customers regarding the nature of their car problems, rather than actually working on the vehicle
    6·1 answer
  • you are researching the Holocaust for a school paper and have located several Web sites for information. In a paragraph of no le
    7·1 answer
  • Please help explain this calculator code.
    13·1 answer
  • PI
    12·1 answer
  • bailey reads wikis at the beginning of his research project to get his bearings on the topic. he switches to peer-reviewed journ
    10·1 answer
  • Essay:
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!