need explaination of this problem Liquid -name: String -color: String -nutrition Value: double -amount: double +Liquid(type: String,
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Liquid -name: String -color: String -nutrition Value: double -amount: double +Liquid(type: String, color: String, nutritionValue: double, amount: double) +setName(type: String):void +getName():String +setColor(color: String):void +getColor():String +setNutrition Value(weight: double):void +getNutritionValue():double +setAmount(amount: double):void +getAmount():double +drink(amount: double):boolean Member/Method name furColor nutrition Value amount setName getName setColor getColor setNutrition Value getNutrition Value setAmount getAmount drink Definition String holding the name of the liquid String holding the color of the liquid double storing the liquid's nutritional value double storing how much liquid remains Sets the attribute name to the value of the String passed in as a parameter Returns the value of the class attribute name Sets the attribute color to the value of the String passed in as a parameter Returns the value of the class attribute color Sets the class attribute nutrition to the value of the double passed in as a parameter, include logic to ensure that this attribute does not exceed 100 or go below 0. Returns the value of the class attribute weight Sets the attribute amount to the value of the double passed in as a parameter, ensure that amount does not drop below 0 Returns the value of the class attribute amount Decrements the attribute amount by the value passed in as a parameter. Returns true if the attribute amount > 0, otherwise false. Liquid -name: String -color: String -nutrition Value: double -amount: double +Liquid(type: String, color: String, nutritionValue: double, amount: double) +setName(type: String):void +getName():String +setColor(color: String):void +getColor():String +setNutrition Value(weight: double):void +getNutritionValue():double +setAmount(amount: double):void +getAmount():double +drink(amount: double):boolean Member/Method name furColor nutrition Value amount setName getName setColor getColor setNutrition Value getNutrition Value setAmount getAmount drink Definition String holding the name of the liquid String holding the color of the liquid double storing the liquid's nutritional value double storing how much liquid remains Sets the attribute name to the value of the String passed in as a parameter Returns the value of the class attribute name Sets the attribute color to the value of the String passed in as a parameter Returns the value of the class attribute color Sets the class attribute nutrition to the value of the double passed in as a parameter, include logic to ensure that this attribute does not exceed 100 or go below 0. Returns the value of the class attribute weight Sets the attribute amount to the value of the double passed in as a parameter, ensure that amount does not drop below 0 Returns the value of the class attribute amount Decrements the attribute amount by the value passed in as a parameter. Returns true if the attribute amount > 0, otherwise false.
Expert Answer:
Answer rating: 100% (QA)
This problem presents the design and implementation of a class named Liquid with several attributes and methods related to managing liquid properties ... View the full answer
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Posted Date:
Students also viewed these programming questions
-
This assignment reviews object-oriented programming concepts such as classes, methods, constructors, accessor methods, and access modifiers. It makes use of an array of objects as a class data...
-
Design a Java class that represents a cache with a fixed size. It should support operations like add, retrieve, and remove, and it should evict the least recently used item when it reaches capacity.
-
Consider a situation where the marginal damage function is known and equal to D'(E)= d.E. The aggregate marginal abatement cost curve is given by -C'(E)=-bE where is random variable uniformly...
-
The Piano Studio Ltd. has provided you with the following information with respect to its piano inventory for the month of August. The company uses the specific identification cost formula....
-
Part 2. In this economy there is one insurance company that offers simple medical insurance contracts where for a premium P it agrees to reimburse the policy holder an amount C...
-
What is the hedonic wage function? What does the slope of the hedonic wage function measure?
-
Condensed financial data of Jhutti Company appear below. Additional information: 1. Equipment costing $92,000 was purchased for cash during the year. 2. Investments were sold at cost. 3. Equipment...
-
Solve the initial value problem. dy =3e3t sin (e3t-27), y(In 3)=0 dt The solution is y =
-
Butler, Inc., operates at capacity and makes wooden playground equipment. Although Butlers swing sets and play forts are a matching set, they are sold individually and so the sales mix is not 1:1....
-
Please answer the following multiple choicequestions. 1. What move by CEO Don Thompson in January 2015 indicated achange in direction for McDonalds? He decided to stop the sale of Happy Meals due to...
-
What challenges do you have when you communicate with your healthcare provider?
-
What are some of the unique communication challenges for dentists? Nurses? Pharmacists? Emergency room providers? How could these providers improve patient- centered communication?
-
What is an intervention? Are interventions associated exclusively with a scientific approach to research? Explain why or why not.
-
Give an original example to study some aspect of healthcare delivery using a naturalistic approach.
-
Devise an original communication intervention to change some aspect of healthcare delivery. Be specific about the setting, participants, and measurement.
-
The circles C1 and C2 intersect each other at A and M. The tangent from A to C1 meets C2 again at B. Similarly define E. D is a point on ray AM such that AM=MD. If ZBE = 75, what is ZBDE? A C2 E B D
-
Explain briefly what is meant by electronic data interchange (EDI). How does EDI affect a companys audit trail?
-
Write a program that enables the user to add/remove points by clicking the left/right mouse button, and displays a line that connects the pair of nearest points, as shown in Figure 22.4. |...
-
Write a program that reads the following information and prints a payroll statement: Employee?s name (e.g., Smith) Number of hours worked in a week (e.g., 10) Hourly pay rate (e.g., 9.75) Federal tax...
-
You have just started a sales job in a department store. Your pay consists of a base salary and a commission. The base salary is $5,000. The scheme shown below is used to determine the commission...
-
Find the Laplace transform of the following signals and locate the poles and zeros of \(F(s)\). (a) \(f(t)=-10 \mathrm{~d} \delta(t) / d t\) (b) \(f(t)=120 \cos (377 t) u(t)\). (c)...
-
(a) Find the Laplace transform of \(f(t)=50\left[e^{-100 t}-2 e ight.\) \(-200 t] u(t)\). (b) Locate the poles and zeros of \(F(s)\). (c) What is the time constant associated with each pole? (d)...
-
Find the Laplace transform of \(f(t)=\delta^{\prime}(t)+\delta(t)-e^{-t} u\) \((t)\). Locate the poles and zeros of \(F(s)\).
Study smarter with the SolutionInn App