Question

String [ ] [ ] cities = { {“New York”, “Boston”, “Pittsburg”, “Hartford” },                              &nbs

String [ ] [ ] cities = { {“New York”, “Boston”, “Pittsburg”, “Hartford” },

                                    { “Saint Paul”, “Fargo”, “Minot”, “Chicago”},

                                    {“San Diego”, “LA”, “Berkeley”, “San Franscisco” },

                                    { “Houston”, “Dallas”, “Austin”, “El Paso”, “Arlington”} };

Write Java codes to print all of the values from the array.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
//TestCode.java
public class TestCode {
    public static void main(String[] args) {
        String [][]cities = {{"New York", "Boston", "Pittsburg", "Hartford" },
                { "Saint Paul", "Fargo", "Minot", "Chicago"},
                {"San Diego", "LA", "Berkeley", "San Franscisco" },
                { "Houston", "Dallas", "Austin", "El Paso", "Arlington"}};

        for(int i = 0;i<cities.length;i++){
            for(int j = 0;j<cities[i].length;j++){
                System.out.print(cities[i][j]+"\t");
            }
            System.out.println();
        }
    }
}

Add a comment
Know the answer?
Add Answer to:
String [ ] [ ] cities = { {“New York”, “Boston”, “Pittsburg”, “Hartford” },                              &nbs
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • How does cellphone service compare between different cities? The data stored in CellService represent the rating...

    How does cellphone service compare between different cities? The data stored in CellService represent the rating of Verizon and AT&T in 22 different cities. (Data extracted from "Best Phones and Service," Consumer Reports, January 2012, p. 28, 37.) At the 0.05 level of significance, is there evidence of a difference in the mean cellphone service rating between Verizon and AT&T? You need to download "CellService” data file. End of document Le L show Queries ILS Prope Prope Refresh File Home...

  • The average number of minutes Americans commute to work is 27.7 minutes (Sterling's Best Places, April...

    The average number of minutes Americans commute to work is 27.7 minutes (Sterling's Best Places, April 13, 2012). The average commute time in minutes for 48 cities are as follows: Click on the datafile logo to reference the data. DATA file Albuquerque Atlanta Austin Baltimore Boston Charlotte Chicago Cincinnati Cleveland Columbus Dallas Denver Detroit El Paso Fresno Indianapolis 23.3 28.3 24.6 32.1 31.7 25.8 38.1 24.9 26.8 23.4 28.5 28.1 29.3 24.4 23.0 24.8 Jacksonville Kansas City Las Vegas Little...

  • The Cost of Living in Selected U.S. Cities Cost-of-living index City number New York (Manhattan) 216.7...

    The Cost of Living in Selected U.S. Cities Cost-of-living index City number New York (Manhattan) 216.7 San Francisco, CA 164.0 Washington, DC 140.1 Los Angeles, CA 136.4 Boston, MA 132.5 Philadelphia, PA 126,5 Seattle, WA 121.4 Chicago, IL 116.9 Richmond, VA 104.5 Phoenix, AZ 100,7 Detroit, MI 99.4 Atlanta, GA 95.6 932 Charlotto. Ne Dallas, TX 91.9 The table shown here gives a cost-of-living index for 14 different cities. Currently, you are living and working in Atlanta and earning $75000...

  • The Cost of Living in Selected U.S. Cities Cost-of-living index City number New York (Manhattan) 216.7...

    The Cost of Living in Selected U.S. Cities Cost-of-living index City number New York (Manhattan) 216.7 San Francisco, CA 164.0 Washington, DC 140.1 Los Angeles, CA 136.4 Boston, MA 132.5 Philadelphia, PA 126.5 Seattle, WA 121.4 Chicago, IL 116.9 Richmond, VA 104.5 Phoenix, AZ 100.7 Detroit, MI 99.4 Atlanta, GA 95.6 Charlotte, NC 93.2 Dallas, TX 91.9 Source US Census Annual Average 2010 The table shown here gives a cost-of-living index for 14 different cities. Currently, you are living and...

  • Why is L75 different than the Third Quartile? I can easily find 3rd Quartile using excel....

    Why is L75 different than the Third Quartile? I can easily find 3rd Quartile using excel. I'm not sure how to find L75 though? Thank you!!   The average number of minutes Americans commute to work is 27.7 minutes (Sterling's Best Places, April 13, 2012). The average commute time in minutes for 48 cities are as follows: Click on the datafile logo to reference the data. DATA file Albuquerque 23.3 Jacksonville 26.2 Phoenix 28.3 Atlanta 28.3 Kansas City 23.4 Pittsburgh 25.0...

  • Question 2: How do the average credit scores of people living in various cities in the...

    Question 2: How do the average credit scores of people living in various cities in the US differ? The file Credit Score Data of 143 American cities is provided in Canvas. Construct a histogram Create a Five Summary Report Calculate Mean, Variance and Standard Deviation   What conclusion can you reach concerning the average credit scores of people living in different American cities? City State Average Credit Score Detroit Mi 743 New York NY 762 Minneapolis MN 787 Hartford CT 774...

  • QUESTION 9 How much time do Americans living in or near cities spend waiting in traffic,...

    QUESTION 9 How much time do Americans living in or near cities spend waiting in traffic, and how much does waiting in traffic cost them per year? The file here contains this cost for 30 cities. For the cost sitting in traffice, compute the balancing point, the value that occurs more than any other, the middle value, the standard deviation, skewness, kurtosis, coefficient of variation and range Balancing point The value that occurs more than any other = The middle...

  • CPS 276 DOC02-- Assignment 02 Cost of Living Calculator Your client maintains job search website. As...

    CPS 276 DOC02-- Assignment 02 Cost of Living Calculator Your client maintains job search website. As a service on their website, they need an application that compares costs of living between different metropolitan areas. Client will pay $780 for a complete application. Background Information: A person living in an area with a high cost of living will need higher income to maintain the same standard of living as someone living in an area with a low cost of living. For...

  • 1. Calculate the mean and standard deviation for each variable using formulas or functions. 2. Calculate...

    1. Calculate the mean and standard deviation for each variable using formulas or functions. 2. Calculate descriptive statistics for each variable using the Analysis Toolpak. 3. Calculate the coefficient of variation for each variable. What general interpretation can you make from these values? 4. Calculate the correlation between Revenue and Employees using a formula. Calculate the coefficient of determination. 5. Create a correlation matrix for the eight numerical variables. Note any relationship of interest Rank COMPANY NAME City State Revenue...

  • Wanted by the Police: A Good Interface By KATIE HAFNER NOV. 11, 2004 From: The New...

    Wanted by the Police: A Good Interface By KATIE HAFNER NOV. 11, 2004 From: The New York Times, Technology section, not-for profit classroom used. SAN JOSE, Calif. - SAN JOSE has a reputation as one of the safest large cities in the nation, with the fewest police officers per capita. Yet a number of the 1,000 officers in this city of 925,000 in the heart of Silicon Valley have been worrying about their own safety of late. Since June, the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT