Java Beginner Exercises

This is an exercise I created when I gave a Java class for new employees in 2015/16.

It is unnecessary for qiita people, but please use it for training etc. It's created by me, so don't worry about copyright.

When I actually got it done, it only went halfway. In any case, please use it after recognizing the contents and checking.

■ Java exercises for inexperienced people Control statements / arrays

○ 0010 Find the area of the triangle -Set the base and height (both integers) as variables ・ Find the area of the triangle ・ Note, note that it is not an integer ・ Display the area

○ 0020 Display all startup arguments

○ 0030 Find the area of a quadrangle

○ 0040 Create a method to find the area of a quadrangle and call it from the main method.

○ 0050 Create a method to find the area of a quadrangle and call it from the main method. Vertical and horizontal numbers should be given from the startup argument To change the invocation argument to a number, use the following method   public static inf toInt(String str) {    return Integer.parseInt(str);   }

○ 0060 Even / odd number judgment Set an integer value to a variable appropriately Judge the value and display it as "even" or "odd"

○ 0070 int Swap the values of variables a and b without using other variables

○ 0080 Determine if the specified year is a leap year Set year as variable Determine if it is a leap year Display "leap year" or "normal year" The part to judge should be a method Test in the following years   2015,2016,2100,2400

○ 0090 Display the value of a numeric variable 10 times The part to be displayed should be a method

○ 0100 Set a numerical value and the number of times, add the numerical value for the number of times, and display the result on the screen. Using a for statement

○ 0110 Set a numerical value and the number of times, add the numerical value for the number of times, and display the result on the screen. Using a while statement

○ 0120 Set a numerical value and the number of times, add the numerical value for the number of times, and display the result on the screen. Use the do-while statement

○ 0130 Weather Forecast-Use if statement Set forecast as variable 1: Sunny, 2: Cloudy, 3: Rain, 4: Snow If it rains or snows, it says "bring an umbrella"

○ 0140 Weather Forecast-Use switch statement Set forecast as variable 1: Sunny, 2: Cloudy, 3: Rain, 4: Snow If it rains or snows, it says "bring an umbrella"

○ 0150 Weather forecast --Do not use if statement or switch statement Set forecast as variable 1: Sunny, 2: Cloudy, 3: Rain, 4: Snow If it rains or snows, it says "bring an umbrella"

○ 0160 Numerical calculation Set the variable a to any number from 0 to 9 Set the variable b to an appropriate value If the variable a is 0,3,6,8, the variable b is tripled and displayed. If the variable a is other than, the variable b is doubled and displayed.

○ 0170 Numerical calculation --Do not use if statement or switch statement Set the variable a to any number from 0 to 9 Set the variable b to an appropriate value If the variable a is 0,3,6,8, the variable b is tripled and displayed. If the variable a is other than, the variable b is doubled and displayed.

○ 0180 The day of the week ("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun") is judged and the day of the week is displayed in Japanese.

○ 0190 Judge the day of the week ("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun") and display the day of the week in Japanese. Do not use if or switch statements

○ 0200 Determines the day of the week ("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun") and displays it as "holiday" or "work". Do not use if or switch statements

○ 0210 Use an if statement that displays a greeting based on the time (0 to 23:00) 0-5: Closed 6-11: Good morning 12 to 17: Hello 18-23: Tonight

○ 0220 Use a switch statement that displays a greeting based on the time (0 to 23:00) 0-5: Closed 6-11: Good morning 12 to 17: Hello 18-23: Tonight

○ 0230 Do not use if or switch statements that display greetings based on the time (0 to 23:00). 0-5: Closed 6-11: Good morning 12 to 17: Hello 18-23: Tonight

○ 0240 Find the total value of an array of integers test data    int[] intArray = new int[]{44,74,17,53,66,26,12,49,60,72,95,15,37,88,63,20,87,96,58,12}; ○ 0250 Find the maximum and minimum values from an array of integers Test data uses:    int[] intArray = new int[]{44,74,17,53,66,26,12,49,60,72,95,15,37,88,63,20,87,96,58,12};

○ 0260 Extract only even values from the array of integers and create another array test data    int[] intArray = new int[]{44,74,17,53,66,26,12,49,60,72,95,15,37,88,63,20,87,96,58,12};

