subject

In order to manage their illness, people with Type 1 Diabetes need to calculate the carbohydrates in the foods they eat so that they can then inject the correct amount of insulin to process the food. Any food with less than 1 gram of carbohydrates per serving can legally be called "zero carb" A diabetic can eat any amount of zero carb foods.
Make a subclass Food of the Product class you'll find in the starter code. Besides the description and price inherited from Product, Food also has an instance variable carbs (a double). Do not redefine price and description variables. Call the super class to initialize them
Food has methods:
public double getCarbs()
public boolean isZeroCarb() which tells if this Food can be considered zero carb. A Food is considered zero carb if it has less than 1 gram of carbohydrates per serving. Return true if the Food is zero carb. Otherwise, return false.
public String getDescription() overrides the getDescription method in Product to also include the number of carbs. Call the getDescription method in the super class and add the new information on the end. The return string will look like this: spinach carbs=0.2

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 22:10
Asequential circuit contains a register of four flip-flops. initially a binary number n (0000 ≤ n ≤ 1100) is stored in the flip-flops. after a single clock pulse is applied to the circuit, the register should contain n + 0011. in other words, the function of the sequential circuit is to add 3 to the contents of a 4-bit register. design and implement this circuit using j-k flip-flops.
Answers: 1
question
Computers and Technology, 22.06.2019 22:30
The qwerty keyboard is the most common layout of keys on a keyboard
Answers: 3
question
Computers and Technology, 23.06.2019 04:10
2pointswho was mikhail gorbachev? oa. a russian leader who opposed a coupob. a polish leader who founded the labor union "solidarityoc. a soviet leader who called for a closer relationship with the unitedstates, economic reform, and a more open societyd. a soviet leader who called for more oppression in the soviet union
Answers: 3
question
Computers and Technology, 23.06.2019 06:00
Which statement is true of web-based social media? a.they allow consumers to interact with and update content. b.they cannot be updated easily, as compared to print media. c.they are expensive to produce and maintain, as compared to print and television. d.they can exist independent of the internet.
Answers: 1
You know the right answer?
In order to manage their illness, people with Type 1 Diabetes need to calculate the carbohydrates in...
Questions
question
Health, 22.03.2021 07:00
question
English, 22.03.2021 07:00
question
Advanced Placement (AP), 22.03.2021 07:00
Questions on the website: 13722362