Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello, In need of help with this Java pa homework. Thank you! 2. Create a normal (POJo, JavaBean) class to represent, i. e. model, varieties

Hello,

In need of help with this Java pa homework. Thank you!

image text in transcribed

image text in transcribed

2. Create a normal (POJo, JavaBean) class to represent, i. e. model, varieties of green beans (also known as string beans or snap beans). Following the steps shown in "Assignment: Tutorial on Creating Classes in IntelliJ", create the class in a file of its own in the same package as class Main. Name the class an appropriate name. The class must have (a) private field variables of appropriate types for variety, pod length and number of seeds in the pod. Variety must not be set to empty. Pod length must be set to a value greater than zero. The number of seeds in the pod must be zero or greater. (b) a public getter (accessor) and setter (mutator, manipulator) for each private field variable. The getters must not have parameters. The setters must have only one parameter. (c) a public default constructor, i. e. a constructor without parameters. (d) a parametrized constructor, i. e. a constructor with parameters, one parameter for each of the private field variables. 3. In the class Main, (a) create a void method that when passed an array of green bean class type, outputs the information about each green bean object referenced by the elements of the array passed to the method. If an element of the array has the value null, nothing is output for that element. (b) Create a method that when passed an array of green bean class type, returns the average length of the pods of the beans referenced by the elements in the array. Be sure to not count or try to get data from the elements or the array that have the value null. (c) Create a method that when passed an array of green bean class type, returns the average number of seeds in the pods of the beans referenced by the elements in the array. Be sure to not count or try to get data from the elements or the array that have the value null 4. In method main of class Main, (a) create an array of your green bean class type that can hold 10 elements of green bean class type, then assign i. a unique object of green bean class type to 7 of the elements, each object of a different variety. Some green bean varieties are string bean, filet beans, long beans, purple string beans, flat beans, wax beans and bush beans. 11. null to the remaining elements with the proviso that null cannot be assigned to adjoining (neighboring) elements. (b) Call the three methods created in step #3, passing each the array create above and output the values returned from the non-void methods

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

Climate And Environmental Database Systems

Authors: Michael Lautenschlager ,Manfred Reinke

1st Edition

1461368332, 978-1461368335

More Books

Students also viewed these Databases questions

Question

Evaluate the importance of diversity in the workforce.

Answered: 1 week ago

Question

Identify the legal standards of the recruitment process.

Answered: 1 week ago