Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java . IDE: eclipse . Strings Write a Java program that does the following: 1. Asks the user for the names of 3 cities, separated

Java . IDE: eclipse . Strings

image text in transcribed

Write a Java program that does the following: 1. Asks the user for the names of 3 cities, separated by spaces. It is assumed that a given city name won't have spaces in t. So assume you won't have a city name like "Santa Monica". For example your program prints this: "Please input 3 city names separated by spaces in one line and press Enter." r then will type something like: Glendale Pasadena Burbank and press Enter. 2. Your program then prints the 3 city names in alphabetical order. For example: Burbank Glendale Pasadena The goal of this assignment is to get used to Strings in Java and how to compare those strings. Look for a string method that helps you compare two strings and use it's output to compare the 3 city names above. You may also need to use the if/else statement you already learned about and maybe even the switch statement if you like to accomplish this assignment

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Mining Concepts And Techniques

Authors: Jiawei Han, Micheline Kamber, Jian Pei

3rd Edition

0123814790, 9780123814791

More Books

Students also viewed these Databases questions

Question

LO1 Discuss four different views of motivation at work.

Answered: 1 week ago

Question

LO6 Summarize various ways to manage retention.

Answered: 1 week ago