English
Tasks
Complete the task of the chosen difficulty level for your variant number.
Computational methods must not read from the console themselves.
Variants
Variant 1. Score statistics
1. Initial level. Create a Java console program: enter 1..100 scores from 0..100; separate methods compute the minimum, maximum, and mean without changing the array; print the results. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input.
2. Basic level. Create a Java console program: enter 1..100 scores from 0..100; separate methods compute the minimum, maximum, and mean without changing the array; print the results. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter 1..100 scores from 0..100; separate methods compute the minimum, maximum, and mean without changing the array; print the results. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets. Add: the median of a sorted copy, the smallest mode when frequencies tie, and a histogram of the count of each score. Implement --help, named parameters, and a repeatable --item with a compound value: fields of the described data set are separated by semicolons, and the delimiter is prohibited in text. With no arguments, prompt for the same data from the keyboard. Write diagnostics to stderr; exit code 0 means success, 2 an input error, and 1 an unexpected runtime error. Print an aligned results table and final counts; add at least five checks: normal, boundary, invalid format, an invariant violation, and rejection without a state change.
Variant 2. Educational Caesar cipher
1. Initial level. Create a Java console program: enter ASCII text A..Z and a shift 0..25; encode and decode methods perform a cyclic shift; print the ciphertext and restored text, identifying the algorithm as educational and unsuitable for security. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input.
2. Basic level. Create a Java console program: enter ASCII text A..Z and a shift 0..25; encode and decode methods perform a cyclic shift; print the ciphertext and restored text, identifying the algorithm as educational and unsuitable for security. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter ASCII text A..Z and a shift 0..25; encode and decode methods perform a cyclic shift; print the ciphertext and restored text, identifying the algorithm as educational and unsuitable for security. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets. Add: frequencies of the 26 letters and all 26 reverse-shift candidates without automatically promising the correct key. Implement --help, named parameters, and a repeatable --item with a compound value: fields of the described data set are separated by semicolons, and the delimiter is prohibited in text. With no arguments, prompt for the same data from the keyboard. Write diagnostics to stderr; exit code 0 means success, 2 an input error, and 1 an unexpected runtime error. Print an aligned results table and final counts; add at least five checks: normal, boundary, invalid format, an invariant violation, and rejection without a state change.
Variant 3. Weekly temperatures
1. Initial level. Create a Java console program: enter a 7 by 3 matrix of finite temperatures −50..60; methods compute each day's mean and the overall minimum; print a table. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input.
2. Basic level. Create a Java console program: enter a 7 by 3 matrix of finite temperatures −50..60; methods compute each day's mean and the overall minimum; print a table. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter a 7 by 3 matrix of finite temperatures −50..60; methods compute each day's mean and the overall minimum; print a table. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets. Add: means for each of the three observation times and the warmest day, choosing the first in a tie. Implement --help, named parameters, and a repeatable --item with a compound value: fields of the described data set are separated by semicolons, and the delimiter is prohibited in text. With no arguments, prompt for the same data from the keyboard. Write diagnostics to stderr; exit code 0 means success, 2 an input error, and 1 an unexpected runtime error. Print an aligned results table and final counts; add at least five checks: normal, boundary, invalid format, an invariant violation, and rejection without a state change.
Variant 4. Anagrams
1. Initial level. Create a Java console program: enter two words of Latin letters up to 50 characters long; lowercase with Locale.ROOT, sort copies of char arrays, and compare; print whether they are anagrams. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input.
2. Basic level. Create a Java console program: enter two words of Latin letters up to 50 characters long; lowercase with Locale.ROOT, sort copies of char arrays, and compare; print whether they are anagrams. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter two words of Latin letters up to 50 characters long; lowercase with Locale.ROOT, sort copies of char arrays, and compare; print whether they are anagrams. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets. Add: grouping of up to 20 words with the same normalized letters without collections. Implement --help, named parameters, and a repeatable --item with a compound value: fields of the described data set are separated by semicolons, and the delimiter is prohibited in text. With no arguments, prompt for the same data from the keyboard. Write diagnostics to stderr; exit code 0 means success, 2 an input error, and 1 an unexpected runtime error. Print an aligned results table and final counts; add at least five checks: normal, boundary, invalid format, an invariant violation, and rejection without a state change.
Variant 5. Manual sorting
1. Initial level. Create a Java console program: enter 1..100 integers −1000..1000; selectionSort sorts a copy using selection sort and counts element comparisons and actual swaps; print the array and counters. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input.
2. Basic level. Create a Java console program: enter 1..100 integers −1000..1000; selectionSort sorts a copy using selection sort and counts element comparisons and actual swaps; print the array and counters. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter 1..100 integers −1000..1000; selectionSort sorts a copy using selection sort and counts element comparisons and actual swaps; print the array and counters. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets. Add: insertionSort with counters for comparisons and movements, and comparison with Arrays.sort. Implement --help, named parameters, and a repeatable --item with a compound value: fields of the described data set are separated by semicolons, and the delimiter is prohibited in text. With no arguments, prompt for the same data from the keyboard. Write diagnostics to stderr; exit code 0 means success, 2 an input error, and 1 an unexpected runtime error. Print an aligned results table and final counts; add at least five checks: normal, boundary, invalid format, an invariant violation, and rejection without a state change.
Variant 6. Battleship board
1. Initial level. Create a Java console program: enter coordinates of up to 10 single-cell ships on a 10 by 10 board without duplicates, and one shot coordinate; print hit or miss and the board with the shot marked. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input.
2. Basic level. Create a Java console program: enter coordinates of up to 10 single-cell ships on a 10 by 10 board without duplicates, and one shot coordinate; print hit or miss and the board with the shot marked. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter coordinates of up to 10 single-cell ships on a 10 by 10 board without duplicates, and one shot coordinate; print hit or miss and the board with the shot marked. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets. Add: a sequence of up to 100 shots, rejection of repeated shots, and the count of unsunk ships. Implement --help, named parameters, and a repeatable --item with a compound value: fields of the described data set are separated by semicolons, and the delimiter is prohibited in text. With no arguments, prompt for the same data from the keyboard. Write diagnostics to stderr; exit code 0 means success, 2 an input error, and 1 an unexpected runtime error. Print an aligned results table and final counts; add at least five checks: normal, boundary, invalid format, an invariant violation, and rejection without a state change.
Variant 7. Educational password scoring
1. Initial level. Create a Java console program: enter a string of up to 100 ASCII characters; a method awards one point each for length of at least 12, uppercase letters, lowercase letters, digits, and other characters; print 0..5 and explain that the score does not guarantee security. Provide a UML class diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input.
2. Basic level. Create a Java console program: enter a string of up to 100 ASCII characters; a method awards one point each for length of at least 12, uppercase letters, lowercase letters, digits, and other characters; print 0..5 and explain that the score does not guarantee security. Provide a UML class diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter a string of up to 100 ASCII characters; a method awards one point each for length of at least 12, uppercase letters, lowercase letters, digits, and other characters; print 0..5 and explain that the score does not guarantee security. Provide a UML class diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets. Add: construction of sample test strings from specified character sets without using them as real account secrets. Implement --help, named parameters, and a repeatable --item with a compound value: fields of the described data set are separated by semicolons, and the delimiter is prohibited in text. With no arguments, prompt for the same data from the keyboard. Write diagnostics to stderr; exit code 0 means success, 2 an input error, and 1 an unexpected runtime error. Print an aligned results table and final counts; add at least five checks: normal, boundary, invalid format, an invariant violation, and rejection without a state change.
Variant 8. Normalizing full names
1. Initial level. Create a Java console program: enter three nonempty Ukrainian words without hyphens or apostrophes; strip, whitespace splitting, and case conversion produce a surname and initials; print the result. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input.
2. Basic level. Create a Java console program: enter three nonempty Ukrainian words without hyphens or apostrophes; strip, whitespace splitting, and case conversion produce a surname and initials; print the result. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter three nonempty Ukrainian words without hyphens or apostrophes; strip, whitespace splitting, and case conversion produce a surname and initials; print the result. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets. Add: transliteration using an educational table of 33 mappings printed explicitly in the README, without claiming official compliance. Implement --help, named parameters, and a repeatable --item with a compound value: fields of the described data set are separated by semicolons, and the delimiter is prohibited in text. With no arguments, prompt for the same data from the keyboard. Write diagnostics to stderr; exit code 0 means success, 2 an input error, and 1 an unexpected runtime error. Print an aligned results table and final counts; add at least five checks: normal, boundary, invalid format, an invariant violation, and rejection without a state change.
Variant 9. Magic square
1. Initial level. Create a Java console program: enter a 3 by 3 square containing numbers 1..9 without repetition; check equal sums for rows, columns, and both diagonals; print the result and sums. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input.
2. Basic level. Create a Java console program: enter a 3 by 3 square containing numbers 1..9 without repetition; check equal sums for rows, columns, and both diagonals; print the result and sums. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter a 3 by 3 square containing numbers 1..9 without repetition; check equal sums for rows, columns, and both diagonals; print the result and sums. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets. Add: construction of an odd-order square n=3..9 by moving up and right with wrapping boundaries, or down when a cell is occupied. Implement --help, named parameters, and a repeatable --item with a compound value: fields of the described data set are separated by semicolons, and the delimiter is prohibited in text. With no arguments, prompt for the same data from the keyboard. Write diagnostics to stderr; exit code 0 means success, 2 an input error, and 1 an unexpected runtime error. Print an aligned results table and final counts; add at least five checks: normal, boundary, invalid format, an invariant violation, and rejection without a state change.
Variant 10. Word frequency
1. Initial level. Create a Java console program: enter a string of up to 1000 Latin letters and spaces; normalize case and determine frequencies using word and counter arrays; print words in lexicographic order. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input.
2. Basic level. Create a Java console program: enter a string of up to 1000 Latin letters and spaces; normalize case and determine frequencies using word and counter arrays; print words in lexicographic order. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter a string of up to 1000 Latin letters and spaces; normalize case and determine frequencies using word and counter arrays; print words in lexicographic order. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets. Add: the most frequent and longest words, choosing the lexicographically first in a tie, and an HTML report using a text block. Implement --help, named parameters, and a repeatable --item with a compound value: fields of the described data set are separated by semicolons, and the delimiter is prohibited in text. With no arguments, prompt for the same data from the keyboard. Write diagnostics to stderr; exit code 0 means success, 2 an input error, and 1 an unexpected runtime error. Print an aligned results table and final counts; add at least five checks: normal, boundary, invalid format, an invariant violation, and rejection without a state change.
Variant 11. Game of Life
1. Initial level. Create a Java console program: enter a rectangular 1..20 by 1..20 matrix of 0/1 values; perform one Conway step: a live cell survives with 2 or 3 neighbors, a dead cell becomes live with 3, and everything outside the board is dead; print the new matrix. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input.
2. Basic level. Create a Java console program: enter a rectangular 1..20 by 1..20 matrix of 0/1 values; perform one Conway step: a live cell survives with 2 or 3 neighbors, a dead cell becomes live with 3, and everything outside the board is dead; print the new matrix. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter a rectangular 1..20 by 1..20 matrix of 0/1 values; perform one Conway step: a live cell survives with 2 or 3 neighbors, a dead cell becomes live with 3, and everything outside the board is dead; print the new matrix. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets. Add: up to 100 generations with two buffers and the live-cell count after each. Implement --help, named parameters, and a repeatable --item with a compound value: fields of the described data set are separated by semicolons, and the delimiter is prohibited in text. With no arguments, prompt for the same data from the keyboard. Write diagnostics to stderr; exit code 0 means success, 2 an input error, and 1 an unexpected runtime error. Print an aligned results table and final counts; add at least five checks: normal, boundary, invalid format, an invariant violation, and rejection without a state change.
Variant 12. Round-robin tournament
1. Initial level. Create a Java console program: enter an even number of teams 2..10 and nonempty names; generate all unordered team pairs in a separate method; print the pairs. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input.
2. Basic level. Create a Java console program: enter an even number of teams 2..10 and nonempty names; generate all unordered team pairs in a separate method; print the pairs. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter an even number of teams 2..10 and nonempty names; generate all unordered team pairs in a separate method; print the pairs. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets. Add: a schedule of n−1 rounds using rotation, with each team playing once per round and no repeated pairs. Implement --help, named parameters, and a repeatable --item with a compound value: fields of the described data set are separated by semicolons, and the delimiter is prohibited in text. With no arguments, prompt for the same data from the keyboard. Write diagnostics to stderr; exit code 0 means success, 2 an input error, and 1 an unexpected runtime error. Print an aligned results table and final counts; add at least five checks: normal, boundary, invalid format, an invariant violation, and rejection without a state change.
Variant 13. Card check digit
1. Initial level. Create a Java console program: enter 16 ASCII digits of an educational number; apply the Luhn check, doubling every second digit from the right after the check digit and subtracting 9 when the result exceeds 9; print validity and only the last four digits with masking. Provide a UML class diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input.
2. Basic level. Create a Java console program: enter 16 ASCII digits of an educational number; apply the Luhn check, doubling every second digit from the right after the check digit and subtracting 9 when the result exceeds 9; print validity and only the last four digits with masking. Provide a UML class diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter 16 ASCII digits of an educational number; apply the Luhn check, doubling every second digit from the right after the check digit and subtracting 9 when the result exceeds 9; print validity and only the last four digits with masking. Provide a UML class diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets. Add: an array of synthetic numbers and a count of valid numbers; do not print full numbers. Implement --help, named parameters, and a repeatable --item with a compound value: fields of the described data set are separated by semicolons, and the delimiter is prohibited in text. With no arguments, prompt for the same data from the keyboard. Write diagnostics to stderr; exit code 0 means success, 2 an input error, and 1 an unexpected runtime error. Print an aligned results table and final counts; add at least five checks: normal, boundary, invalid format, an invariant violation, and rejection without a state change.
Variant 14. Large-number arithmetic
1. Initial level. Create a Java console program: enter two nonnegative decimal numbers of up to 100 digits; store digits in arrays and add with carry without BigInteger; print the normalized sum. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input.
2. Basic level. Create a Java console program: enter two nonnegative decimal numbers of up to 100 digits; store digits in arrays and add with carry without BigInteger; print the normalized sum. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter two nonnegative decimal numbers of up to 100 digits; store digits in arrays and add with carry without BigInteger; print the normalized sum. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets. Add: long multiplication with a carry array and checks for zeros and leading zeros. Implement --help, named parameters, and a repeatable --item with a compound value: fields of the described data set are separated by semicolons, and the delimiter is prohibited in text. With no arguments, prompt for the same data from the keyboard. Write diagnostics to stderr; exit code 0 means success, 2 an input error, and 1 an unexpected runtime error. Print an aligned results table and final counts; add at least five checks: normal, boundary, invalid format, an invariant violation, and rejection without a state change.
Variant 15. Recursive problems
1. Initial level. Create a Java console program: enter a disk count 0..10; a recursive Hanoi method prints moves A→C via B and the step count; print 0 steps for zero. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input.
2. Basic level. Create a Java console program: enter a disk count 0..10; a recursive Hanoi method prints moves A→C via B and the step count; print 0 steps for zero. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter a disk count 0..10; a recursive Hanoi method prints moves A→C via B and the step count; print 0 steps for zero. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets. Add: fast exponentiation of an integer −10..10 to a power 0..18 using Math.multiplyExact, explicitly defining the zeroth power as 1. Implement --help, named parameters, and a repeatable --item with a compound value: fields of the described data set are separated by semicolons, and the delimiter is prohibited in text. With no arguments, prompt for the same data from the keyboard. Write diagnostics to stderr; exit code 0 means success, 2 an input error, and 1 an unexpected runtime error. Print an aligned results table and final counts; add at least five checks: normal, boundary, invalid format, an invariant violation, and rejection without a state change.
Variant 16. Table from lines
1. Initial level. Create a Java console program: enter 1..20 lines in name;price;quantity format, with no delimiter allowed in the name, price 0..100000 kopiykas, and quantity 1..100; split with limit −1 preserves empty fields; print an aligned table and a long total. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input.
2. Basic level. Create a Java console program: enter 1..20 lines in name;price;quantity format, with no delimiter allowed in the name, price 0..100000 kopiykas, and quantity 1..100; split with limit −1 preserves empty fields; print an aligned table and a long total. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter 1..20 lines in name;price;quantity format, with no delimiter allowed in the name, price 0..100000 kopiykas, and quantity 1..100; split with limit −1 preserves empty fields; print an aligned table and a long total. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets. Add: sorting rows by name and a separate report of invalid rows without shifting columns. Implement --help, named parameters, and a repeatable --item with a compound value: fields of the described data set are separated by semicolons, and the delimiter is prohibited in text. With no arguments, prompt for the same data from the keyboard. Write diagnostics to stderr; exit code 0 means success, 2 an input error, and 1 an unexpected runtime error. Print an aligned results table and final counts; add at least five checks: normal, boundary, invalid format, an invariant violation, and rejection without a state change.
Variant 17. Matrix operations
1. Initial level. Create a Java console program: enter a 1..10 by 1..10 matrix of integers −100..100; transpose returns a new matrix; print it and the row sums. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input.
2. Basic level. Create a Java console program: enter a 1..10 by 1..10 matrix of integers −100..100; transpose returns a new matrix; print it and the row sums. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter a 1..10 by 1..10 matrix of integers −100..100; transpose returns a new matrix; print it and the row sums. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets. Add: the product of two compatible matrices and saddle points that are minima in their rows and maxima in their columns. Implement --help, named parameters, and a repeatable --item with a compound value: fields of the described data set are separated by semicolons, and the delimiter is prohibited in text. With no arguments, prompt for the same data from the keyboard. Write diagnostics to stderr; exit code 0 means success, 2 an input error, and 1 an unexpected runtime error. Print an aligned results table and final counts; add at least five checks: normal, boundary, invalid format, an invariant violation, and rejection without a state change.
Variant 18. Word search in a grid
1. Initial level. Create a Java console program: enter a 1..20 by 1..20 grid of A..Z and a word of length 1..20; a method searches for straight matches in eight directions without wrapping; print starting coordinates and direction or none. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input.
2. Basic level. Create a Java console program: enter a 1..20 by 1..20 grid of A..Z and a word of length 1..20; a method searches for straight matches in eight directions without wrapping; print starting coordinates and direction or none. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter a 1..20 by 1..20 grid of A..Z and a word of length 1..20; a method searches for straight matches in eight directions without wrapping; print starting coordinates and direction or none. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets. Add: all matches and their count; for a one-letter word, count each cell once. Implement --help, named parameters, and a repeatable --item with a compound value: fields of the described data set are separated by semicolons, and the delimiter is prohibited in text. With no arguments, prompt for the same data from the keyboard. Write diagnostics to stderr; exit code 0 means success, 2 an input error, and 1 an unexpected runtime error. Print an aligned results table and final counts; add at least five checks: normal, boundary, invalid format, an invariant violation, and rejection without a state change.
Variant 19. RLE compression
1. Initial level. Create a Java console program: enter a nonempty A..Z string of up to 200 characters; encode each run as a letter and decimal length, such as AAABB→A3B2; print the code and decoded result. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input.
2. Basic level. Create a Java console program: enter a nonempty A..Z string of up to 200 characters; encode each run as a letter and decimal length, such as AAABB→A3B2; print the code and decoded result. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter a nonempty A..Z string of up to 200 characters; encode each run as a letter and decimal length, such as AAABB→A3B2; print the code and decoded result. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets. Add: validation of code format, lengths 1..200, and a total decompressed length of up to 200. Implement --help, named parameters, and a repeatable --item with a compound value: fields of the described data set are separated by semicolons, and the delimiter is prohibited in text. With no arguments, prompt for the same data from the keyboard. Write diagnostics to stderr; exit code 0 means success, 2 an input error, and 1 an unexpected runtime error. Print an aligned results table and final counts; add at least five checks: normal, boundary, invalid format, an invariant violation, and rejection without a state change.
Variant 20. Maze
1. Initial level. Create a Java console program: enter a board up to 10 by 10 with 0 for a passage and 1 for a wall, plus start and finish; a recursive search in four directions marks visited cells; print any path or none. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input.
2. Basic level. Create a Java console program: enter a board up to 10 by 10 with 0 for a passage and 1 for a wall, plus start and finish; a recursive search in four directions marks visited cells; print any path or none. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter a board up to 10 by 10 with 0 for a passage and 1 for a wall, plus start and finish; a recursive search in four directions marks visited cells; print any path or none. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets. Add: a route display using distinct characters and protection against revisiting. Implement --help, named parameters, and a repeatable --item with a compound value: fields of the described data set are separated by semicolons, and the delimiter is prohibited in text. With no arguments, prompt for the same data from the keyboard. Write diagnostics to stderr; exit code 0 means success, 2 an input error, and 1 an unexpected runtime error. Print an aligned results table and final counts; add at least five checks: normal, boundary, invalid format, an invariant violation, and rejection without a state change.
Variant 21. Educational vehicle plates
1. Initial level. Create a Java console program: enter a string of two letters, four digits, and two letters without spaces; the permitted set is ABCEHIKMOPTX, and regex validates only format, not registration; print the groups or a rejection. Provide a UML class diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input.
2. Basic level. Create a Java console program: enter a string of two letters, four digits, and two letters without spaces; the permitted set is ABCEHIKMOPTX, and regex validates only format, not registration; print the groups or a rejection. Provide a UML class diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter a string of two letters, four digits, and two letters without spaces; the permitted set is ABCEHIKMOPTX, and regex validates only format, not registration; print the groups or a rejection. Provide a UML class diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets. Add: normalization of surrounding whitespace and case, and statistics for synthetic plate numbers. Implement --help, named parameters, and a repeatable --item with a compound value: fields of the described data set are separated by semicolons, and the delimiter is prohibited in text. With no arguments, prompt for the same data from the keyboard. Write diagnostics to stderr; exit code 0 means success, 2 an input error, and 1 an unexpected runtime error. Print an aligned results table and final counts; add at least five checks: normal, boundary, invalid format, an invariant violation, and rejection without a state change.
Variant 22. Telephone directory
1. Initial level. Create a Java console program: enter up to 20 surnames in Latin letters and strings of 10 digits; sort parallel arrays by surname and search with binary search; print the phone number or none; duplicate surnames are prohibited. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input.
2. Basic level. Create a Java console program: enter up to 20 surnames in Latin letters and strings of 10 digits; sort parallel arrays by surname and search with binary search; print the phone number or none; duplicate surnames are prohibited. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter up to 20 surnames in Latin letters and strings of 10 digits; sort parallel arrays by surname and search with binary search; print the phone number or none; duplicate surnames are prohibited. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets. Add: record insertion that preserves order and independent array copies. Implement --help, named parameters, and a repeatable --item with a compound value: fields of the described data set are separated by semicolons, and the delimiter is prohibited in text. With no arguments, prompt for the same data from the keyboard. Write diagnostics to stderr; exit code 0 means success, 2 an input error, and 1 an unexpected runtime error. Print an aligned results table and final counts; add at least five checks: normal, boundary, invalid format, an invariant violation, and rejection without a state change.
Variant 23. Movie theater seating
1. Initial level. Create a Java console program: enter dimensions 1..20, a 0/1 matrix, and the coordinate of a free seat; a method books only a 0; print the map and free-seat count. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input.
2. Basic level. Create a Java console program: enter dimensions 1..20, a 0/1 matrix, and the coordinate of a free seat; a method books only a 0; print the map and free-seat count. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter dimensions 1..20, a 0/1 matrix, and the coordinate of a free seat; a method books only a 0; print the map and free-seat count. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets. Add: a search for the first block of k=1..number of columns adjacent free seats in one row, with no change when absent. Implement --help, named parameters, and a repeatable --item with a compound value: fields of the described data set are separated by semicolons, and the delimiter is prohibited in text. With no arguments, prompt for the same data from the keyboard. Write diagnostics to stderr; exit code 0 means success, 2 an input error, and 1 an unexpected runtime error. Print an aligned results table and final counts; add at least five checks: normal, boundary, invalid format, an invariant violation, and rejection without a state change.
Variant 24. Tic-tac-toe
1. Initial level. Create a Java console program: enter nine characters X, O, or period; a method checks three rows, three columns, and two diagonals and prints X/O/draw/continue; reject simultaneous wins by both players. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input.
2. Basic level. Create a Java console program: enter nine characters X, O, or period; a method checks three rows, three columns, and two diagonals and prints X/O/draw/continue; reject simultaneous wins by both players. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter nine characters X, O, or period; a method checks three rows, three columns, and two diagonals and prints X/O/draw/continue; reject simultaneous wins by both players. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets. Add: a sequential game in which the computer places O in the first free cell after checking for a winner. Implement --help, named parameters, and a repeatable --item with a compound value: fields of the described data set are separated by semicolons, and the delimiter is prohibited in text. With no arguments, prompt for the same data from the keyboard. Write diagnostics to stderr; exit code 0 means success, 2 an input error, and 1 an unexpected runtime error. Print an aligned results table and final counts; add at least five checks: normal, boundary, invalid format, an invariant violation, and rejection without a state change.
Variant 25. Polynomials
1. Initial level. Create a Java console program: enter coefficients of powers 0..n, n 0..10, and x within −10..10; Horner's method computes the value using Math.addExact/multiplyExact; print the result. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input.
2. Basic level. Create a Java console program: enter coefficients of powers 0..n, n 0..10, and x within −10..10; Horner's method computes the value using Math.addExact/multiplyExact; print the result. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter coefficients of powers 0..n, n 0..10, and x within −10..10; Horner's method computes the value using Math.addExact/multiplyExact; print the result. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets. Add: the sum and product of coefficient arrays and the derivative; represent the zero polynomial with one zero. Implement --help, named parameters, and a repeatable --item with a compound value: fields of the described data set are separated by semicolons, and the delimiter is prohibited in text. With no arguments, prompt for the same data from the keyboard. Write diagnostics to stderr; exit code 0 means success, 2 an input error, and 1 an unexpected runtime error. Print an aligned results table and final counts; add at least five checks: normal, boundary, invalid format, an invariant violation, and rejection without a state change.
Variant 26. HTML generator
1. Initial level. Create a Java console program: enter up to 20 names and scores 0..100; StringBuilder creates table rows, a text block provides the wrapper, and ampersands and angle brackets in names are escaped; print HTML. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input.
2. Basic level. Create a Java console program: enter up to 20 names and scores 0..100; StringBuilder creates table rows, a text block provides the wrapper, and ampersands and angle brackets in names are escaped; print HTML. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter up to 20 names and scores 0..100; StringBuilder creates table rows, a text block provides the wrapper, and ampersands and angle brackets in names are escaped; print HTML. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets. Add: a number column, average score, and an empty-set check that avoids division by zero. Implement --help, named parameters, and a repeatable --item with a compound value: fields of the described data set are separated by semicolons, and the delimiter is prohibited in text. With no arguments, prompt for the same data from the keyboard. Write diagnostics to stderr; exit code 0 means success, 2 an input error, and 1 an unexpected runtime error. Print an aligned results table and final counts; add at least five checks: normal, boundary, invalid format, an invariant violation, and rejection without a state change.
Variant 27. Dates in text
1. Initial level. Create a Java console program: enter text of up to 1000 characters; Pattern/Matcher finds dd.mm.yyyy fragments; check day 1..31, month 1..12, and year 2000..2100; print yyyy-mm-dd candidates, noting that this is not yet full calendar validation. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input.
2. Basic level. Create a Java console program: enter text of up to 1000 characters; Pattern/Matcher finds dd.mm.yyyy fragments; check day 1..31, month 1..12, and year 2000..2100; print yyyy-mm-dd candidates, noting that this is not yet full calendar validation. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter text of up to 1000 characters; Pattern/Matcher finds dd.mm.yyyy fragments; check day 1..31, month 1..12, and year 2000..2100; print yyyy-mm-dd candidates, noting that this is not yet full calendar validation. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets. Add: the number of days in the month and leap-year checking: divisible by 4, except multiples of 100 that are not multiples of 400. Implement --help, named parameters, and a repeatable --item with a compound value: fields of the described data set are separated by semicolons, and the delimiter is prohibited in text. With no arguments, prompt for the same data from the keyboard. Write diagnostics to stderr; exit code 0 means success, 2 an input error, and 1 an unexpected runtime error. Print an aligned results table and final counts; add at least five checks: normal, boundary, invalid format, an invariant violation, and rejection without a state change.
Variant 28. Monthly steps
1. Initial level. Create a Java console program: enter 28..31 integer counts 0..100000; methods return a long sum and the first day with the maximum; print the results. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input.
2. Basic level. Create a Java console program: enter 28..31 integer counts 0..100000; methods return a long sum and the first day with the maximum; print the results. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter 28..31 integer counts 0..100000; methods return a long sum and the first day with the maximum; print the results. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets. Add: sums of consecutive 7-day blocks, allowing a shorter final block, and the longest run of days with at least 10000 steps. Implement --help, named parameters, and a repeatable --item with a compound value: fields of the described data set are separated by semicolons, and the delimiter is prohibited in text. With no arguments, prompt for the same data from the keyboard. Write diagnostics to stderr; exit code 0 means success, 2 an input error, and 1 an unexpected runtime error. Print an aligned results table and final counts; add at least five checks: normal, boundary, invalid format, an invariant violation, and rejection without a state change.
Variant 29. Eight queens
1. Initial level. Create a Java console program: enter n=1..8; recursively place one queen per row with no shared column or diagonal; print the first solution or none. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input.
2. Basic level. Create a Java console program: enter n=1..8; recursively place one queen per row with no shared column or diagonal; print the first solution or none. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter n=1..8; recursively place one queen per row with no shared column or diagonal; print the first solution or none. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets. Add: all solutions and their count without identifying symmetric solutions as equivalent; verify 92 for n 8. Implement --help, named parameters, and a repeatable --item with a compound value: fields of the described data set are separated by semicolons, and the delimiter is prohibited in text. With no arguments, prompt for the same data from the keyboard. Write diagnostics to stderr; exit code 0 means success, 2 an input error, and 1 an unexpected runtime error. Print an aligned results table and final counts; add at least five checks: normal, boundary, invalid format, an invariant violation, and rejection without a state change.
Variant 30. Morse code
1. Initial level. Create a Java console program: enter ASCII letters A..Z and spaces; two parallel arrays define international codes for the 26 letters; separate letters with a space and words with a slash; print the code. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input.
2. Basic level. Create a Java console program: enter ASCII letters A..Z and spaces; two parallel arrays define international codes for the 26 letters; separate letters with a space and words with a slash; print the code. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter ASCII letters A..Z and spaces; two parallel arrays define international codes for the 26 letters; separate letters with a space and words with a slash; print the code. Provide a method call diagram; separate static methods with parameters and results, document preconditions, and do not mix calculations with console input. Process an array of 1 to 20 data sets from the keyboard, validating every field before changing state; print one result row per set and the counts of accepted and rejected sets. Add: decoding that rejects unknown codes and a round-trip check of normalized text. Implement --help, named parameters, and a repeatable --item with a compound value: fields of the described data set are separated by semicolons, and the delimiter is prohibited in text. With no arguments, prompt for the same data from the keyboard. Write diagnostics to stderr; exit code 0 means success, 2 an input error, and 1 an unexpected runtime error. Print an aligned results table and final counts; add at least five checks: normal, boundary, invalid format, an invariant violation, and rejection without a state change.
Procedure
- Define the input format, bounds, and empty cases.
- Write method signatures and their contracts.
- Separate input, validation, computation, and printing.
- Check indices and independence of array copies.
- For text, specify the alphabet and Unicode processing level.
- Provide normal, boundary, and invalid inputs.
- For the advanced level, demonstrate help and exit codes.
- When presenting your work, explain parameters and the recursion stack.