○ 0270 Find and display the one that is larger than the average value of the array of integers. test data    int[] intArray = new int[]{44,74,17,53,66,26,12,49,60,72,95,15,37,88,63,20,87,96,58,12};

○ 0280 Management of product sales data Find the sales of the specified product name with the following product sales data Data structures use arrays only Product A: 100 Product B: 150 Product C: 120 Product D: 80

○ 0290 Management of product sales data Find the sales of the specified branch and product name with the following product sales data for each branch Data structures use arrays only Branch A Branch B Branch C Branch D Product A: 100, 150, 120, 110 Product B: 150, 110, 90, 130 Product C: 120, 200, 210, 170 Product D: 80, 70, 90, 110

○ 0300 Management of product sales data There is sales data of products for each branch as below, Show branches / products that have sold over 120 Data structures use arrays only Branch A Branch B Branch C Branch D Product A: 100, 150, 120, 110 Product B: 150, 110, 90, 130 Product C: 120, 200, 210, 170 Product D: 80, 70, 90, 110

○ 0310 Convert decimal numbers to binary numbers and display them.

○ 0320 Convert decimal numbers to hexadecimal numbers and display them.

○ 0330 Sort an array of integers-Sort logic is your own Data structures use arrays only test data    int[] intArray = new int[]{44,74,17,53,66,26,12,49,60,72,95,15,37,88,63,20,87,96,58,12}; ○ 0340 Sorting an array of strings --- Sort logic is your own Data structures use arrays only test data    String[] strArray = new String[]{     "emhjopwxaz",     "ykxfjihxvv",     "oqsuoeojku",     "stvzdzdplo",     "ftrmgkauna",     "ackzqxlchf",     "dqttpisosm",     "psjhgorrem",     "kfcrgfxenb",     "vwappsvdld",     "gvovlddccr",     "ybaoyevbsl",     "thhujdjaqk",     "luxrfzmlyz",     "zpewohxhvc",     "whcddsgogv",     "hzyjmgrbxw",     "mjmxnxawrw",     "hdndjktido",     "vymqiltdzq"    };

○ 0350 Find a prime number of 100 or less

○ 0360 Find prime numbers less than 100 --- Find with "Eratosthenes Sieve"   http://www2.cc.niigata-u.ac.jp/~takeuchi/tbasic/BackGround/ErSieve.html

○ 0370 There are numbers from 0 to 4 in the integer array Determine how many 1⇒1 pairs are 0⇒1⇒1⇒1⇒3 is one 0⇒1⇒1⇒1⇒1⇒3 is two Data structures use arrays only test data  int[] intArray = new int[] {   0,1,1,3,1,2,3,1,0,3,1,1,2,0,1,1,1,1,2,3,2,2,0,3,3,3,2,3,2,0,0,3,3,2,0,0,3,0,1,0  };

○ 0380 Find the number that appears most often and the number of times that the number from 0 to 9 is included in the integer array. Data structures use arrays only test data  int[] intArray = new int[] {   8,0,7,0,7,1,0,7,0,2,6,2,5,7,9,1,8,1,2,4,1,8,1,9,8,7,2,3,5,0  };

○ 0390 Find the number that appears most often in the array of integers and the number of times The number contained is a positive or 0 number Data structures use arrays only test data  int[] intArray = new int[]{   49,14,24,1,31,46,24,10,0,41,18,4,8,19,15,25,12,26,46,6,22,13,12,3,40,25,22,23,43,26,19,11,8,10,43,42,18,5,20,43,20,24,25,34,2,11,19,34,15,44,44,24,12,48,10,29,40,5,37,49,23,18,25,38,28,16,0,48,17,4,0,11,20,11,22,48,28,37,14,40,34,41,46,17,34,32,2,34,7,13,20,42,41,40,48,46,30,49,33,10  };

○ 0400 Define an address class ·Full name ·Postal code ·Prefectures ・ Municipalities and below

○ 0410 Create an address book app using an address class ·class ・ Address book app class ・ Address class ·Processing content ・ Create address data for five people and display it on the screen

○ 0420 Define a department class (of the company) ・ Department number ·Department name

○ 0430 Define employee class ·employee number ·Full name ·age ・ Affiliation department number

○ 0440 Create an employee information app using department class and employee class ·class ・ Employee information app class ・ Department class ・ Employee information class ·Processing content -Create two department objects, sales department and production department, etc. ・ Create 6 employee objects, divide the department appropriately ・ Display information of each employee including department name

