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 of the following applies to a DNS caching server? (Choose all that apply.)
Alborosie

Answer:

The answers are:  it is used to enable fast DNS queries and  It can help reduce the amount of network traffic generated by DNS servers.

Explanation:

Because a DNS server can resolve a query from tis local data sends a recursive qyery to a root server.

3 0
3 years ago
Where is voice data stored in Android?
Dafna1 [17]
Inside its internal hard-drive and your google account!
8 0
3 years ago
A restaurant chain has several store locations in a city (with a name and zip code stored for each), and each is managed by one
bazaltina [42]

Answer:

The restaurant chain system consist of restaurant id, name, zipcode, manager id, menu list.

Manager; manager id, name, phone no, and store.

Menu; menu id, type, items and description.

Items; item id, price and description.

Explanation:

Please look at the attachment for the E. R diagram.

5 0
3 years ago
What how do i delete a question
Dvinal [7]

Answer: not sure if you can

Explanation: idk if you can but if you wanna get a good answer try searching up on google hope i helped!

7 0
2 years ago
A(n) ____________________ is a hardware device or software utility designed to intercept and prevent unauthorized access to a co
sesenic [268]

Answer:

hardware device

Explanation:

4 0
3 years ago
Other questions:
  • What is returned by the code: range (5, 100, 25) ?
    7·2 answers
  • 3k means about 3 thousand bytes. how would you express two hundred million bytes?
    8·1 answer
  • A wide variety of apps are available to customize devices, which category of app does word processing software falls into?
    10·1 answer
  • Why is a class called a factory of objects
    11·1 answer
  • Operating systems provide a measure of security by allowing users to access to those resources they've been cleared to use as we
    8·1 answer
  • Use the ________ property in the html link tag to to associate a web page with a style sheet for printing.
    5·1 answer
  • 4.2 lesson practice last one plzs help
    5·2 answers
  • How dose society use computer in government?​
    5·1 answer
  • Under the Home tab, controls for aligning text and objects can be found in the
    5·2 answers
  • Your friends are having difficulties with their computer setups. Can you suggest a way to help each friend?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!