Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please use java and show the output too 5. Write the following custom methods: a. The method isstarchy(boolean isEatenWithFat) returnstrue when the isEatenwithFat is true

image text in transcribed

Please use java and show the output too

5. Write the following custom methods: a. The method isstarchy(boolean isEatenWithFat) returnstrue when the isEatenwithFat is true AND the fruit is over 300 calories AND has the word "sweet" (case-insensitive) anywhere in the description. b. The method isNumberedDescription () returns true if the first letter of the description is a number. c. Write a method that returns how many pieces of the fruit may be eaten, without going over 1600 calories. The signature will be public int numberoffruits () . Some examples: - If the fruit has 300 calories, the method will return 5 . - If the fruit has 650 calories, the method will return 2 . - If the fruit has 125 calories, the method will return 12. - etc. 6. Create a tostring that prints out the name, description and calories of the fruit in an attractive and readable manner. Proper spacing and labeling should be included. A "table-like" structure will be enjoyed. FruitTester 1. Fruittester will contain a main method. Create 8 unique, meaningful fruit objects using the 3 parameter constructor. 2. Place each object into an array. 3. Use the setDescription method to change the description to "100 times better than strawberries" for the last fruit object you created. 4. Print out the contents of each object using the System.out.printIn statement. Do NOT explicitly invoke the tostring method 5. Using a looping constructor (while/for) to invoke and print out the results of a. The isNumberedDescription method for each object in the array b. The numberoffruits method for each object in the array 6. For the first 2 objects you created, print out the result of invoking the isstarchy method

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

Recommended Textbook for

Database Systems For Advanced Applications 9th International Conference Dasfaa 2004 Jeju Island Korea March 2004 Proceedings Lncs 2973

Authors: YoonJoon Lee ,Jianzhong Li ,Kyu-Young Whang

2004th Edition

3540210474, 978-3540210474

More Books

Students also viewed these Databases questions