○ 0450 Vending machine ・ A program that simulates a drink vending machine under the following conditions

  1. One type of product is handled and the price is 140 yen.
  2. The initial value of the stock is 5, and the sale will end when the stock runs out.
  3. When coins above the price are inserted, the goods and change will be discharged.
  4. Change shall be infinitely prepared. Coins other than 5.10 yen, 50 yen, 100 yen and 500 yen will not be accepted and will be returned.
  5. Bulk buying and continuous buying are not possible. A message is displayed for notes, product discharge, and change discharge. ・ Use the following for the process of inserting coins

import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException;

// Coin insertion process  private static int inputCoin() throws IOException { p ("The amount invested is" + getAmount () + "yen");   System.out.print("input coin >");   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   String st = br.readLine();   return Integer.parseInt(st);  }

==== ended

■ Java Exercises for Inexperienced People-String and java.util

□ String system-Beginner

○ 0010 Determine if a character string is a null character string

○ 0020 Search for "abc" from the following character strings, display the position, and count the total number.    "abcxyzabcxyzabcxyz abcxyzabcxyz"

○ 0030 Display the position of "abc" at the end of the following character string    "abcxyzabcxyzabcxyz abcxyzabcxyz"

○ 0040 Displays the position where "def" appears after "abc" appears from the following character strings.     "def abc def"

○ 0050 Uppercase / lowercase conversion --Make the first character of the following character string uppercase    "abcdef"

○ 0060 Uppercase / lowercase conversion-Make the last character of the following character string uppercase    "abcdef"

○ 0070 Delete string--Delete def from the following strings    "abcdefghijkl"

○ 0080 Delete string--Delete def from the following strings    "abcdefghijklabcdefghijkl"

○ 0090 Delete string-Delete the last "def" from the following strings    "abcdefghijklabcdefghijklabcdefghijkl"

○ 0100 String conversion-Converts Sunday of the following strings to Sunday Do not use replace, replaceAll, replaceFirst of String    "abcSundaydef"

○ 0110 Splitting character strings-Split the following strings into words separated by, Remove spaces before and after each word    " abc , def , ghi , jkl " Do not use string splits, note, use splits in practice Note, StringTokenizer is old and should not be used

○ 0120 Delete string --Delete the trailing def from the following string    "abcdefghijklabcdefghijkl"

□ List system-Beginner

○ 0210 Put an element in List and display all the elements

○ 0220 Put elements in List and display all the elements in reverse order.

○ 0230 Check if null can be entered in List

○ 0240 Check if the same value can be entered in List

○ 0250 Replace the element with the specified number in List with the specified character string. Create the following method   List replace(List list,String str)

○ 0260 Swap two numbered elements of List Create the following method   List swap(List list,int n0,int n1)

○ 0270 Delete elements starting with str from List Create the following method Think about achieving it in multiple ways   List remove(List list,String str) Test data uses:-Delete data starting with "b"   "aaa","bbb","ccc","bbb","ddd","eee","bbb","fff","ggg","bbb","hhh"

□ Set system-Beginner

○ 0310 Set a value in Set , and then retrieve and display all the values.

○ Check if null can be entered in 0320 Set

○ Check if the same value can be entered in 0330 Set

○ 0340 Set a value in Set and check if a certain value exists in Set ・ Contents of Set   "aaa","bbb","ccc","ddd","eee" ・ Contents to check   "bbb"   "zzz"

□ Map system-Beginner

○ 0410 Set keys and values in Map <String, String>, and extract and display all the keys and values.

○ 0420 Set the key and value in Map <String, String> and display all values.

○ Check if null can be entered in the key of 0430 Map

○ 0440 Check if null can be entered in the value of Map

○ 0450 Check if the same value can be entered in the Map value.

○ 0460 Delete a specific set of values from Map <String, String> -Delete the "333" value pair from the map below    "aaa" => "111"    "bbb" => "222"    "ccc" => "333"    "ddd" => "444"    "eee" => "555"

○ 0470 Display greetings based on the time (0 to 23:00) 0-5: Closed 6-11: Good morning 12 to 17: Hello 18-23: Tonight

○ 0480 Judge the day of the week ("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun") and display it as "holiday" or "work".

