Question: *** I need it In Java DrJava** Pepper Scale This is OPEN BOOK, OPEN NOTE, BUT NOT OPEN INTERNET. We are allowed to answer questions,

*** I need it In Java "DrJava"**

Pepper Scale

This is OPEN BOOK, OPEN NOTE, BUT NOT OPEN INTERNET. We are allowed to answer questions, but we are not allowed to give advice or help. Also if you are caught using any other website besides the dropbox.cse.sc.edu and cse.sc.edu/~shephejj/csce145/ then you will receive an automatic 0. This is due at the end of the lab session. Good Luck!

Objective:

Write a program two classes that will complete this pepper judging program. First download the driver and include it in your project.

Create a class Pepper with the following

Instance variables

name: simply the name of the pepper

scovilleRating: a positive integer value determine hotness of a pepper. It ranges from 0 to 2.2 million

Constructors

Default: sets both instance variables to false

Parameterized: Takes in two parameters that set the instance variables to those values

Accessors and Mutators for every instance variable

CHECK FOR VALID VALUES!

Other Methods

toString: returns a string with the name and the Scoville rating of the pepper

Next create a class PepperCollection with the following

Instance variable

peppers: An array of peppers

Constructors

Default: Initializes the array to size 10

Accessor ONLY for the instance variable peppers

Other Methods

addPepper: This method returns nothing and takes in a Pepper as a parameter, and adds a new instance of a pepper to the array. It should add it to the first null element and place the new pepper there.

sortPeppers: This method returns nothing and has no parameters, but it sorts the peppers from highest to lowest Scoville values. Also you must implement your own sorting algorithm and not use one built into java.

printPeppers: This method returns nothing and takes no parameters prints out all of the peppers in the array Peppers

Example Dialog:

Adding peppers

Printing out unsorted peppers

Bell Pepper 0

Banana Pepper 1000

Poblano 3500

Ghost Pepper 1000000

Carolina Reaper 2000000

Tabasco Pepper 50000

Habanero Chili 350000

Jalapeno 10000

Red Savina Habenero 580000

Printing out sorted peppers (hottest to mildest)

Carolina Reaper 2000000

Ghost Pepper 1000000

Red Savina Habenero 580000

Habanero Chili 350000

Tabasco Pepper 50000

Jalapeno 10000

Poblano 3500

Banana Pepper 1000

Bell Pepper 0

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!