Question: Lab 1 3 A: Write the three static methods below inside of your driver class ( this is the class that contains Sample output (
LabA: Write the three static methods below inside of your driver class this is the class that contains Sample output user input in bold: LabB: Create a Book class which contains the following:
Fields:
name: string
price: double
yearOfRelease: int
Constructor:
Takes in parameters: a string, and an integer.
Sets the parameters to the appropriate fields.
setPrice:
Takes in a double as a parameter and returns nothing.
Sets the price field with the value in the parameter.
toString:
Takes in no parameters and returns a string.
The string returned is in the following format:
name yearOfRelease: $price
In your main method, prompt the user for the name of a book and a release date. Create a Book object
with that information. Then, prompt the user for a price, and use the object's setPrice to set the Book
object's price. Finally, call the Book object's toString and print what is returned.
Please note the following:
When asking for a price, keep prompting the user until they enter a price that is greater than
When asking for a yearOfRelease, keep prompting the user until they enter a number that is
between and
When asking for a name, keep prompting the user until they enter a name that isn't empty.
You can assume the user will never enter information of the wrong type eg: when asking for a
yearOfRelease, you can assume the user will only enter integers
Sample output user input in bold:
Submit your file to Gradescope as LabAjava and LabBjava
your main method:
min : Receives an integer array as a parameter and returns an integer. This method traverses the
array in the parameters and returns the smallest number in the array.
: Receives an integer array as a parameter and returns an integer. This method traverses the
array in the parameters and returns the largest number in the array.
avg: Receives an integer array as a parameter and returns a double. This method traverses the
array in the parameters and returns the mean average of the numbers in the array.
Inside your main method, prompt the user for a size for the array you are about to create; keep prompting
the user if they enter a size that's less than Once the user enters a valid number, create an integer array
of that size.
Next, prompt the user for enough numbers to fill the whole array. These numbers can be positive, negative,
or
Next, ask the user if they want to find the smallest, the largest, or the mean average of all the numbers
they've entered keep prompting the user until they enter a valid choice Pass the array to the appropriate
method and print the results.
Keep asking the user for an option until they enter the option to quit.
You can assume that the user will not enter doubles or strings when prompted for a number.
Sample input on the next page.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
