Question: Create a student chair management program using Java. For this purpose you will need: Exceptions: Exception InvalidateTemperature, with constructor you accept minimum and maximum temperature.
Create a student chair management program using Java. For this purpose you will need:
- Exceptions:
- Exception InvalidateTemperature, with constructor you accept minimum and maximum temperature. Error message to be "The temperature is not in the range from _ to _"
- Exception InvalidSweetness, with constructor you accept minimum and maximum sweetness. Error message to be "The sweetness is not in the range from _ to _"
- Exception EmptyValue, with constructor the name of the variable with invalid value. Error message should be "The value of _ cannot be empty or null" - apply the exception to places where objects with empty values should not be created
- Interfaces for:
- Hot food
- Cold food
- Sweet food
- Food product class:
- Private:
- Name of the product
- Constructor:
- Name of the product
- Methods for:
- Extract
- Change the name of the product
- Comparison of uniformity by product name
- Abstract class Food:
- Private:
- Name of the food
- List of products
- Price
- Temperature
- Constructor:
- Name, price and list of products, temperature
- The constructor throws an exception InvalidateTemperature
- Methods for:
- Abstract method for setting temperature
- Extract price, name, temperature, product list
- Price change and name change
- Change of product by product name and reference of the new food product.
- Implements:
- Comparable - by price.
- Soup class inherits Food, implements the hot food interface
- Methods:
- Implements the abstract methods of the parent class:
- The temperature must be a number from 15 inclusive to 30 inclusive, if no exception is to be produced (InvalidateTemperature)
- Presentation as text
- Salad class inherits Food, implements the cold food interface
- Methods:
- Implements the abstract methods of the parent class:
- The temperature must be a number from 0 inclusive to 10 inclusive, if no exception is to be produced (InvalidateTemperature)
- Presentation as text
- Dessert class inherits Food, implements the sweet food interface
- Private:
- Sweetness level number from 1 inclusive to 10 inclusive, if not to produce an exception (InvalidSweetness)
- Constructor:
- Complements the parent constructor with sweetness
- Methods:
- Changing sweetness
- Implements the abstract methods of the parent class:
- The temperature must be a number from -15 inclusive to 35 inclusive, if no exception is produced (InvalidateTemperature)
- Presentation as text
- Portion class
- Private:
- Food
- Quantity
- Constructor:
- Food quantity
- Methods:
- Extraction of food, quantity
- Change of food, quantity
- Food tray class
- Private:
- List of Portions
- Constructor:
- With no parameters
- Methods:
- Add a portion with reference food and quantity
- Total price of food
- Total
- Finds and returns a list of soups to the tray
- Finds and returns a list of salads in the tray
- Finds and returns a list of desserts on the tray
- Returns a list of foods sorted in ascending order of price
- Presentation as text
- Main method:
- Defines an array of 5 Foods.
- Defines a list of 2 Soups, 2 Salads, 2 Desserts
- He changes a product in one of the foods
- He creates a tray and performs all his methods.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
