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
Rzqust [24]
3 years ago
11

Create an application (that uses the SortedABList) that allows a user to enter a list of countries that he or she has visited an

d then displays the list in alphabetical order, plus a count of how many countries are on the list. If the user mistakenly enters the same country more than once, the program should inform the user of their error and refrain from inserting the country into the list a second time.
Computers and Technology
1 answer:
gulaghasi [49]3 years ago
8 0

Answer:

import java.util.*;

public class Country

{

  public static void main(String args[])

  {

      char ch,temp;

      int flag = 0;

      String country;

      ArrayList<String> countries = new ArrayList<String>();

      Scanner sc = new Scanner(System.in);

      do

      {

          System.out.println("enter the country you have visited:\t");

          country = sc.next();

          for(int i=0;i<countries.size();i++)

          {

              if(countries.get(i).equals(country))

              {

                  System.out.println("you have already entered the country");

                  flag = 1;

                  break;      

              }

          }

          if(flag == 0)

          {

              countries.add(country);

              flag = 0;

          }

          System.out.println("want to add another country(y/n):\t");

          ch = sc.next().charAt(0);

      }while(ch!='n');

      Collections.sort(countries);

      System.out.println("Countries you have visited:\t"+countries);

      System.out.println("Total number of contries visited:"+countries.size());

     

  }

}

Explanation:

You might be interested in
Which is the primary use of a word processor? create, edit, format, and print text-based documents maintain a database of record
qaws [65]
<span>Which is the primary use of a word processor? 
</span>
create, edit, format, and print text-based documents

------------------------------------------------------------------------------------------------

Hope This Helps :)

P.S
If you could mark me as brainiest that would be great! :D
3 0
3 years ago
To lose weight, you must _______.
sweet [91]

Answer:

B

Explanation:

because you need to exercise and eat or drink less calories

8 0
2 years ago
Read 2 more answers
NEED HELP ASAP!
Marrrta [24]
Six inches is the answer
8 0
3 years ago
Younger people haven’t established brand loyalty the way older people have
krek1111 [17]
What’s your question?
6 0
3 years ago
How can information technology transform the way business processes in an organization
timurjin [86]

Answer:

1. Through cooperation.

2. Understanding the market and the organization.

Explanation:

Information Technology can transform the way business processes in an organization only if there is cooperation in the company. The cooperation is that everyone is to agree on the change that it is going to cause.

An information Technologist can change the way business process if he or her understand the maker of the company and the company.

The major point is this:

1. The company must cooperate.

2. Everybody must accept change for it to grow higher.

3. Understand the market of the company and

4. understand the company and how they operate and then change and replace the parts that need replacement.

6 0
2 years ago
Other questions:
  • Tommy has hired a marketing company to create a billboard advertisement
    11·2 answers
  • 2. Add a _______ to manually force text from one page to the next page. A. footer B. page break C. blank page D. header
    11·2 answers
  • The interaction between information technology and organizations is influenced___________.A) solely by the decision making of mi
    12·1 answer
  • A _______ area network is a type of wireless network that works within your immediate surroundings to connect cell phones to hea
    9·2 answers
  • You would like to put the data in order by product number. What should you do?
    15·1 answer
  • Since the web.xml file describes how the web application should be configured when it is deployed on a server, the file is known
    7·1 answer
  • Write the function powersOf3ToN(n) that takes a possibly-negative float or int n, and returns a list of the positive powers of 3
    10·1 answer
  • Any action that causes harm to your computer is called a
    15·1 answer
  • Dominic list his camera for sale on an online auction site Chloe is the highest bitter and purchase as the camera how does the a
    14·1 answer
  • What does playstation network is currently undergoing maintenance?.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!