English
Tasks
Complete the task of the chosen difficulty level for your variant number.
For all levels, submit a UML class diagram showing field visibility, constructors, and methods. The model does not read the console; the interface converts strings and handles failures.
Variants
Variant 1. Bank card
1. Initial level. Create a Java console program: enter a 16-digit number, a balance in 0..1000000 kopiykas, and a withdrawal amount; the Card class hides the balance, withdraws only a positive available amount, and shows the masked number and new balance. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString().
2. Basic level. Create a Java console program: enter a 16-digit number, a balance in 0..1000000 kopiykas, and a withdrawal amount; the Card class hides the balance, withdraws only a positive available amount, and shows the masked number and new balance. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter a 16-digit number, a balance in 0..1000000 kopiykas, and a withdrawal amount; the Card class hides the balance, withdraws only a positive available amount, and shows the masked number and new balance. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets. Add: deposits and a history of up to 20 operations. Implement --help, named parameters, and a repeated --item with a composite value: fields of the described 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 means an input error, and 1 means an unexpected runtime error. Print an aligned results table and summary counts; add at least five checks: normal, boundary, invalid format, invariant violation, and failure without changing state.
Variant 2. Library catalog
1. Initial level. Create a Java console program: enter a nonempty book title, a year in 1450..2100, and a copy count in 0..1000; the Book class lends one copy only when available; print the title and remaining count. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString().
2. Basic level. Create a Java console program: enter a nonempty book title, a year in 1450..2100, and a copy count in 0..1000; the Book class lends one copy only when available; print the title and remaining count. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter a nonempty book title, a year in 1450..2100, and a copy count in 0..1000; the Book class lends one copy only when available; print the title and remaining count. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets. Add: returns and a static counter of created books. Implement --help, named parameters, and a repeated --item with a composite value: fields of the described 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 means an input error, and 1 means an unexpected runtime error. Print an aligned results table and summary counts; add at least five checks: normal, boundary, invalid format, invariant violation, and failure without changing state.
Variant 3. Student group
1. Initial level. Create a Java console program: enter a student's name and three scores in 0..100; the Student class stores a copy of the array and calculates the mean; print the name, mean, and minimum score. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString().
2. Basic level. Create a Java console program: enter a student's name and three scores in 0..100; the Student class stores a copy of the array and calculates the mean; print the name, mean, and minimum score. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter a student's name and three scores in 0..100; the Student class stores a copy of the array and calculates the mean; print the name, mean, and minimum score. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets. Add: a Group class with a copy of the student array and the group mean. Implement --help, named parameters, and a repeated --item with a composite value: fields of the described 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 means an input error, and 1 means an unexpected runtime error. Print an aligned results table and summary counts; add at least five checks: normal, boundary, invalid format, invariant violation, and failure without changing state.
Variant 4. Thermostat
1. Initial level. Create a Java console program: enter current and target temperatures in −30..50 degrees; the Thermostat class with a validated setter shows heating mode if the current temperature is below the target. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString().
2. Basic level. Create a Java console program: enter current and target temperatures in −30..50 degrees; the Thermostat class with a validated setter shows heating mode if the current temperature is below the target. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter current and target temperatures in −30..50 degrees; the Thermostat class with a validated setter shows heating mode if the current temperature is below the target. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets. Add: off and heat modes and a target change log. Implement --help, named parameters, and a repeated --item with a composite value: fields of the described 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 means an input error, and 1 means an unexpected runtime error. Print an aligned results table and summary counts; add at least five checks: normal, boundary, invalid format, invariant violation, and failure without changing state.
Variant 5. Smartphone
1. Initial level. Create a Java console program: enter a model, charge in 0..100, and consumption in 0..100 percentage points; the Phone class consumes charge only if enough remains; print the model and charge. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString().
2. Basic level. Create a Java console program: enter a model, charge in 0..100, and consumption in 0..100 percentage points; the Phone class consumes charge only if enough remains; print the model and charge. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter a model, charge in 0..100, and consumption in 0..100 percentage points; the Phone class consumes charge only if enough remains; print the model and charge. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets. Add: a charging method that does not exceed 100. Implement --help, named parameters, and a repeated --item with a composite value: fields of the described 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 means an input error, and 1 means an unexpected runtime error. Print an aligned results table and summary counts; add at least five checks: normal, boundary, invalid format, invariant violation, and failure without changing state.
Variant 6. Rational number
1. Initial level. Create a Java console program: enter a numerator in −10000..10000 and a nonzero denominator in the same bounds; the Fraction class reduces the fraction using the GCD and moves the sign to the numerator; print the normalized form. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString().
2. Basic level. Create a Java console program: enter a numerator in −10000..10000 and a nonzero denominator in the same bounds; the Fraction class reduces the fraction using the GCD and moves the sign to the numerator; print the normalized form. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter a numerator in −10000..10000 and a nonzero denominator in the same bounds; the Fraction class reduces the fraction using the GCD and moves the sign to the numerator; print the normalized form. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets. Add: addition of two fractions with intermediate long calculations. Implement --help, named parameters, and a repeated --item with a composite value: fields of the described 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 means an input error, and 1 means an unexpected runtime error. Print an aligned results table and summary counts; add at least five checks: normal, boundary, invalid format, invariant violation, and failure without changing state.
Variant 7. Complex number
1. Initial level. Create a Java console program: enter real and imaginary parts in −1000..1000; immutable Complex returns the modulus through Math.hypot and the conjugate; print both results. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString().
2. Basic level. Create a Java console program: enter real and imaginary parts in −1000..1000; immutable Complex returns the modulus through Math.hypot and the conjugate; print both results. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter real and imaginary parts in −1000..1000; immutable Complex returns the modulus through Math.hypot and the conjugate; print both results. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets. Add: addition and multiplication of two numbers. Implement --help, named parameters, and a repeated --item with a composite value: fields of the described 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 means an input error, and 1 means an unexpected runtime error. Print an aligned results table and summary counts; add at least five checks: normal, boundary, invalid format, invariant violation, and failure without changing state.
Variant 8. Time of day
1. Initial level. Create a Java console program: enter hours in 0..23, minutes in 0..59, and a shift in −10000..10000 minutes; TimeOfDay stores minutes since the start of the day and applies Math.floorMod with 1440; print the time after the shift. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString().
2. Basic level. Create a Java console program: enter hours in 0..23, minutes in 0..59, and a shift in −10000..10000 minutes; TimeOfDay stores minutes since the start of the day and applies Math.floorMod with 1440; print the time after the shift. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter hours in 0..23, minutes in 0..59, and a shift in −10000..10000 minutes; TimeOfDay stores minutes since the start of the day and applies Math.floorMod with 1440; print the time after the shift. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets. Add: the forward difference between two times within one day. Implement --help, named parameters, and a repeated --item with a composite value: fields of the described 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 means an input error, and 1 means an unexpected runtime error. Print an aligned results table and summary counts; add at least five checks: normal, boundary, invalid format, invariant violation, and failure without changing state.
Variant 9. Shopping cart
1. Initial level. Create a Java console program: enter a name, price in 0..100000 kopiykas, and quantity in 1..100; CartItem calculates the cost as long; print the name and cost. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString().
2. Basic level. Create a Java console program: enter a name, price in 0..100000 kopiykas, and quantity in 1..100; CartItem calculates the cost as long; print the name and cost. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter a name, price in 0..100000 kopiykas, and quantity in 1..100; CartItem calculates the cost as long; print the name and cost. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets. Add: a cart of up to 20 items with a total amount. Implement --help, named parameters, and a repeated --item with a composite value: fields of the described 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 means an input error, and 1 means an unexpected runtime error. Print an aligned results table and summary counts; add at least five checks: normal, boundary, invalid format, invariant violation, and failure without changing state.
Variant 10. Parking
1. Initial level. Create a Java console program: enter a capacity in 1..1000, occupied spaces in 0..capacity, and a number of arriving cars; Parking accepts cars only if all required spaces are available; print the free spaces. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString().
2. Basic level. Create a Java console program: enter a capacity in 1..1000, occupied spaces in 0..capacity, and a number of arriving cars; Parking accepts cars only if all required spaces are available; print the free spaces. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter a capacity in 1..1000, occupied spaces in 0..capacity, and a number of arriving cars; Parking accepts cars only if all required spaces are available; print the free spaces. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets. Add: car departures and a static counter of successful entries. Implement --help, named parameters, and a repeated --item with a composite value: fields of the described 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 means an input error, and 1 means an unexpected runtime error. Print an aligned results table and summary counts; add at least five checks: normal, boundary, invalid format, invariant violation, and failure without changing state.
Variant 11. Stopwatch
1. Initial level. Create a Java console program: enter accumulated seconds in 0..86400 and an increment in 0..86400; Stopwatch adds the increment with an upper bound of 172800; print hours, minutes, and seconds. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString().
2. Basic level. Create a Java console program: enter accumulated seconds in 0..86400 and an increment in 0..86400; Stopwatch adds the increment with an upper bound of 172800; print hours, minutes, and seconds. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter accumulated seconds in 0..86400 and an increment in 0..86400; Stopwatch adds the increment with an upper bound of 172800; print hours, minutes, and seconds. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets. Add: resetting and independent results from two instances. Implement --help, named parameters, and a repeated --item with a composite value: fields of the described 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 means an input error, and 1 means an unexpected runtime error. Print an aligned results table and summary counts; add at least five checks: normal, boundary, invalid format, invariant violation, and failure without changing state.
Variant 12. Vector in space
1. Initial level. Create a Java console program: enter three coordinates in −1000..1000; immutable Vector3 returns the length and a vector with opposite coordinates; print the results. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString().
2. Basic level. Create a Java console program: enter three coordinates in −1000..1000; immutable Vector3 returns the length and a vector with opposite coordinates; print the results. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter three coordinates in −1000..1000; immutable Vector3 returns the length and a vector with opposite coordinates; print the results. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets. Add: the dot product of two vectors. Implement --help, named parameters, and a repeated --item with a composite value: fields of the described 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 means an input error, and 1 means an unexpected runtime error. Print an aligned results table and summary counts; add at least five checks: normal, boundary, invalid format, invariant violation, and failure without changing state.
Variant 13. Metro card
1. Initial level. Create a Java console program: enter an identifier and a ride count in 0..100; MetroCard deducts one ride if available; print the remaining count. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString().
2. Basic level. Create a Java console program: enter an identifier and a ride count in 0..100; MetroCard deducts one ride if available; print the remaining count. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter an identifier and a ride count in 0..100; MetroCard deducts one ride if available; print the remaining count. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets. Add: recharging up to 100 and a passage counter. Implement --help, named parameters, and a repeated --item with a composite value: fields of the described 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 means an input error, and 1 means an unexpected runtime error. Print an aligned results table and summary counts; add at least five checks: normal, boundary, invalid format, invariant violation, and failure without changing state.
Variant 14. Poll
1. Initial level. Create a Java console program: enter a question, yes and no answer counts in 0..10000, and a new answer; Poll increments the appropriate counter; print the counts and the proportion of yes answers, or 0 for a zero total. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString().
2. Basic level. Create a Java console program: enter a question, yes and no answer counts in 0..10000, and a new answer; Poll increments the appropriate counter; print the counts and the proportion of yes answers, or 0 for a zero total. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter a question, yes and no answer counts in 0..10000, and a new answer; Poll increments the appropriate counter; print the counts and the proportion of yes answers, or 0 for a zero total. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets. Add: an immutable snapshot of the results before and after voting. Implement --help, named parameters, and a repeated --item with a composite value: fields of the described 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 means an input error, and 1 means an unexpected runtime error. Print an aligned results table and summary counts; add at least five checks: normal, boundary, invalid format, invariant violation, and failure without changing state.
Variant 15. Hotel room
1. Initial level. Create a Java console program: enter a room number, capacity in 1..6, and guest count in 0..capacity; Room checks in additional guests without exceeding capacity; print the free spaces. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString().
2. Basic level. Create a Java console program: enter a room number, capacity in 1..6, guest count in 0..capacity, and new guest count in 1..6; Room checks in new guests only without exceeding capacity; print the free spaces. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter a room number, capacity in 1..6, and guest count in 0..capacity; Room checks in additional guests without exceeding capacity; print the free spaces. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets. Add: checking out and a hotel with an array of rooms. Implement --help, named parameters, and a repeated --item with a composite value: fields of the described 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 means an input error, and 1 means an unexpected runtime error. Print an aligned results table and summary counts; add at least five checks: normal, boundary, invalid format, invariant violation, and failure without changing state.
Variant 16. Playlist
1. Initial level. Create a Java console program: enter a track title and duration in 1..7200 seconds; Track has private final fields and a minutes:seconds format; print the track. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString().
2. Basic level. Create a Java console program: enter a track title and duration in 1..7200 seconds; Track has private final fields and a minutes:seconds format; print the track. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter a track title and duration in 1..7200 seconds; Track has private final fields and a minutes:seconds format; print the track. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets. Add: a Playlist with a defensive array copy and total duration. Implement --help, named parameters, and a repeated --item with a composite value: fields of the described 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 means an input error, and 1 means an unexpected runtime error. Print an aligned results table and summary counts; add at least five checks: normal, boundary, invalid format, invariant violation, and failure without changing state.
Variant 17. Polynomial
1. Initial level. Create a Java console program: enter coefficients a, b, c and x in −100..100; Polynomial stores the coefficients immutably and calculates (a * x + b) * x + c; print the value. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString().
2. Basic level. Create a Java console program: enter coefficients a, b, c and x in −100..100; Polynomial stores the coefficients immutably and calculates (a * x + b) * x + c; print the value. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter coefficients a, b, c and x in −100..100; Polynomial stores the coefficients immutably and calculates (a * x + b) * x + c; print the value. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets. Add: a new derivative polynomial and its value. Implement --help, named parameters, and a repeated --item with a composite value: fields of the described 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 means an input error, and 1 means an unexpected runtime error. Print an aligned results table and summary counts; add at least five checks: normal, boundary, invalid format, invariant violation, and failure without changing state.
Variant 18. Water meter
1. Initial level. Create a Java console program: enter previous and current integer readings in 0..1000000; WaterMeter prohibits decreases and prints consumption as the difference. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString().
2. Basic level. Create a Java console program: enter previous and current integer readings in 0..1000000; WaterMeter prohibits decreases and prints consumption as the difference. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter previous and current integer readings in 0..1000000; WaterMeter prohibits decreases and prints consumption as the difference. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets. Add: a sample rate in kopiykas per unit and a long amount. Implement --help, named parameters, and a repeated --item with a composite value: fields of the described 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 means an input error, and 1 means an unexpected runtime error. Print an aligned results table and summary counts; add at least five checks: normal, boundary, invalid format, invariant violation, and failure without changing state.
Variant 19. Athlete
1. Initial level. Create a Java console program: enter a name and three time results in 1..10000 seconds; Athlete copies the array and finds the best, meaning the minimum time; print the result. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString().
2. Basic level. Create a Java console program: enter a name and three time results in 1..10000 seconds; Athlete copies the array and finds the best, meaning the minimum time; print the result. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter a name and three time results in 1..10000 seconds; Athlete copies the array and finds the best, meaning the minimum time; print the result. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets. Add: adding a training session with a limit of 20 results. Implement --help, named parameters, and a repeated --item with a composite value: fields of the described 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 means an input error, and 1 means an unexpected runtime error. Print an aligned results table and summary counts; add at least five checks: normal, boundary, invalid format, invariant violation, and failure without changing state.
Variant 20. Rectangles
1. Initial level. Create a Java console program: enter positive finite width and height up to 10000; Rectangle has rectangle and square constructors; print the area and perimeter. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString().
2. Basic level. Create a Java console program: enter positive finite width and height up to 10000; Rectangle has rectangle and square constructors; print the area and perimeter. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter positive finite width and height up to 10000; Rectangle has rectangle and square constructors; print the area and perimeter. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets. Add: immutable scaling by a factor in 0.1..10 with bounds checking. Implement --help, named parameters, and a repeated --item with a composite value: fields of the described 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 means an input error, and 1 means an unexpected runtime error. Print an aligned results table and summary counts; add at least five checks: normal, boundary, invalid format, invariant violation, and failure without changing state.
Variant 21. Recipe
1. Initial level. Create a Java console program: enter a name, a serving count in 1..100, and an ingredient mass in 1..10000 g; Recipe calculates the mass for a given serving count in 1..100; print the result. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString().
2. Basic level. Create a Java console program: enter a name, a serving count in 1..100, and an ingredient mass in 1..10000 g; Recipe calculates the mass for a given serving count in 1..100; print the result. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter a name, a serving count in 1..100, and an ingredient mass in 1..10000 g; Recipe calculates the mass for a given serving count in 1..100; print the result. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets. Add: an array of named ingredients with a defensive copy. Implement --help, named parameters, and a repeated --item with a composite value: fields of the described 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 means an input error, and 1 means an unexpected runtime error. Print an aligned results table and summary counts; add at least five checks: normal, boundary, invalid format, invariant violation, and failure without changing state.
Variant 22. Car
1. Initial level. Create a Java console program: enter a tank capacity in 1..100 L, remaining fuel, consumption in 1..30 L/100 km, and a distance in 0..1000 km; Car performs the trip only with sufficient fuel; print the remaining fuel and distance traveled. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString().
2. Basic level. Create a Java console program: enter a tank capacity in 1..100 L, remaining fuel, consumption in 1..30 L/100 km, and a distance in 0..1000 km; Car performs the trip only with sufficient fuel; print the remaining fuel and distance traveled. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter a tank capacity in 1..100 L, remaining fuel, consumption in 1..30 L/100 km, and a distance in 0..1000 km; Car performs the trip only with sufficient fuel; print the remaining fuel and distance traveled. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets. Add: refueling without overflowing the tank. Implement --help, named parameters, and a repeated --item with a composite value: fields of the described 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 means an input error, and 1 means an unexpected runtime error. Print an aligned results table and summary counts; add at least five checks: normal, boundary, invalid format, invariant violation, and failure without changing state.
Variant 23. Training courses
1. Initial level. Create a Java console program: enter a name, capacity in 1..100, and participant count in 0..capacity; Course enrolls one participant or rejects the operation; print the free places. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString().
2. Basic level. Create a Java console program: enter a name, capacity in 1..100, and participant count in 0..capacity; Course enrolls one participant or rejects the operation; print the free places. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter a name, capacity in 1..100, and participant count in 0..capacity; Course enrolls one participant or rejects the operation; print the free places. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets. Add: canceling enrollment and statistics on created courses. Implement --help, named parameters, and a repeated --item with a composite value: fields of the described 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 means an input error, and 1 means an unexpected runtime error. Print an aligned results table and summary counts; add at least five checks: normal, boundary, invalid format, invariant violation, and failure without changing state.
Variant 24. Pizza
1. Initial level. Create a Java console program: enter a name, diameter in 10..60 cm, and price in 1..100000 kopiykas; Pizza calculates the area and price per square centimeter; print both results. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString().
2. Basic level. Create a Java console program: enter a name, diameter in 10..60 cm, and price in 1..100000 kopiykas; Pizza calculates the area and price per square centimeter; print both results. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter a name, diameter in 10..60 cm, and price in 1..100000 kopiykas; Pizza calculates the area and price per square centimeter; print both results. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets. Add: comparison of two sizes by unit price. Implement --help, named parameters, and a repeated --item with a composite value: fields of the described 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 means an input error, and 1 means an unexpected runtime error. Print an aligned results table and summary counts; add at least five checks: normal, boundary, invalid format, invariant violation, and failure without changing state.
Variant 25. Matrix
1. Initial level. Create a Java console program: enter four integer elements in −1000..1000 for a 2 by 2 matrix; Matrix2 stores them privately and returns the determinant and a new transposed matrix; print the results. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString().
2. Basic level. Create a Java console program: enter four integer elements in −1000..1000 for a 2 by 2 matrix; Matrix2 stores them privately and returns the determinant and a new transposed matrix; print the results. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter four integer elements in −1000..1000 for a 2 by 2 matrix; Matrix2 stores them privately and returns the determinant and a new transposed matrix; print the results. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets. Add: addition and multiplication of two matrices using long. Implement --help, named parameters, and a repeated --item with a composite value: fields of the described 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 means an input error, and 1 means an unexpected runtime error. Print an aligned results table and summary counts; add at least five checks: normal, boundary, invalid format, invariant violation, and failure without changing state.
Variant 26. Habit tracker
1. Initial level. Create a Java console program: enter a habit name and seven values of 0 or 1 for the days of the week; Habit copies the array and returns the number and proportion of completed days; print the results. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString().
2. Basic level. Create a Java console program: enter a habit name and seven values of 0 or 1 for the days of the week; Habit copies the array and returns the number and proportion of completed days; print the results. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter a habit name and seven values of 0 or 1 for the days of the week; Habit copies the array and returns the number and proportion of completed days; print the results. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets. Add: the longest sequence of completed days. Implement --help, named parameters, and a repeated --item with a composite value: fields of the described 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 means an input error, and 1 means an unexpected runtime error. Print an aligned results table and summary counts; add at least five checks: normal, boundary, invalid format, invariant violation, and failure without changing state.
Variant 27. Elevator
1. Initial level. Create a Java console program: enter a floor count in 2..100 and current and target floors in 1..floor count; Elevator changes the floor through moveTo; print the direction and number of floors traveled. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString().
2. Basic level. Create a Java console program: enter a floor count in 2..100 and current and target floors in 1..floor count; Elevator changes the floor through moveTo; print the direction and number of floors traveled. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter a floor count in 2..100 and current and target floors in 1..floor count; Elevator changes the floor through moveTo; print the direction and number of floors traveled. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets. Add: a log of up to 20 calls and total travel. Implement --help, named parameters, and a repeated --item with a composite value: fields of the described 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 means an input error, and 1 means an unexpected runtime error. Print an aligned results table and summary counts; add at least five checks: normal, boundary, invalid format, invariant violation, and failure without changing state.
Variant 28. Monetary amount
1. Initial level. Create a Java console program: enter nonnegative hryvnias up to 1000000 and kopiykas in 0..99; immutable Money stores total kopiykas as long; print the amount with two decimal places. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString().
2. Basic level. Create a Java console program: enter nonnegative hryvnias up to 1000000 and kopiykas in 0..99; immutable Money stores total kopiykas as long; print the amount with two decimal places. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter nonnegative hryvnias up to 1000000 and kopiykas in 0..99; immutable Money stores total kopiykas as long; print the amount with two decimal places. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets. Add: addition and subtraction without a negative result. Implement --help, named parameters, and a repeated --item with a composite value: fields of the described 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 means an input error, and 1 means an unexpected runtime error. Print an aligned results table and summary counts; add at least five checks: normal, boundary, invalid format, invariant violation, and failure without changing state.
Variant 29. Term dictionary
1. Initial level. Create a Java console program: enter a nonempty term and definition; Term normalizes leading and trailing whitespace and hides its fields; print the pair through toString. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString().
2. Basic level. Create a Java console program: enter a nonempty term and definition; Term normalizes leading and trailing whitespace and hides its fields; print the pair through toString. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter a nonempty term and definition; Term normalizes leading and trailing whitespace and hides its fields; print the pair through toString. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets. Add: an array of up to 20 terms and exact case-insensitive search. Implement --help, named parameters, and a repeated --item with a composite value: fields of the described 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 means an input error, and 1 means an unexpected runtime error. Print an aligned results table and summary counts; add at least five checks: normal, boundary, invalid format, invariant violation, and failure without changing state.
Variant 30. Customer queue
1. Initial level. Create a Java console program: enter a capacity in 1..20 and nonempty customer names; Queue with a private array adds at the end and removes from the beginning; print the served name and size. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString().
2. Basic level. Create a Java console program: enter a capacity in 1..20 and nonempty customer names; Queue with a private array adds at the end and removes from the beginning; print the served name and size. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets.
3. Advanced level. Create a Java console program: enter a capacity in 1..20 and nonempty customer names; Queue with a private array adds at the end and removes from the beginning; print the served name and size. Submit a UML class diagram; use private fields, a validated constructor, access methods, and toString(). Process an array of 1 to 20 data sets from the keyboard, validating each field before changing state; print a result row for each set and the counts of accepted and rejected sets. Add: circular indices and a report of overflow and empty queue failures. Implement --help, named parameters, and a repeated --item with a composite value: fields of the described 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 means an input error, and 1 means an unexpected runtime error. Print an aligned results table and summary counts; add at least five checks: normal, boundary, invalid format, invariant violation, and failure without changing state.
Procedure
- List fields, units, bounds, and invariants.
- Draw the UML diagram and define public operations.
- Implement constructors and checks before changing state.
- Test two independent objects, a shared reference, success, a boundary, and failure without partial changes.
- Separate model/app packages and build an executable JAR.
- Submit code, UML, a README, and at least five checks.
- During the presentation, show this, static, and private fields in the debugger.