○ 0490 Management of product sales data --0 Find the sales of the specified product name with the following product sales data Product A: 100 Product B: 150 Product C: 120 Product D: 80

○ 0500 Product sales data management ―― 1 Find the sales of the specified branch and product name with the following product sales data for each branch Branch A Branch B Branch C Branch D Product A: 100, 150, 120, 110 Product B: 150, 110, 90, 130 Product C: 120, 200, 210, 170 Product D: 80, 70, 90, 110

○ 0510 Find the number that appears most often in the array of integers and the number of times The number contained is a positive or 0 number test data  int[] intArray = new int[]{   49,14,24,1,31,46,24,10,0,41,18,4,8,19,15,25,12,26,46,6,22,13,12,3,40,25,22,23,43,26,19,11,8,10,43,42,18,5,20,43,20,24,25,34,2,11,19,34,15,44,44,24,12,48,10,29,40,5,37,49,23,18,25,38,28,16,0,48,17,4,0,11,20,11,22,48,28,37,14,40,34,41,46,17,34,32,2,34,7,13,20,42,41,40,48,46,30,49,33,10  };

□ Sort system-Beginner

○ 0610 Sort the list of strings in ascending order --- Sort logic is your own Test data uses:     "emhjopwxaz",     "ykxfjihxvv",     "oqsuoeojku",     "stvzdzdplo",     "ftrmgkauna",     "ackzqxlchf",     "dqttpisosm",     "psjhgorrem",     "kfcrgfxenb",     "vwappsvdld",     "gvovlddccr",     "ybaoyevbsl",     "thhujdjaqk",     "luxrfzmlyz",     "zpewohxhvc",     "whcddsgogv",     "hzyjmgrbxw",     "mjmxnxawrw",     "hdndjktido",     "vymqiltdzq"

○ 0620 Sort the list of strings in descending order --- Sort logic is your own Test data uses:     "emhjopwxaz",     "ykxfjihxvv",     "oqsuoeojku",     "stvzdzdplo",     "ftrmgkauna",     "ackzqxlchf",     "dqttpisosm",     "psjhgorrem",     "kfcrgfxenb",     "vwappsvdld",     "gvovlddccr",     "ybaoyevbsl",     "thhujdjaqk",     "luxrfzmlyz",     "zpewohxhvc",     "whcddsgogv",     "hzyjmgrbxw",     "mjmxnxawrw",     "hdndjktido",     "vymqiltdzq"

□ Date system

○ 0710 Get today's date and display it in the format of "YYYY / MM / DD day of the week"

○ 0720 Create a Calendar object from integers yyyy, mm, dd

○ 0730 Ask for the day before Tests will be conducted on 2015/03/01 and 2016/03/01

○ 0740 Generate a Date object from a character string in the format YYYY / MM / DD

□ String system-advanced

○ 1010 Character string search I have two string arrays arrayA and arrayB and create the following method    boolean containsOne(String[] arrayA,String[] arrayB) true if any one (or more) of the strings in arrayA is in arrayB Other than false

arrayB test data     "ABC","DEF","GHI","JKL","MNO","PQR" arrayA test data     "DEF","YYY","ZZZ" ⇒ true     "DEF","GHI"    ⇒ true     "XXX","YYY","ZZZ" ⇒ false

○ 1020 Character string search I have two string arrays arrayA and arrayB and create the following method    boolean containsAll(String[] arrayA,String[] arrayB) true if all of the strings in arrayA are in arrayB Other than false

arrayB test data     "ABC","DEF","GHI","JKL","MNO","PQR" arrayA test data     "DEF","GHI","MNO" ⇒ true     "GHI",MNO","XXX"  ⇒ false     "XXX","YYY","ZZZ" ⇒ false

○ 1030 String search I have two string arrays arrayA and arrayB and create the following method    boolean notContainsOne(String[] arrayA,String[] arrayB) true if any one or more of the strings in arrayA are not in arrayB Other than false

arrayB test data     "ABC","DEF","GHI","JKL","MNO","PQR" arrayA test data     "DEF","GHI","JKL" ⇒ false     "DEF","GHI","XXX" ⇒ true     "XXX","YYY","ZZZ" ⇒ true

○ 1040 Character string search I have two string arrays arrayA and arrayB and create the following method    boolean notContainsAll(String[] arrayA,String[] arrayB) true if not all of the strings in arrayA are in arrayB Other than false

