English
Tasks
Complete the task of the chosen difficulty level for your variant number.
Each solution must include a UML diagram with generalization arrows and member visibility.
Variants
Variant 1. Vehicle rentals
1. Initial level. Create a Java console program: enter type car or bike, days in 1..30, and a rate in 1..100000 kopiykas; Rental and two subclasses calculate the price: car adds 10000 for insurance, while bike adds no surcharge; print the type and amount. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type.
2. Basic level. Create a Java console program: enter type car or bike, days in 1..30, and a rate in 1..100000 kopiykas; Rental and two subclasses calculate the price: car adds 10000 for insurance, while bike adds no surcharge; print the type and amount. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 type car or bike, days in 1..30, and a rate in 1..100000 kopiykas; Rental and two subclasses calculate the price: car adds 10000 for insurance, while bike adds no surcharge; print the type and amount. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 rentals and a search for the most expensive order. 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. Bank accounts
1. Initial level. Create a Java console program: enter type standard or savings and a balance in 0..1000000 kopiykas; Account and SavingsAccount close the period: standard leaves it unchanged, while savings adds one percent, discarding fractional kopiykas; print the balance. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type.
2. Basic level. Create a Java console program: enter type standard or savings and a balance in 0..1000000 kopiykas; Account and SavingsAccount close the period: standard leaves it unchanged, while savings adds one percent, discarding fractional kopiykas; print the balance. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 type standard or savings and a balance in 0..1000000 kopiykas; Account and SavingsAccount close the period: standard leaves it unchanged, while savings adds one percent, discarding fractional kopiykas; print the balance. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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: withdrawals with a protected validation method and rejection when funds are insufficient. 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. Store products
1. Initial level. Create a Java console program: enter a name, price in 0..1000000, and type normal or sale; Product and DiscountProduct return the unchanged price or a 10 percent discount; print the price in kopiykas. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type.
2. Basic level. Create a Java console program: enter a name, price in 0..1000000, and type normal or sale; Product and DiscountProduct return the unchanged price or a 10 percent discount; print the price in kopiykas. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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..1000000, and type normal or sale; Product and DiscountProduct return the unchanged price or a 10 percent discount; print the price in kopiykas. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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: equals and hashCode based on the exact class, name, and original 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 4. Media library
1. Initial level. Create a Java console program: enter type audio or video, a title, and seconds in 1..7200; Media and subclasses provide a description; for video, also enter a height of 480, 720, or 1080; print the polymorphic description. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type.
2. Basic level. Create a Java console program: enter type audio or video, a title, and seconds in 1..7200; Media and subclasses provide a description; for video, also enter a height of 480, 720, or 1080; print the polymorphic description. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 type audio or video, a title, and seconds in 1..7200; Media and subclasses provide a description; for video, also enter a height of 480, 720, or 1080; print the polymorphic description. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 search for the longest item and the sum of durations. 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. Game characters
1. Initial level. Create a Java console program: enter type warrior or mage, a name, and strength in 1..100; Character and subclasses calculate a sample attack as twice or three times the strength; print the attack. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type.
2. Basic level. Create a Java console program: enter type warrior or mage, a name, and strength in 1..100; Character and subclasses calculate a sample attack as twice or three times the strength; print the attack. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 type warrior or mage, a name, and strength in 1..100; Character and subclasses calculate a sample attack as twice or three times the strength; print the attack. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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: safe instanceof for a separate mana recovery operation. 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. Real estate
1. Initial level. Create a Java console program: enter type flat or house, area in 1..1000, and a rate in 1..100000 per square meter; Property and subclasses return area times rate, adding 100000 for house; print the sample price. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type.
2. Basic level. Create a Java console program: enter type flat or house, area in 1..1000, and a rate in 1..100000 per square meter; Property and subclasses return area times rate, adding 100000 for house; print the sample price. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 type flat or house, area in 1..1000, and a rate in 1..100000 per square meter; Property and subclasses return area times rate, adding 100000 for house; print the sample price. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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: price comparison and copy constructors. 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. Tickets
1. Initial level. Create a Java console program: enter type standard or student, a route, and a base price in 1..100000 kopiykas; Ticket and StudentTicket apply a discount of 0 or 50 percent; print the description and price. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type.
2. Basic level. Create a Java console program: enter type standard or student, a route, and a base price in 1..100000 kopiykas; Ticket and StudentTicket apply a discount of 0 or 50 percent; print the description and price. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 type standard or student, a route, and a base price in 1..100000 kopiykas; Ticket and StudentTicket apply a discount of 0 or 50 percent; print the description and price. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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: equality based on the exact class, route, and base 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 8. Phone subscribers
1. Initial level. Create a Java console program: enter type prepaid or contract, a name, and minutes in 0..10000; Subscriber and subclasses calculate a sample bill as minutes times 100, or 5000 plus minutes times 50 kopiykas; print the bill. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type.
2. Basic level. Create a Java console program: enter type prepaid or contract, a name, and minutes in 0..10000; Subscriber and subclasses calculate a sample bill as minutes times 100, or 5000 plus minutes times 50 kopiykas; print the bill. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 type prepaid or contract, a name, and minutes in 0..10000; Subscriber and subclasses calculate a sample bill as minutes times 100, or 5000 plus minutes times 50 kopiykas; print the bill. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 breakdown of the base fee and variable portion. 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. Zoo
1. Initial level. Create a Java console program: enter type cat or bird and a name; Animal and subclasses return meow or chirp through sound; print the name and sound. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type.
2. Basic level. Create a Java console program: enter type cat or bird and a name; Animal and subclasses return meow or chirp through sound; print the name and sound. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 type cat or bird and a name; Animal and subclasses return meow or chirp through sound; print the name and sound. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 additional fly method only on Bird, using safe instanceof. 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. Notifications
1. Initial level. Create a Java console program: enter type sms or email, a nonempty recipient, and text up to 100 characters; Notification and subclasses produce a textual description without actually sending anything; print the channel, recipient, and text. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type.
2. Basic level. Create a Java console program: enter type sms or email, a nonempty recipient, and text up to 100 characters; Notification and subclasses produce a textual description without actually sending anything; print the channel, recipient, and text. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 type sms or email, a nonempty recipient, and text up to 100 characters; Notification and subclasses produce a textual description without actually sending anything; print the channel, recipient, and text. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 SMS price of 100 kopiykas, email price of 0, and the total cost. 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. Insurance policies
1. Initial level. Create a Java console program: enter type basic or extended and coverage in 10000..10000000 kopiykas; Policy and subclasses calculate a sample premium of 1 or 2 percent; print the premium. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type.
2. Basic level. Create a Java console program: enter type basic or extended and coverage in 10000..10000000 kopiykas; Policy and subclasses calculate a sample premium of 1 or 2 percent; print the premium. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 type basic or extended and coverage in 10000..10000000 kopiykas; Policy and subclasses calculate a sample premium of 1 or 2 percent; print the premium. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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: policy equality based on identifier and exact class. 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. Delivery
1. Initial level. Create a Java console program: enter type pickup or courier and a mass in 1..100 kg; Delivery and subclasses return 0 or 5000 plus 100 per kilogram in kopiykas; print the price. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type.
2. Basic level. Create a Java console program: enter type pickup or courier and a mass in 1..100 kg; Delivery and subclasses return 0 or 5000 plus 100 per kilogram in kopiykas; print the price. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 type pickup or courier and a mass in 1..100 kg; Delivery and subclasses return 0 or 5000 plus 100 per kilogram in kopiykas; print the price. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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: sorting results by price using a manual loop. 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. Sensors
1. Initial level. Create a Java console program: enter type temperature or pressure and a finite measurement in −100..200 or 800..1200 respectively; Sensor and subclasses create a description with units; print it. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type.
2. Basic level. Create a Java console program: enter type temperature or pressure and a finite measurement in −100..200 or 800..1200 respectively; Sensor and subclasses create a description with units; print it. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 type temperature or pressure and a finite measurement in −100..200 or 800..1200 respectively; Sensor and subclasses create a description with units; print it. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 normalization method: temperatures to 0..1 using the given bounds, and pressures similarly. 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. Home appliances
1. Initial level. Create a Java console program: enter type heater or lamp, power in 1..3000 W, and hours in 0..24; Appliance and subclasses return Wh, with heater using an operating factor of 0.5; print consumption. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type.
2. Basic level. Create a Java console program: enter type heater or lamp, power in 1..3000 W, and hours in 0..24; Appliance and subclasses return Wh, with heater using an operating factor of 0.5; print consumption. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 type heater or lamp, power in 1..3000 W, and hours in 0..24; Appliance and subclasses return Wh, with heater using an operating factor of 0.5; print consumption. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 rate in kopiykas per kWh and a sample 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 15. University people
1. Initial level. Create a Java console program: enter type student or teacher, a name, and a group number or department; Person and subclasses override describe; print the representation. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type.
2. Basic level. Create a Java console program: enter type student or teacher, a name, and a group number or department; Person and subclasses override describe; print the representation. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 type student or teacher, a name, and a group number or department; Person and subclasses override describe; print the representation. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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: equality based on exact class, identifier, and name. 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. Chess pieces
1. Initial level. Create a Java console program: enter type rook or bishop and starting and ending coordinates in 1..8; Piece and subclasses check move geometry without other pieces: one coordinate unchanged or equal absolute shifts; print true or false, and prohibit a zero move. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type.
2. Basic level. Create a Java console program: enter type rook or bishop and starting and ending coordinates in 1..8; Piece and subclasses check move geometry without other pieces: one coordinate unchanged or equal absolute shifts; print true or false, and prohibit a zero move. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 type rook or bishop and starting and ending coordinates in 1..8; Piece and subclasses check move geometry without other pieces: one coordinate unchanged or equal absolute shifts; print true or false, and prohibit a zero move. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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: counting valid destinations from a given square. 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. Documents
1. Initial level. Create a Java console program: enter type text or invoice, a title, and page count in 1..1000; Document and subclasses return a description, with invoice also having an amount in 0..1000000; print the description. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type.
2. Basic level. Create a Java console program: enter type text or invoice, a title, and page count in 1..1000; Document and subclasses return a description, with invoice also having an amount in 0..1000000; print the description. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 type text or invoice, a title, and page count in 1..1000; Document and subclasses return a description, with invoice also having an amount in 0..1000000; print the description. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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: copy constructors and comparison of copies. 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. Sports competitions
1. Initial level. Create a Java console program: enter type race or jump, a name, and a positive result up to 10000; Result and subclasses select the better of two results: a shorter time or longer distance; print the winner or a tie. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type.
2. Basic level. Create a Java console program: enter type race or jump, a name, and a positive result up to 10000; Result and subclasses select the better of two results: a shorter time or longer distance; print the winner or a tie. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 type race or jump, a name, and a positive result up to 10000; Result and subclasses select the better of two results: a shorter time or longer distance; print the winner or a tie. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 separate report for each type without mixing units. 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. Sample sole proprietor taxes
1. Initial level. Create a Java console program: enter type fixed or percent and income in 0..100000000 kopiykas; Taxpayer and subclasses calculate a sample 10000 or 5 percent of income; print the amount with a note that this is a model, not current law. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type.
2. Basic level. Create a Java console program: enter type fixed or percent and income in 0..100000000 kopiykas; Taxpayer and subclasses calculate a sample 10000 or 5 percent of income; print the amount with a note that this is a model, not current law. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 type fixed or percent and income in 0..100000000 kopiykas; Taxpayer and subclasses calculate a sample 10000 or 5 percent of income; print the amount with a note that this is a model, not current law. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 breakdown and comparison of the two sample rules. 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. Coffee drinks
1. Initial level. Create a Java console program: enter type espresso or latte and quantity in 1..100; Coffee and subclasses specify a sample serving price of 3000 or 4500 kopiykas; print the description and amount. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type.
2. Basic level. Create a Java console program: enter type espresso or latte and quantity in 1..100; Coffee and subclasses specify a sample serving price of 3000 or 4500 kopiykas; print the description and amount. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 type espresso or latte and quantity in 1..100; Coffee and subclasses specify a sample serving price of 3000 or 4500 kopiykas; print the description and amount. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 extra milk serving only for Latte through a validated method. 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. Musical instruments
1. Initial level. Create a Java console program: enter type piano or guitar, a name, and volume in 0..100; Instrument and subclasses return a description of a key or string sound; print the description. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type.
2. Basic level. Create a Java console program: enter type piano or guitar, a name, and volume in 0..100; Instrument and subclasses return a description of a key or string sound; print the description. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 type piano or guitar, a name, and volume in 0..100; Instrument and subclasses return a description of a key or string sound; print the description. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 shared final performance method using an overridden sound. 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. Garden plants
1. Initial level. Create a Java console program: enter type tree or flower and age in 0..100; Plant and subclasses specify sample watering of 10 plus age or 2 liters; print the daily volume. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type.
2. Basic level. Create a Java console program: enter type tree or flower and age in 0..100; Plant and subclasses specify sample watering of 10 plus age or 2 liters; print the daily volume. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 type tree or flower and age in 0..100; Plant and subclasses specify sample watering of 10 plus age or 2 liters; print the daily volume. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 plants and the total watering volume. 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. Taxi classes
1. Initial level. Create a Java console program: enter type economy or comfort and a distance in 0..1000 km; Taxi and subclasses calculate 4000 plus 1200 per km or 6000 plus 1800 per km in kopiykas; print the price. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type.
2. Basic level. Create a Java console program: enter type economy or comfort and a distance in 0..1000 km; Taxi and subclasses calculate 4000 plus 1200 per km or 6000 plus 1800 per km in kopiykas; print the price. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 type economy or comfort and a distance in 0..1000 km; Taxi and subclasses calculate 4000 plus 1200 per km or 6000 plus 1800 per km in kopiykas; print the price. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 both classes' prices for one route. 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. Spacecraft
1. Initial level. Create a Java console program: enter type probe or station, a name, and mass in 1..100000; Spacecraft and subclasses describe a purpose of exploration or habitation; print the description. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type.
2. Basic level. Create a Java console program: enter type probe or station, a name, and mass in 1..100000; Spacecraft and subclasses describe a purpose of exploration or habitation; print the description. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 type probe or station, a name, and mass in 1..100000; Spacecraft and subclasses describe a purpose of exploration or habitation; print the description. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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: copying and equals based on exact class and name. 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. Medical tests as a model
1. Initial level. Create a Java console program: enter type blood or urine and a sample code; Analysis and subclasses return sample turnaround times of 24 or 12 hours without a medical conclusion; print the code and turnaround time. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type.
2. Basic level. Create a Java console program: enter type blood or urine and a sample code; Analysis and subclasses return sample turnaround times of 24 or 12 hours without a medical conclusion; print the code and turnaround time. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 type blood or urine and a sample code; Analysis and subclasses return sample turnaround times of 24 or 12 hours without a medical conclusion; print the code and turnaround time. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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: tracking only pending and ready states with transition validation. 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. Scholarships
1. Initial level. Create a Java console program: enter type regular or increased and a name; Scholarship and subclasses return sample amounts of 200000 or 300000 kopiykas; print the amount. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type.
2. Basic level. Create a Java console program: enter type regular or increased and a name; Scholarship and subclasses return sample amounts of 200000 or 300000 kopiykas; print the amount. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 type regular or increased and a name; Scholarship and subclasses return sample amounts of 200000 or 300000 kopiykas; print the amount. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 social supplement of 50000 through a separate subclass. 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. Library publications
1. Initial level. Create a Java console program: enter type book or magazine, a title, and overdue days in 0..365; Publication and subclasses calculate a sample fine of 100 or 50 kopiykas per day; print the fine. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type.
2. Basic level. Create a Java console program: enter type book or magazine, a title, and overdue days in 0..365; Publication and subclasses calculate a sample fine of 100 or 50 kopiykas per day; print the fine. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 type book or magazine, a title, and overdue days in 0..365; Publication and subclasses calculate a sample fine of 100 or 50 kopiykas per day; print the fine. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 polymorphic description of a loan period of 14 or 7 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 28. Travel packages
1. Initial level. Create a Java console program: enter type excursion or cruise and days in 1..30; Tour and subclasses calculate 100000 per day or 300000 per day plus 500000 kopiykas; print the price. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type.
2. Basic level. Create a Java console program: enter type excursion or cruise and days in 1..30; Tour and subclasses calculate 100000 per day or 300000 per day plus 500000 kopiykas; print the price. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 type excursion or cruise and days in 1..30; Tour and subclasses calculate 100000 per day or 300000 per day plus 500000 kopiykas; print the price. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 copies and a total order 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 29. Geometric solids
1. Initial level. Create a Java console program: enter type sphere or cylinder, a radius in 0.1..100, and for a cylinder a height in 0.1..100; Solid and subclasses calculate volume using 4 * pi * r^3 / 3 or pi * r^2 * h; print the volume. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type.
2. Basic level. Create a Java console program: enter type sphere or cylinder, a radius in 0.1..100, and for a cylinder a height in 0.1..100; Solid and subclasses calculate volume using 4 * pi * r^3 / 3 or pi * r^2 * h; print the volume. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 type sphere or cylinder, a radius in 0.1..100, and for a cylinder a height in 0.1..100; Solid and subclasses calculate volume using 4 * pi * r^3 / 3 or pi * r^2 * h; print the volume. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 surface area of a sphere, 4 * pi * r^2, and a cylinder, 2 * pi * r * (r + h). 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. Hospital staff
1. Initial level. Create a Java console program: enter type doctor or nurse, a name, and shifts in 0..31; Worker and subclasses calculate sample pay of 100000 or 60000 kopiykas per shift; print the payroll. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type.
2. Basic level. Create a Java console program: enter type doctor or nurse, a name, and shifts in 0..31; Worker and subclasses calculate sample pay of 100000 or 60000 kopiykas per shift; print the payroll. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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 type doctor or nurse, a name, and shifts in 0..31; Worker and subclasses calculate sample pay of 100000 or 60000 kopiykas per shift; print the payroll. Submit a UML class diagram; use extends, explicit super, private fields, and overrides with @Override; process the result through the base type. 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: copy constructors and comparison by exact class and identifier. 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
- Define the shared contract, units, and valid bounds.
- Submit a UML diagram and justify each inheritance relationship.
- Implement private state and validated constructors.
- Override methods with the Override annotation.
- Process an array of the base type without conditions based on class names.
- Test boundary data, failure without changing state, and equality.
- Submit a README, code, and at least five checks.
- During the presentation, show dynamic dispatch in the debugger.