I have already completed part one shown below.
I need help with part 2: MonthlyCostComparator.java,MonthlyCostComparatorTest.java, andCloudStoragePart2.java,CloudStoragePart2Test.java
Thank you,
public abstract class CloudStorage { protected String name; protected double baseStorageCost; protected static int count = 0; /*** @param nameIn name.* @param baseStorageCostIn storage.**/ public CloudStorage(String nameIn, double baseStorageCostIn) { name = nameIn; baseStorageCost = baseStorageCostIn; count++; } /** * @return returns the getName. */ public String getName() { return name; } /** * @param nameIn gets name. */ public void setName(String nameIn) { name = nameIn; } /** * @return returns the setName. */ public double getBaseStorageCost() { return baseStorageCost; } /** * @param baseStorageCostIn gets baseStorageCost. */ public void setBaseStorageCost(double baseStorageCostIn) { baseStorageCost = baseStorageCostIn; } /** * @return returns the getCount. */ public static int getCount() { return count; } /** */ public static void resetCount() { count = 0; } /** * @return returns the toString. */ public String toString() { String output = name + " (" + this.getClass() + ") Monthly Cost: $" + monthlyCost() + "0" + "nBase Storage Cost: $" + getBaseStorageCost() + "0"; return output; } /** * Returns the monthly cost. * @return monthlyCost value. */ public abstract double monthlyCost();} public class SharedCloud extends CloudStorage {//variables. protected double dataStored; protected double dataLimit; /** *Cost factor. */ public static final double COST_FACTOR = 1.0; /*** * @param nameIn gets name. * @param baseStorageCostIn gets BaseStorageCost. * @param dataStoredIn gets data stored. * @param dataLimitIn gets the datalimit. */ public SharedCloud(String nameIn, double baseStorageCostIn, double dataStoredIn, double dataLimitIn) { super(nameIn, baseStorageCostIn); dataStored = dataStoredIn; dataLimit = dataLimitIn; } /** * @return the DataStored */ public double getDataStored() { return dataStored; } /** * @param dataStoredIn in the datastore. */ public void setDataStored(double dataStoredIn) { dataStored = dataStoredIn; } /** * @return the getDataLimit. */ public double getDataLimit() { return dataLimit; } /** * @param dataLimitIn in the datalimit. */ public void setDataLimit(double dataLimitIn) { dataLimit = dataLimitIn; } /** * @return the */ public double getCostFactor() { return COST_FACTOR; } /** * @return the dataOverage */ public double dataOverage() { double overage = dataStored - dataLimit; if (overage > 0) { return overage; } else { return 0; } } /** * @return the monthlyCost */ public double monthlyCost() { double cost = (baseStorageCost + dataOverage() * SharedCloud.COST_FACTOR); return cost; } /** * @return the toString */ public String toString() { String output = super.toString() + "nData Stored: " + getDataStored() + "00" + " GB" + "nData Limit: " + getDataLimit() + "00" + " GB" + "nOverage: " + dataOverage() + "00" + " GB" + "nCost Factor: " + getCostFactor() + "0"; return output; } }import org.junit.Assert;import org.junit.Before;import org.junit.Test;public class SharedCloudTest { /** Fixture initialization (common initialization * for all tests). **/ @Before public void setUp() { } /** A test of the getDataStored. **/ @Test public void getDataStoredTest() { SharedCloud c2 = new SharedCloud("CloudTwo", 9.00, 12.0, 20.0); Assert.assertEquals(12, c2.getDataStored(), .01); } /** A test of the setDataStored. **/ @Test public void setDataStoredTest() { SharedCloud c2 = new SharedCloud("CloudTwo", 9.00, 12.0, 20.0); c2.setDataStored(15); Assert.assertEquals(15, c2.getDataStored(), .01); } /** A test of the getDataLimit. **/ @Test public void getDataLimitTest() { SharedCloud c2 = new SharedCloud("CloudTwo", 9.00, 12.0, 20.0); Assert.assertEquals(20, c2.getDataLimit(), .01); } /** A test of the setDataLimit. **/ @Test public void setDataLimitTest() { SharedCloud c2 = new SharedCloud("CloudTwo", 9.00, 12.0, 20.0); c2.setDataLimit(25); Assert.assertEquals(25, c2.getDataLimit(), .01); } /** A test of the getCostFactor. **/ @Test public void getCostFactorTest() { SharedCloud c2 = new SharedCloud("CloudTwo", 9.00, 12.0, 20.0); Assert.assertEquals(1, c2.getCostFactor(), .01); } /** A test of the dataOverage. **/ @Test public void dataOverageTest() { SharedCloud c2 = new SharedCloud("CloudTwo", 9.00, 12.0, 20.0); SharedCloud c3 = new SharedCloud("CloudThree", 9.00, 25.0, 20.0); Assert.assertEquals(0, c2.dataOverage(), .01); Assert.assertEquals(5, c3.dataOverage(), .01); } /** A test for monthlyCost. **/ @Test public void monthlyCostTest() { SharedCloud c2 = new SharedCloud("CloudTwo", 9.00, 12.0, 20.0); Assert.assertTrue(c2.monthlyCost() == 9); } /** A test for toString. **/ @Test public void toStringTest() { SharedCloud c2 = new SharedCloud("CloudTwo", 9.00, 12.0, 20.0); Assert.assertEquals(c2.toString(), c2.toString()); } }public class PublicCloud extends SharedCloud { /** * bos. */ public static final double COST_FACTOR = 2.0; /** * Constructor for PublicCloud. * @param nameIn for server name. * @param baseStorageCostIn gets the base storage cost. * @param dataStoredIn gets the data storage amount in GB. * @param dataLimitIn gets the data storage limit amount in GB. */ public PublicCloud(String nameIn, double baseStorageCostIn, double dataStoredIn, double dataLimitIn) { super(nameIn, baseStorageCostIn, dataStoredIn, dataLimitIn); } /** * @return PublicCloud. */ public double getCostFactor() { return COST_FACTOR; } /** * @return all cost for monthly. */ public double monthlyCost() { double cost = (baseStorageCost + dataOverage() * PublicCloud.COST_FACTOR); return cost; }}import org.junit.Assert;import org.junit.Before;import org.junit.Test;public class PublicCloudTest { /** Fixture initialization (common initialization * for all tests). **/ @Before public void setUp() { } /** A test of the getCostFactor. **/ @Test public void getCostFactorTest() { PublicCloud c4 = new PublicCloud("CloudFour", 9.00, 25.0, 20.0); Assert.assertEquals(2, c4.getCostFactor(), .01); } /** A test for monthlyCost. **/ @Test public void monthlyCostTest() { PublicCloud c4 = new PublicCloud("CloudFour", 9.00, 25.0, 20.0); Assert.assertTrue(c4.monthlyCost() == 19); } /** A test for toString. **/ @Test public void toStringTest() { PublicCloud c4 = new PublicCloud("CloudFour", 9.00, 25.0, 20.0); Assert.assertEquals(c4.toString(), c4.toString()); } }/***PersonalCloud.*Project 9*@author Pelin Nisa Top - Fundamentals Of Computing - 1210-001*@version April 3, 2020*/public class PersonalCloud extends SharedCloud { /** * bos. */ public static final double COST_FACTOR = 3.0; /** Constructor for PersonalCloud. */ /** *@param nameIn name. *@param baseStorageCostIn gets the baseStorageCost. *@param dataStoredIn gets the dataStored. *@param dataLimitIn gets the dataLimit. */ public PersonalCloud(String nameIn, double baseStorageCostIn, double dataStoredIn, double dataLimitIn) { super(nameIn, baseStorageCostIn, dataStoredIn, dataLimitIn); } /** *@return returns the COST_FACTOR. */ public double getCostFactor() { return COST_FACTOR; } /** *@return returns the total monthly cost */ public double monthlyCost() { double cost = baseStorageCost + dataOverage() * PersonalCloud.COST_FACTOR; return cost; } }import org.junit.Assert;import org.junit.Before;import org.junit.Test;public class PersonalCloudTest { /** Fixture initialization (common initialization * for all tests). **/ @Before public void setUp() { } /** A test of the getCostFactor. **/ @Test public void getCostFactorTest() { PersonalCloud c5 = new PersonalCloud("CloudFive", 9.00, 21.0, 20.0); Assert.assertEquals(3, c5.getCostFactor(), .01); } /** A test for monthlyCost. **/ @Test public void monthlyCostTest() { PersonalCloud c5 = new PersonalCloud("CloudFive", 9.00, 21.0, 20.0); Assert.assertTrue(c5.monthlyCost() == 12); } /** A test for toString. **/ @Test public void toStringTest() { PersonalCloud c5 = new PersonalCloud("CloudFive", 9.00, 21.0, 20.0); Assert.assertEquals(c5.toString(), c5.toString()); }}public class DedicatedCloud extends CloudStorage {/** *bos. */ private double serverCost; /*** * Constructor for DedicatedCloud. * @param nameIn gets name. * @param baseStorageCostIn gets BaseStorageCost. * @param serverCostIn gets the serverCostIn. */ public DedicatedCloud(String nameIn, double baseStorageCostIn, double serverCostIn) { super(nameIn, baseStorageCostIn); serverCost = serverCostIn; } /** * @return the ServerCost */ public double getServerCost() { return serverCost; } /** * @param serverCostIn gets serverCostIn. */ public void setServerCost(double serverCostIn) { serverCost = serverCostIn; } /** * Returns Cloud Server. * @return String. */ public double monthlyCost() { double cost = baseStorageCost + serverCost; return cost; }/** * Returns Cloud Server. * @return String. */ public String toString() { String output = super.toString() + "nServer Cost: $" + getServerCost() + "0"; return output; }}import org.junit.Assert;import org.junit.Before;import org.junit.Test;public class DedicatedCloudTest { /** Fixture initialization (common initialization * for all tests). **/ @Before public void setUp() { } /** A test for getName. **/ @Test public void getNameTest() { DedicatedCloud c1 = new DedicatedCloud("Cloud One", 40.00, 10.00); Assert.assertEquals("Cloud One", c1.getName()); } /** A test for setName. **/ @Test public void setNameTest() { DedicatedCloud c1 = new DedicatedCloud("Cloud One", 40.00, 10.00); c1.setName("Test Cloud"); Assert.assertEquals("Test Cloud", c1.getName()); } /** A test for setBaseStorageCost. **/ @Test public void setBaseStorageCostTest() { DedicatedCloud c1 = new DedicatedCloud("Cloud One", 40.00, 10.00); c1.setBaseStorageCost(30); Assert.assertEquals(30, c1.getBaseStorageCost(), 01); } /** A test for resetCount. **/ @Test public void resetCountTest() { DedicatedCloud c1 = new DedicatedCloud("Cloud One", 40.00, 10.00); DedicatedCloud.resetCount(); Assert.assertEquals(0, c1.getCount(), .01); } /** A test for getServerCost. **/ @Test public void getServerCostTest() { DedicatedCloud c1 = new DedicatedCloud("Cloud One", 40.00, 10.00); Assert.assertEquals(10, c1.getServerCost(), .01); } /** A test for setServerCost. **/ @Test public void setServerCostTest() { DedicatedCloud c1 = new DedicatedCloud("Cloud One", 40.00, 10.00); c1.setServerCost(12); Assert.assertEquals(12, c1.getServerCost(), .01); } /** A test for monthlyCost. **/ @Test public void monthlyCostTest() { DedicatedCloud c1 = new DedicatedCloud("Cloud One", 40.00, 10.00); Assert.assertTrue(c1.monthlyCost() == 50); } /** A test for toString. **/ @Test public void toStringTest() { DedicatedCloud c1 = new DedicatedCloud("Cloud One", 40.00, 10.00); Assert.assertEquals(c1.toString(), c1.toString());} }
Project: Cloud Storage - Part 2 Page I of 8 Deliverables Your project files should be submitted to Web-CAT by the due date and time specified. Note that there is also an optional Skeleton Code assignment which will indicate level of coverage your tests have achieved (there is no late penalty since the skeleton code assignment is ungraded for this project). The files you submit to skeleton code assignment may be incomplete in the sense that method bodies have at least a return statement if applicable or they may be essentially completed files. In order to avoid a late penalty for the project, you must submit your completed code files to Web-CAT no later than 11:59 PM on the due date for the completed code assignment. If you are unable to submit via Web-CAT, you should c-mail your project Java files in a zip file to your TA before the deadline. Test files are not required for this project. If submitted, you will be able to see your code coverage, but this will not be counted as part of your grade. CloudStoragePanz {main Files to submit to Web-CAT (test files are optional): From Cloud Storage - Part 1 CloudStorageList CloudStorage.java DedicatedCloud. java, DedicatedCloudTest.java MonthlyCostComparator SharedCloud.java, SharedCloudTest.java PublicCloud.java, PublicCloudTest,java CloudStorage [abstract PersonalCloud.java, PersonalCloudTest.java New in Cloud Storage - Part 2 DedicatedCloud SharedCloud . MonthlyCostComparator.java, Monthly Cost ComparatorTest.java A CloudStorageList. java, CloudStorageList Test.java PublicCloud Personal Cloud CloudStoragePart2 java, CloudStoragePart2Test.java Recommendations You should create new folder for Part 2 and copy your relevant Part 1 source and optional test files to it. You should create a jGRASP project with these files in it, and then add the new source and optional test files as they are created. Specifications - Use arrays in this project; ArrayLists are not allowed! Overview: This project is the second of three that will involve the monthly cost and reporting for cloud storage. In Part 1 you developed Java classes that represent categories of cloud storage including dedicated cloud storage and shared cloud storage (both public and personal cloud storage. In Part 2, you will implement three additional classes: (1) Monthly CostComparator that implements the Comparator interface for CloudStorage, (2) CloudStorageList that represents a list of cloud storage objects and includes several specialized methods, and (3) CloudStoragePart2 which contains the main method for the program. Note that the main method in CloudStoragePart2 should create a CloudStorageList object and then call the readFile method on the CloudStorageList object, which will add cloud storage objects to the list as the data is read in from a file. You can use CloudStoragePart2 in conjunction with interactions by running the program in a jGRASP canvas (or debugger with a breakpoint) and single stepping until the variables of interest are created. You can then enter Page I of 8Project: Cloud Storage - Part 2 Page 1 of 8 interactions in the usual way. In addition to the source files, you may create an optional JUnit test file for each class and write one or more test methods to ensure the classes and methods meet the specifications. You should create a jGRASP project upfront and then add the new source and optional test files as they are created._All of your files should be in a single folder CloudStorage.java Requirements and Design: In addition to the specifications in Part 1. the CloudStorage class should implement the Comparable interface for CloudStorage, which means the following method must be implemented in CloudStorage. o compareTo: Takes a CloudStorage object as a parameter and returns an int indicating the results of comparing the two CloudStorage objects based on their respective name fields ignoring case. . DedicatedCloud, SharedCloud, PublicCloud, and PersonalCloud Requirements and Design: No changes from the specifications in Part 1. . CloudStorageList.java Requirements: The CloudStorageList class provides methods for reading in the data file and generating reports. Design: The CloudStorageList class has fields, a constructor, and methods as outlined below. (1) Fields: (1) An array of CloudStorage objects and (2) an array of String clements to hold invalid records read from the data file. [The second array will be used in Part 3.] Note that there are no fields for the number elements in each array. In this project, the size of the array should be the same as the number of CloudStorage objects in the array. These two fields should be private. 2) Constructor: The constructor has no parameters and initializes the CloudStorage array and String array in the fields to arrays of length 0. (3) Methods: Usually a class provides methods to access and modify each of its instance variables (i.c., getters and setters) along with any other required methods. The methods for CloudStorageList are described below. getCloudStorageArray returns an array of type CloudStorage representing the CloudStorage array field. get InvalidRecordsArray returns an array of type String representing the invalid records array field. addCloudstorage has no return value, accepts a CloudStorage object, increases the capacity of the CloudStorage array by one, and adds the CloudStorage object in the last position of the CloudStorage array. See Hints on last page. add InvalidRecord has no return value, accepts a String, increases the capacity of the invalidRecords array by one, and adds the String in the last position of the invalidRecords array. This method will be used in the next project, but it still needs to be tested in this project. See Hints on last page Page 2 of 8Project: Cloud Storage - Part 2 Page 3 of 8 readFile has no return value, accepts the data file name as a String, and throws FileNotFoundException. This method creates a Scanner object to read in the file one line at a time. When a line is read, a separate Scanner object on the line should be created to read the values in that line. The data in each line is separated by a comma so the delimiter should be set to comma by invoking the useDelimiter (", "} method on the Scanner object for the line. For each line read in, the appropriate CloudStorage object is created and added to the CloudStorage array field, or if not a valid category code. the line should be ignored. The data file has comma-delimited text records as follows: category, name, base storage cost, followed by one or more fields specific to the category. Remember, DedicatedCloud, SharedCloud, PublicCloud, and PersonalCloud objects are all CloudStorage objects. The category codes are D for DedicatedCloud, S for SharedCloud, C for PublicCloud, and P for PersonalCloud. Any other category code is invalid. Below are examples data records: D, Cloud One, 40.00, 10.00 S, Cloud Two, 9.0, 12.0, 20.0 s, Cloud Three, 9.0, 25.0,20.0 C, Cloud Four, 9.0, 25. 0,20.0 z, Cloud Zero, 20.0, 15.0, 10.0 P, Cloud Five, 9.0, 21.0,20.0 generateReport processes the CloudStorage array using the original order from the file to produce the Monthly Cloud Storage Report and then returns the report as String. See example result in output for CloudStoragePart2 beginning on page 5. D generateReport ByName sorts the CloudStorage array by its natural ordering, and processes the CloudStorage array to produce the Monthly Cloud Storage Report (by Name), then returns the report as a String. See example result in output for CloudStoragePart2 beginning on page 3. generateReportByMonthlyCost sorts the CloudStorage array by monthly cost. and processes the CloudStorage array to produce the Monthly Cloud Storage Report (by Monthly Cost) and then returns the report as String. See example result in output for CloudStoragePart2 beginning on page 5. Code and Test: See examples of file reading and sorting (using Arrays.sort) in the class notes. The natural sorting order is based on a cloud storage object's name and is determined by the compare To method when the Comparable interface is implemented. The following call to Arrays. sort can be used to sort the CloudStorage array in generateReport ByName above. Arrays. sort (getCloudStoragesArray (] ] ; The sorting order based on a cloud storage monthly cost is determined by the MonthlyCostComparator class which implements the Comparator interface (described below). Arrays. sort (getCloudStorageArray (), new MonthlyCostComparator () ) ; If you have an optional test file with test methods for the generate reports methods above, you may want to use the following assertion to avoid having to match the return result exactly (where Page 3 of 8Project: Cloud Storage - Part 2 Page 4 of 8 the expected_result is part of what you think it should contain and the actual_result is the result of the method call. Assert . assertTrue (actual_result. contains (expected_result) ) ; Monthly Cost Comparator.java Requirements and Design: The MonthlyCost Comparator class implements the Comparator interface for CloudStorage objects. Hence, it implements the method compare (CloudStorage cl, CloudStorage c2) that defines the ordering from highest to lowest based on the cloud storage monthly cost. See examples in class notes. CloudStoragePart2.java Requirements: The CloudStoragePart2 class contains the main method for running the program. Design: The CloudStoragePart2 class is the driver class and has a main method described below. o main accepts a file name as a command line argument, creates a CloudStorageList object, and then invokes its methods to read the file and process the cloud storage records and then to generate and print the three reports as shown in the example output beginning on page 5. If no command line argument is provided, the program should indicate this and end as shown in the first example output on page 5. An example data file can be downloaded from the assignment page in Canvas. Code and Test: If you have an optional test file for the CloudStoragePart2 class, you should have at least two test methods for the main method. One test method should invoke CloudStoragePart2.main(args) where args is an empty String array, and the other test method should invoke CloudStoragePart2 main(args) where args[0] is the String representing the data file name. Depending on how you implemented the main method, these two methods should cover the code in main. As for the assertion in the test method, since COST_FACTOR is a public class variable in SharedCloud, you could assert that SharedCloud. COST_FACTOR equals 1 . 0 in each test method In the first test method, you can invoke main with no command line argument as follows: // If you are checking for args. length -= 0 // in CloudstoragePart2, the following should exercise // the code for true. String argsi - {); // an empty String[ ] CloudStoragePart2.main (args1) ; In the second test method, you can invoke main as follows with the file name as the first (and only) command line argument: String args2 - {" cloud_storage_data_1.cav"); Page 4 of 8Project: Cloud Storage - Part 2 Page 5 of 8 // args2(0] is the file name CloudStoragePart2.main (args2) ; If Web-CAT complains the default constructor for CloudStoragePart2 has not been covered, you may want to include the following line of code in one of your test methods to exercise the constructor. // to exercise the default constructor CloudStoragePart2 app - new CloudstoragePart2() ; Notes: 1. Passing in command line arguments in jGRASP - On the top menu, click "Build" then turn on "Run Arguments" by clicking the associated checkbox. Now you can enter the arguments (c.g, the filename) in the Run Arguments text box at the top of the edit window containing the main method. Finally, run or debug the program in the usual way. 2. To run the program with no command line argument, either delete the text entered above. Alternatively, click "Build" then turn off "Run Arguments" by clicking the associated checkbox. Then run or debug the program in the usual way. 3. You can also test your program using your own data files. Example Output when file name is missing as command line argument ---jGRASP exec: java CloudStoragePart2 File name expected as command line argument. Program ending. --jGRASP: operation complete. Example Output for cloud storage_data_I.csy ---jGRASP exec: java CloudStoragePart2 cloud_storage_data_1.cav Monthly Cloud Storage Report Cloud One (class DedicatedCloud) Monthly Cost: $50.00 Base Storage Cost: $40.00 Server Cost! $10.00 Cloud Two (class SharedCloud) Monthly Cost: $9.00 Base Storage Cost: $9.00 Data Stored: 12.000 GB Data Limit: 20.000 GB Overage: 0.000 GB Cost Factor: 1.0 Page 5 of 8Project: Cloud Storage - Part 2 Page 6 of 8 Cloud Three (class SharedCloud) Monthly Cost: $14.00 Base Storage Cost: $9.00 Data Stored: 25.000 GB Data Limit: 20.000 GB Overage: 5.000 GB Cost Factor: 1.0 Cloud Four (class PublicCloud) Monthly Cost: $19.00 Base Storage Cost: $9.00 Data Stored: 25.000 GB Data Limit: 20.000 GB Overage: 5.000 GB Cost Factor: 2.0 Cloud Five (class PersonalCloud) Monthly Cost: $12.00 Base Storage Cost: $9.00 Data Stored: 21.000 GB Data Limit: 20.000 GB Overage: 1.000 GB Cost Factor: 3.0 Monthly Cloud Storage Report (by Name) Cloud Five (class PersonalCloud) Monthly Cost: $12.00 Base Storage Cost: $9.00 Data Stored: 21.000 GB Data Limit: 20.000 GB Overage: 1.000 GB Cost Factor: 3.0 Cloud Four (class PublicCloud) Monthly Cost: $19.00 Base Storage Cost: $9.00 Data Stored: 25.000 GB Data Limit: 20.000 GB Overage: 5.000 GB Cost Factor: 2.0 Cloud One (class DedicatedCloud) Monthly Cost: $50.00 Base Storage Cost: $40.00 Server Cost! $10.00 Cloud Three (class SharedCloud) Monthly Cost: $14.00 Base Storage Cost: $9.00 Data Stored: 25.000 GB Data Limit: 20.000 GB Overage: 5.000 GB Cost Factor: 1.0 Cloud Two (class SharedCloud) Monthly Cost: $9.00 Base Storage Cost: $9.00 Data Stored: 12.000 GB Data Limit: 20.000 GB Page 6 of 8Project: Cloud Storage - Part 2 Page 7 of 8 Overage: 0. 000 GB Cost Factor: 1.0 Monthly Cloud Storage Report (by Monthly Cost ) Cloud One (class DedicatedCloud) Monthly Cost: $50.00 Base Storage Cost: $40.00 Server Cost: $10.00 Cloud Four (class PublicCloud) Monthly Cost: $19.00 Base Storage Cost: $9.00 Data Stored: 25.000 GB Data Limit: 20.000 GB Overage: 5. 000 GB Cost Factor: 2.0 Cloud Three (class SharedCloud) Monthly Cost: $14.00 Base Storage Cost: $9.00 Data Stored: 25.000 GB Data Limit: 20.000 GB Overage: 5. 000 GB Cost Factor: 1.0 Cloud Five (class PersonalCloud) Monthly Cost: $12.00 Base Storage Cost: $9.00 Data Stored: 21.000 GB Data Limit: 20.000 GB Overage: 1:000 GB Cost Factor: 3.0 Cloud Two (class SharedCloud) Monthly Cost: $9.00 Base Storage Cost: $9.00 Data Stored: 12.000 GB Data Limit: 20.000 GB Overage: 0.000 GB Cost Factor: 1.0 ---jGRASP: operation complete. Page 7 of 8Project: Cloud Storage - Part 2 Page 8 of 8 Hints 1. Adding an element to a full array in your add CloudStorage and addInvalid Record methods - Consider the example below where MyType myAmay is an instance field and addElement is an instance method that adds new Element to myArray, which is full. Since the length of an array cannot be changed after it has been created, myAway must be replaced with one that has a length of myArray.length + I and then elements from the original array must be copied to the new array. This copy operation could be done using a loop. However, Java util. Arrays provides a copyOf method, which creates the new array and performs the copy in a single statement as shown in the first statement in the method below. The second statement adds new Element as the last clement in the array. public void addElement (MyType newElement) { myArray = Arrays. copyOf (myArray, myArray . length + 1); myArray [ myArray . length = 1] = newElement; 2. The advantage to keeping the array full is that it allows the use of for-each loops with the array. for (MyType mt : myArray) // do something with each mt 3. In the readFile method, if you use a switch statement to determine the category, you should use type char for the switch expression rather than String, that is, each of the case labels should be of type char (c.g., case 'D' : rather than type String (e.g., case "D": ). When the switch type is String, the code coverage tool used by Web-CAT fails to detect that the default case is covered. If category is the reference to the String that contains the category code, then the following statement returns the category code as type char. category . charAt (0) Page 8 of 8