arrayB test data     "ABC","DEF","GHI","JKL","MNO","PQR" arrayA test data     "DEF","GHI","JKL" ⇒ false     "DEF","GHI","XXX" ⇒ false     "XXX","YYY","ZZZ" ⇒ true

○ 1050 Caesar cipher Create a program that decrypts the following sentences created with Caesar cipher The original text consists of uppercase and lowercase letters, spaces, and periods, including the word "apartment". Caesar cipher: Encrypts the alphabet by moving the specified number Example: Moving "IBM" by -1 will result in "HAL" The problem statement is moving as A after Z and a after z, with the periods and spaces intact.

"Xnslqj Bmnyj Kjrfqj ktqqtbx ymj qnkj tk f btrfs ymfy pnhpx mjw gtdkwnjsi tzy tk mjw ybt gjiwttr fufwyrjsy. Ymjs xmj knsix f sjwid xmd wttrrfyj yt xuqny ymj wjsy bnym."

□ Map system-advanced

○ Extract and display all the values of 2010 Map Test data uses:    "aaa" -> "xxx"    "bbb" -> "yyy"    "ccc" -> null    "ddd" -> "zzz"    "eee" -> null

○ 2020 Create a new map with null values removed   Map<String,String> removeNull(Map<String,String> map) Test data uses:    "aaa" -> "xxx"    "bbb" -> "yyy"    "ccc" -> null    "ddd" -> "zzz"    "eee" -> null

○ 2030 Extract a key with a null value   Set nullData(Map<String,String> map) Test data uses:    "aaa" -> "xxx"    "bbb" -> "yyy"    "ccc" -> null    "ddd" -> "zzz"    "eee" -> null

○ Create a Map that extracts only the data with duplicate values from the 2040 Map Create a new map while keeping the original map Test data uses:    "aaa" -> "xxx"    "bbb" -> "yyy"    "ccc" -> "xxx"    "ddd" -> "zzz"    "eee" -> "yyy"

○ Create a Map with the 2050 Map values and keys reversed Create a new map while keeping the original map Test data uses:    "aaa" -> "111"    "bbb" -> "222"    "ccc" -> "333"    "ddd" -> "444"    "eee" -> "555"

○ Display the number of values used in the 2060 Map Test data uses:    "aaa" -> "111"    "bbb" -> "222"    "ccc" -> "333"    "ddd" -> "444"    "eee" -> "555"    "fff" -> "333"    "ggg" -> "222"    "hhh" -> "333"

○ Display the number of times and key of the most used value in 2070 Map Test data uses:    "aaa" -> "111"    "bbb" -> "222"    "ccc" -> "333"    "ddd" -> "444"    "eee" -> "555"    "fff" -> "333"    "ggg" -> "222"    "hhh" -> "333"

○ 2080 Exchange the values of key0 and key1 Create a new map while keeping the original map  Map<String,String> reverse(Map<String,String> map,String key0,String key1) Swap the values of the keys "bbb" and "ddd" Test data uses:    "aaa" -> "111"    "bbb" -> "222"    "ccc" -> "333"    "ddd" -> "444"    "eee" -> "555"

○ 2090 AND of map0 and map1, take out the one with the same key, you do not have to worry about the value Create a new map while keeping the original map  Map<String,String> and(Map<String,String> map0,Map<String,String> map1) Test data uses:   map0    "aaa" -> "111"    "bbb" -> "222"    "ccc" -> "333"    "ddd" -> "444"    "eee" -> "555"   map1    "bbb" -> "222"    "ccc" -> "333"    "ddd" -> "444"    "fff" -> "555"    "ggg" -> "666"

○ 2100 OR of map0 and map1, take out the one with the key, you don't have to worry about the value Create a new map while keeping the original map  Map<String,String> or<Map<String,String> map0,Map<String,String> map1) Test data uses:   map0    "aaa" -> "111"    "bbb" -> "222"    "ccc" -> "333"    "ddd" -> "444"    "eee" -> "555"   map1    "bbb" -> "222"    "ccc" -> "333"    "ddd" -> "444"    "fff" -> "555"    "ggg" -> "666"

