Write a program that allows the user to edit an atlas of cities and states. The user should be able to insert and delete states
Write a program that allows the user to edit an atlas of cities and states. The user should be able to insert and delete states as well as insert and delete cities belonging to specific states. (Hint start with the following code)
(Java Programming)
import java.util.*;
public class GenericsDemo {
/** * @param args */ public static void main(String[] args) { // We have no idea how many states ahead of time, so we'll use a // dynamic data structure ArrayList aFewStates = new ArrayList(); aFewStates.add("New York"); aFewStates.add("Ohio"); aFewStates.add("Nevada"); aFewStates.add("Washington"); aFewStates.add("New York"); for(String state : aFewStates) { System.out.println(state); } System.out.println(); System.out.println(); // We'll use inheritance and make this REALLY weird and powerful! // Everything in Java is an Object... right? ArrayList
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance