Question: Please help me with my java code Assignment Description 1. First, create an Intellij Java project. 2. Create a normal (POJO, JavaBean) class to represent,

Please help me with my java code

Assignment Description

1. First, create an Intellij Java project.

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.

ii. 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.

Additional Requirements

(a)A reference variable and instance object of class java.util.Scanner must be used to read the input from the user. Prompts for user input must be clear and relevant.

(b)Output to the user must include appropriate labels.

(c)Identifiers must be descriptive, i. e. must self document. The only exception granted is in the case of a for variable, that is a variable created as a simple counter as in the control variable in a for loop statement.

(d)Indention of all code blocks (compound statements, anything in braces), including single statements following selection or while statements, is required.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!