○ 2110 XOR of map0 and map1, take out the ones whose keys are not common Create a new map while keeping the original map  Map<String,String> xor(Map<String,String> map0,Map<String,String> map1) Test data uses:   map0    "aaa" -> "111"    "bbb" -> "222"    "ccc" -> "333"    "ddd" -> "444"    "eee" -> "555"   map1    "bbb" -> "222"    "ccc" -> "333"    "ddd" -> "444"    "fff" -> "555"    "ggg" -> "666"

○ 2120 Subtract map1 from map0 -Draw the key that exists in map1 from map0 -Keys that exist in map1 but not in map0 can be ignored Create a new map while keeping the original map  Map<String,String> subtract(Map<String,String> map0,Map<String,String> map1)

Test data uses:   map0    "aaa" -> "111"    "bbb" -> "222"    "ccc" -> "333"    "ddd" -> "444"    "eee" -> "555"   map1    "bbb" -> "222"    "ccc" -> "333"    "ddd" -> "444"    "fff" -> "555"    "ggg" -> "666"

○ 2130 Determine if map0 and map1 are equal, determine if both keys and values are equal  boolean equals(Map<String,String> map0,Map<String,String> map1) Use the following for test data-Test Case 1   map0    "aaa" -> "111"    "bbb" -> "222"    "ccc" -> "333"    "ddd" -> "444"    "eee" -> "555"   map1    "aaa" -> "111"    "bbb" -> "222"    "ccc" -> "333"    "ddd" -> "444"    "eee" -> "555" Use the following for test data-Test Case 2   map0    "aaa" -> "111"    "bbb" -> "222"    "ccc" -> "333"    "ddd" -> "444"    "eee" -> "555"   map1    "aaa" -> "111"    "bbb" -> "222"    "ccc" -> "333"    "ddd" -> "zzz"    "eee" -> "555" Use the following for test data-Test Case 3   map0    "aaa" -> "111"    "bbb" -> "222"    "ccc" -> "333"    "ddd" -> "444"    "eee" -> "555"   map1    "aaa" -> "111"    "bbb" -> "222"    "ccc" -> "333"    "ddd" -> "444"    "zzz" -> "555" Use the following for test data-Test Case 4   map0    "aaa" -> "111"    "bbb" -> "222"    "ccc" -> "333"    "ddd" -> "444"    "eee" -> "555"   map1    "aaa" -> "111"    "bbb" -> "222"    "ccc" -> "333"    "ddd" -> "444"    "eee" -> "555"    "fff" -> "666"

□ List system-advanced

○ 2510 Determine if all the elements of list1 are included in list0  boolean containsAll(List list0,List list1) Use the following for test data-Test Case 1  list0   "aaa"   "bbb"   "ccc"   "ddd"   "eee"  list1   "bbb"   "ccc"   "ddd" Use the following for test data-Test Case 2  list0   "aaa"   "bbb"   "ccc"   "ddd"   "eee"  list1   "bbb"   "ccc"   "ddd"   "zzz"

○ 2520 Determine if any of the elements in list1 are included in list0  boolean containsAny(List list0,List list1) Use the following for test data-Test Case 1  list0   "aaa"   "bbb"   "ccc"   "ddd"   "eee"  list1   "bbb"   "ccc"   "ddd" Use the following for test data-Test Case 2  list0   "aaa"   "bbb"   "ccc"   "ddd"   "eee"  list1   "xxx"   "yyy"   "zzz"

○ 2530 Returns the index of null values contained in list  List nullIndex(List list) Use the following for test data-Test Case 1   "aaa"   "bbb"   null   "ccc"   null   "ddd"   "eee"

○ 2540 Remove duplicate elements in list and leave only one  List uniq(List list) Use the following for test data-Test Case 1   "aaa"   "bbb"   "ccc"   "ddd"   "eee"   "bbb"   "ddd"   "bbb"

○ 2550 Returns a list from list0 with the elements of list1 removed. Create a new list, keeping the original list Elements that exist in list1 but not in list0 can be ignored  List subtract(List list0,List list1) Test data uses:  list0   "aaa"   "bbb"   "ccc"   "ddd"   "eee"  list1   "aaa"   "bbb"   "zzz"

