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:

  1. Exceptions:
  1. Exception InvalidateTemperature, with constructor you accept minimum and maximum temperature. Error message to be "The temperature is not in the range from _ to _"
  2. Exception InvalidSweetness, with constructor you accept minimum and maximum sweetness. Error message to be "The sweetness is not in the range from _ to _"
  3. 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

  1. Interfaces for:
  1. Hot food
  2. Cold food
  3. Sweet food

  1. Food product class:
  1. Private:
    1. Name of the product
  2. Constructor:
    1. Name of the product
  3. Methods for:
    1. Extract
    2. Change the name of the product
    3. Comparison of uniformity by product name
  1. Abstract class Food:

  1. Private:
  1. Name of the food
  2. List of products
  3. Price
  4. Temperature
  1. Constructor:
  1. Name, price and list of products, temperature
  2. The constructor throws an exception InvalidateTemperature
  1. Methods for:
  1. Abstract method for setting temperature
  2. Extract price, name, temperature, product list
  3. Price change and name change
  4. Change of product by product name and reference of the new food product.
  1. Implements:
  1. Comparable - by price.

  1. Soup class inherits Food, implements the hot food interface
  1. Methods:
  1. 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)
  1. Presentation as text

  1. Salad class inherits Food, implements the cold food interface
  1. Methods:
  1. 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)
  1. Presentation as text

  1. Dessert class inherits Food, implements the sweet food interface

  1. Private:
  1. Sweetness level number from 1 inclusive to 10 inclusive, if not to produce an exception (InvalidSweetness)
  1. Constructor:
  1. Complements the parent constructor with sweetness
  1. Methods:
  1. Changing sweetness
  2. Implements the abstract methods of the parent class:
  3. The temperature must be a number from -15 inclusive to 35 inclusive, if no exception is produced (InvalidateTemperature)
  4. Presentation as text

  1. Portion class
  1. Private:
  1. Food
  2. Quantity
  1. Constructor:
  1. Food quantity
  1. Methods:
  1. Extraction of food, quantity
  2. Change of food, quantity

  1. Food tray class
  1. Private:
  1. List of Portions
  1. Constructor:
  1. With no parameters
  1. Methods:
  1. Add a portion with reference food and quantity
  2. Total price of food
  3. Total
  4. Finds and returns a list of soups to the tray
  5. Finds and returns a list of salads in the tray
  6. Finds and returns a list of desserts on the tray
  7. Returns a list of foods sorted in ascending order of price
  8. Presentation as text

  1. Main method:
  1. Defines an array of 5 Foods.
  2. Defines a list of 2 Soups, 2 Salads, 2 Desserts
  3. He changes a product in one of the foods
  4. 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 blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!