Java Development Basics ~ Exercise (Array) ~

Problem 1. Consider the following sample code and specifications.

There are several Italian restaurants in this area. Create a program that displays a list of restaurants. The order of popularity is "Amore", "Italiano", "Bo's", "Pappa", and "Poppo" from the top. The program below shows the top three popular restaurants and restaurants throughout the area. The meaning of each variable is left as a comment in the code, so read it from there.

Best3Shops.java


package array;
public class Best3Shops {
	public static void main(String args[]) {
		//Set the top 3 popular restaurants in an array
		String[] best3Shops=new String[3];
		best3Shops[1]="Amore";
		best3Shops[2]="Pappa";
		best3Shops[3]="Bo's";
		System.out.println("Shows the top 3 popular restaurants");
		for(int i=0;i<best3Shops.length;i++) {
			System.out.println(best3Shops[1]);
		}
	}
}

areaShopList.java


package array;
import java.util.ArrayList;
import java.util.List;
public class AreaShopList {
	public static void main(String[] args) {
		//Set restaurants throughout the area
		//Use ArrayList because the number is not specified
		List areaShops=new ArrayList<String>();
		areaShops.get(0);
		//Add area restaurants to the array
		areaShops.add("Amore");
		areaShops.add("Bo's");
		areaShops.add("Pappa");
		areaShops.add("Poppo");
		areaShops.add("Italiano");
		for(int i=0; i<6;i++) {
			System.out.println(areaShops.get(i));
		}
	}
}

Problem 1-1 Make sure that the most popular restaurants are displayed correctly from the top.

Problem 1-2 Make sure the restaurants in the entire area are displayed correctly.

Problem 1-3 Please add "Amore 2nd store" to the restaurant of the whole area and output the restaurant of the whole area.

Problem 1-4 Please change the behavior by inputting characters

Character to enter Movement
Best 3 人気Best 3のレストランを順位と共に表示
Area search View all restaurants in the area
add to 入力を指示してエリアにあるレストランを一件add toする。add to後、エリアにある全てのレストランと、「新たにXXがadd toされました」というメッセージを表示
Other characters Outputs "Processing is not possible with the entered characters" and requests character input again.

Recommended Posts

Java Development Basics ~ Exercise (Array) ~
Java Development Basics ~ How to Write Programs * Exercise 1 ~
[Java] array
Java array
Java array
java (array)
Java array
[Java] Array
Java basics
Java basics
Java array
Java basics
java array
[Java] Array
Java development training
java array variable
[Java development] Java memory
[Java] Array notes
Java development environment
Java JAR basics
Object-oriented (Java) basics
Java concurrency basics
Java Exercise "Intermediate"
Java Exercise "Beginner"
Java Development Basics ~ Development Environment Settings and Project Creation ~
Java development environment memo
Java programming basics practice-array
[Java ~ Array ~] Study memo 4
Java Network Basics (Communication)
Java development link summary
java development environment construction
[Development] Java framework comparison
Muscle Java Basics Day 1
[Java] List type / Array type conversion
Modern Java Development Guide (2018 Edition)
Basics of character operation (java)
Java Development Basics-Practice ③ Advanced Programming-
Java programming basics practice-for statement
Java development environment (Mac, Eclipse)
Summary of Java language basics
Java programming basics practice-switch statement
Getting Started with Java Basics
First Java development in Eclipse
[Java] Convert ArrayList to array
[Java Silver] Array generation method
[Java11] Stream Usage Summary -Basics-
How to initialize Java array
[Beginner] Java basic "array" description
[Java basics] What is Class?
Basics of Java development ~ How to write programs (variables and types) ~
About the basics of Android development
Java learning memo (creating an array)
Prepare Java development environment with Atom
Play Framework 2.6 (Java) development environment creation
Java Functional Programming Exercise Book --zipWith-
[Java] Output multidimensional array / spreadsheet (AOJ⑥ spreadsheet)
[Java] Declare and initialize an array
About the current development environment (Java 8)
Java array variables are reference types
[Java] Difference between array and ArrayList
Html5 development with Java using TeaVM