○ 2560 Returns true if even one element of list1 is not included in list0  boolean notContainsAny(List list0,List list1) Use the following for test data-Test Case 1  list0   "aaa"   "bbb"   "ccc"   "ddd"   "eee"  list1   "aaa"   "bbb"   "ccc" Use the following for test data-Test Case 2  list0   "aaa"   "bbb"   "ccc"   "ddd"   "eee"  list1   "aaa"   "bbb"   "zzz"

○ 2570 Returns true if all the elements of list1 are not included in list0  boolean notContainsAll(List list0,List list1); Use the following for test data-Test Case 1  list0   "aaa"   "bbb"   "ccc"   "ddd"   "eee"  list1   "aaa"   "bbb"   "zzz" Use the following for test data-Test Case 2  list0   "aaa"   "bbb"   "ccc"   "ddd"   "eee"  list1   "xxx"   "yyy"   "zzz"

○ Create a new list of the data contained in the 2580 List, excluding nulls and duplicate values. Test data uses:   "aaa"   "bbb"   null   "ccc"   "bbb"   "ddd"   "bbb"   null   "eee"

○ Of the data in the 2590 List, check the data with the largest number of duplicates and the duplicates. Test data uses:   "aaa"   "bbb"   "ccc"   "bbb"   "ddd"   "bbb"   "eee"   "ccc"

□ Set system-advanced

○ Check if the same value can be entered in 3010 Set

○ Check if null can be put in 3020 Set

○ 3030 Determine if all the elements of set1 are included in set0  boolean containsAll(Set set0,Set set1) Use the following for test data-Test Case 1  set0   "aaa"   "bbb"   "ccc"   "ddd"   "eee"   "fff"  set1   "ccc"   "ddd"   "eee" Use the following for test data-Test Case 2  set0   "aaa"   "bbb"   "ccc"   "ddd"   "eee"   "fff"  set1   "ccc"   "ddd"   "eee"   "zzz"

○ 3040 Determine if any of the elements of set1 are included in set0  boolean containsAny(Set set0,Set set1) Use the following for test data-Test Case 1  set0   "aaa"   "bbb"   "ccc"   "ddd"   "eee"   "fff"  set1   "ccc"   "ddd"   "eee" Use the following for test data-Test Case 2  set0   "aaa"   "bbb"   "ccc"   "ddd"   "eee"   "fff"  set1   "xxx"   "yyy"   "zzz"

○ 3050 AND of set0 and set1  Set and(Set set0,Set set1) Use the following for test data-Test Case 1  set0   "aaa"   "bbb"   "ccc"   "ddd"   "eee"   "fff"  set1   "ccc"   "ddd"   "xxx"   "yyy" Use the following for test data-Test Case 2  set0   "aaa"   "bbb"   "ccc"   "ddd"   "eee"   "fff"  set1   "xxx"   "yyy"   "zzz"

○ 3060 OR of set0 and set1  Set or(Set set0,Set set1) Use the following for test data-Test Case 1  set0   "aaa"   "bbb"   "ccc"   "ddd"   "eee"   "fff"  set1   "ccc"   "ddd"   "xxx"   "yyy"

○ 3070 XOR of set0 and set1  Set xor<Set set0,Set set1) Use the following for test data-test case  set0   "aaa"   "bbb"   "ccc"   "ddd"   "eee"   "fff"  set1   "ccc"   "ddd"   "xxx"   "yyy"

○ 3080 Returns Set with the elements of set1 removed from set0 Elements included in set1 but not in set0 can be ignored  Set substract(Set set0,Set set1) Test data uses:  set0   "aaa"   "bbb"   "ccc"   "ddd"   "eee"   "fff"  set1   "ccc"   "ddd"   "xxx"   "yyy"

○ 3090 Returns true if even one element of set0 is not included in set1  boolean notContainsAny(Set set0,Set set1) Use the following for test data-Test Case 1  set0   "aaa"   "bbb"   "ccc"   "ddd"   "eee"   "fff"  set1   "ccc"   "ddd"   "xxx"   "yyy" Use the following for test data-Test Case 2  set0   "aaa"   "bbb"   "ccc"   "ddd"   "eee"   "fff"  set1   "aaa"   "bbb"

○ 3100 Returns true if all set0 elements are not included in set1  boolean notContainsAll(Set set0,Set set1) Use the following for test data-Test Case 1  set0   "aaa"   "bbb"   "ccc"   "ddd"   "eee"   "fff"  set1   "ccc"   "ddd"   "xxx"   "yyy" Use the following for test data-Test Case 2  set0   "aaa"   "bbb"   "ccc"   "ddd"   "eee"   "fff"  set1   "xxx"   "yyy"

