Question: Write a java program which tracks the state of water by implementing it using this umI: The temperature String passed to the constructor will be

Write a java program which tracks the state of water by implementing it using this umI:

Write a java program which tracks the state of water by implementing

The temperature String passed to the constructor will be something like "100C" for 100 degrees Centigrade or "-20F" for minus 20 degrees Fahrenheight. You need to take that String and set your instance variables in the constructor.

The getState method returns one of the MatterState enumerated types. In UML, the values of the enumerated types are given by the attributes. You don't need to use the text > at all in your Java code. It is just a way of indicating that the diagram represents an enumerated type.

  • You might want to use the substring method of the String object.
  • You can print the MatterState enumerated type directly.
  • Enumerated types, also called enum, have a template under eclipse like when you create a class.
  • The enumerated type will have a separate source file.

WaterState > MatterState -waterTemperature : double -isCelcius: boolean +WaterState(temperature String) +getState0MatterState GAS LIQUID SOLID VS Main +main args: Stringl): void

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!