[Solved] CS212 Project 1-Sorting an Array of Candles/ Displaying in a GUI/Creating a Class

$25

File Name: CS212_Project_1_Sorting_an_Array_of_Candles__Displaying_in_a_GUI_Creating_a_Class.zip
File Size: 763.02 KB

SKU: [Solved] CS212 Project 1-Sorting an Array of Candles/ Displaying in a GUI/Creating a Class Category: Tag:
5/5 - (1 vote)

Rate this product

Sorting an Array of Candles/ Displaying in a GUI/Creating a Class

Create a class called Candle to represent a candle. It should have four private instance variables: An int for the height, an int for the width, a float for the price and a boolean to determine if the candle is lit or not. The class should include a three-argument constructor (we will assume a constructed candle is not lit) and get and set methods for each instance variable. Override the method toString which should return the Candle information in the same format as the input file (See below).

Read the information about a candle from a file that will be given to you on Blackboard, parse out the three pieces of information for the Candle using a StringTokenizer, instantiate the Candle and store the Candle object in two different arrays (one of these arrays will be sorted in a later step). Once the file has been read and the arrays have been filled, sort one of the arrays by price using Selection Sort.

Display the contents of the arrays in a GUI that has a GridLayout with one row and two columns. The left column should display the candles in the order read from the file, and the right column should display the candles in sorted order.

The input file

Each line of the input file will contain information about a candle, with each piece of information separated by a comma. An example of the input file would be:

12,1,1.494,3,2.50

If the line of the file does not have exactly three tokens, do not put it in the arrays; print it to the console.

Submitting the Project.

You should have three files to submit for this project:

Project1.javaCandleGUI.javaCandle.java

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CS212 Project 1-Sorting an Array of Candles/ Displaying in a GUI/Creating a Class[Solved] CS212 Project 1-Sorting an Array of Candles/ Displaying in a GUI/Creating a Class
$25