□ Sort system-advanced

○ 4010 Create a Person class with a name and address (prefectures only), create a Comparator class for the Person class, and do the following: ・ Sort by name in ascending order ・ Sort by name in descending order ・ Sort by address in ascending order ・ Sort by address in descending order ・ Descending address ⇒ Sort by name descending

○ Do the same thing as 4020 3002 by implementing Compable in Person

□ Comprehensive problem

○ 9010 Conference room reservation confirmation

/ ** Meeting room information class * / class Room { private int id; // meeting room ID private int number; // Capacity } // ** Reservation information class * / class ReserveInfo { int roomId; // Meeting room ID int timeId; // time ID } / ** Meeting room list * / private List roomList; / ** Reservation information list * / private List reserveList;

-Create the following method based on the above information

/ ** Check the available meeting room at the specified time * / public List findRoom(int timeId);

/ ** Check the conference room with the largest capacity at the designated time * / public int findLargestRoom(int fromTimeId,int toTimeId);

○ 9020 Air route search

Routes between multiple airports are defined in the following array

String[][] routes { {"Departure", "Destination"}, {"Departure", "Destination"}, {"Departure", "Destination"}, }

/ ** Explore all air routes to your destination * / public List<List> findRoutes(String start,String target);

○ 9030 Parts configuration problem

/ ** Parts configuration class * / class Part { // Product ID  private int id; // Parts composition // Parts that make up the product Product ID-> Required number of maps // If parts is null, there are no subordinate parts (purchased from outside)  private Map<Integer,Integer> parts; // Manufacturing period (or delivery period)  private int leadTime; } / ** Ordering information * / class Order { private int id; // Part ID private int cnt; // Number of orders private int date; // Ordering time (as seen from product completion time) } // List of products (parts) private List partList;

・ Background explanation ・ There is a factory that assembles products ・ The product consists of multiple parts -There are parts that are assembled at the factory (intermediate products) and those that are purchased from outside. ・ Consists of multiple parts to be assembled ・ Parts to be assembled with the product have a period required for assembly ・ Note, for simplification, it does not depend on the number ・ Parts to be purchased have a period (delivery date) from ordering to delivery.

-Create the following method based on the above information

/**

/**

/**

○ 9040 Parts configuration problem-continued

Add the following information to the Part class

int min; // Minimum number of manufactured (ordered)

When manufacturing products (intermediate products), even if the required number is less than that, manufacture in this quantity unit. When ordering parts, even if the required quantity is less than that, order in units of this quantity

/**

==== ended

Recommended Posts

Java Beginner Exercises
java beginner 4
java beginner 3
java beginner
Java exercises [Basic]
Java Exercise "Beginner"
Progate Java (Beginner) Review & Summary
Java starting from beginner, override
Java, instance starting from beginner
Java
Java starting from beginner, inheritance
Java
[Beginner] Java basic "array" description
Solve AtCoder Beginner Contest 151 in java
Solve AtCoder Beginner Contest 150 in java
Solve AtCoder Beginner Contest 153 in java
[Java beginner] About abstraction and interface
[Java beginner] == operator and equals method
Solve AtCoder Beginner Contest 175 in java
Java overload constructor starting from beginner
Solve AtCoder Beginner Contest 160 in java
Java, interface to start from beginner
Solve AtCoder Beginner Contest 152 in java
Solve AtCoder Beginner Contest 156 in java
Java beginner design pattern (Factory Method pattern)
AtCoder Beginner Contest 167 C Problem (Java)
Studying Java ―― 3
[Java] array
Java protected
[Java] Annotation
[Java] Module
Java starting from beginner, variables and types
Java array
Studying Java ―― 9
Java scratch scratch
Java tips, tips
Java methods
Java method
java (constructor)
Java array
[Java] ArrayDeque
java (override)
java (method)
Java Day 2018
Java string
java (array)
Java static
Java serialization
JAVA paid
Studying Java ―― 4
java shellsort
[Java] compareTo
java reflexes
java (interface)
Java memorandum
☾ Java / Collection
Java array
Studying Java ―― 1
[Java] Array
[Java] Polymorphism
Java review