Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions