All project descriptions are out of date. updated: 10/8/20
Write a program that is composed of three classes: Dodecahedron, DodecahedronList, and DodecahedronListMenuApp. DodecahedronListMenuApp presents a menu to the user with eight options and implements them. The program needs to read input from a file (which creates a DodecahedronList object), print report, print summary, add a Dodecahedron object to the DodecahedronList object, delete a Dodecahedron object from the DodecahedronList object, find a Dodecahedron object in the DodecahedronList object, Edit a Dodecahedron in the DodecahedronList object, and quit the program.
Dowloads are still boken :(
Assuming that you successfully created this class in Project 4, just copy the file to your new Project 6 folder and go on to DodecahedronList.java
Assuming that you successfully created this class in Project 5, just copy DodecahedronList.java to your new Project 6 folder. DodecahedronList is extended from Project 5 by adding six new methods.
Remember to import java.util.ArrayList, java.util.Scanner, java.io.File, java.io.IOException.
Create a DodecahedronListMenuApp class with a main method that presents the user with a menu with eight options. read input from a file, print report, print summary, add a Dodecahedron object to the DodecahedronList object, delete a Dodecahedron object from the DodecahedronList object, find a Dodecahedron object in the DodecahedronList object, Edit a Dodecahedron in the DodecahedronList object, and quit the program
The main method should print a list of options with the action code and a short description followed by a line with just the action codes prompting the user to select an action. After the user enters an action code, the action is performed. Then the line with just the action codes prompting the user to select an action is printed again to accept the next code. The user may continue to perform actions until ‘Q’ is entered to quit the program. Your program should accept both uppercase and lowercase action codes.
Place Holder.
The objective is to modify your Project 6 to use arrays instead of ArrayList objects. Write a program that is composed of three classes: Dodecahedron, DodecahedronList2, and DodecahedronList2MenuApp. DodecahedronListMenuApp presents a menu to the user with eight options and implements them. the program needs to read input from a file (which creates a DodecahedronList object), print report, print summary, add a Dodecahedron object to the DodecahedronList object, delete a Dodecahedron object from the DodecahedronList object, find a Dodecahedron object in the DodecahedronList object, Edit a Dodecahedron in the DodecahedronList object, and quit the program.
Assuming that you successfully created this class in Project 4, 5, or 6 just copy the file to your new Project 8 folder and go on to DodecahedronList2.java
You must use arrays instead of ArrayList objects. Assuming that you successfully created this class in Project 6, just copy DodecahedronList.java to your new Project 8 folder and then open in jGRASP and rename as DodecahedronList2.
Create a DodecahedronList2 class that stores the name of the list and an array of Dodecahedron objects. It includes methods that return the name of the list, number of Dodecahedron objects in the DodecahedronList2, total surface area, total volume, average surface area, average volume, and average surface to volume ratio for all Dodecahedron objects in the DodecahedronList2. The toString method returns a String containing the name of the list followed by each Dodecahedron in the array, and a summaryInfo method returns summary information about the list.
The DodecahedronList2 class has three fields, a constructor, and methods as outlined below
Create a DodecahedronList2MenuApp class with a main method that presents the user with a menu with eight options. read input from a file, print report, print summary, add a Dodecahedron object to the DodecahedronList object, delete a Dodecahedron object from the DodecahedronList object, find a Dodecahedron object in the DodecahedronList object, Edit a Dodecahedron in the DodecahedronList object, and quit the program
The main method should print a list of options with the action code and a short description followed by a line with just the action codes prompting the user to select an action. After the user enters an action code, the action is performed. Then the line with just the action codes prompting the user to select an action is printed again to accept the next code. The user may continue to perform actions until ‘Q’ is entered to quit the program. Your program should accept both uppercase and lowercase action codes.
So for this project we are tasked with replacing ArrayList with Arrays. The only two classes that we will edit from project 6 are DodeacahedronList and DodecahedronListMenuApp. First you need to rename the classes to DodeacahedronList2 and DodecahedronList2MenuApp. Then you need to change the names of all of the thinks that reference the class from project 6. I found the best way to do this is to compile it as is with the class name changes and look at the compile errors. After you fix the most of the compile time errors you need to start changing the ArrayList variables to Arrays. This is not all to hard because the syntax for arrays is fairly simple.
// for example I changed the ArrayList at the begining of the DodecahedronList2.java
ArrayList<Dodecahedron> dodObjList;
// to
Dodecahedron[] dodObjList;
Continue this until you change all of the ArrayList objects to Arrays, then compile it. For the readFile method its simple if you know why you are doing it. So we are returning the constructor for the class we are writing in. So we need to create a listName, a list, and the number of objects in the array. We need to delare all of the variables we will use at the top and then we will create a while loop that goes through the file and asigns the label, color, and edge to the varaibales we created using the Scanner class. Then we will create an object of type Dodecahedron and fill in its respective constructor. Then we should assign that object to the list you created at the begining of the file.
Dodecahedron object = new Dodecahedron(label, color, edge);
objectList[arraySize] = object;
Then we need to increment the arraySize variable and to end our while loop simply add a " } ", the loop should terminate when it runs out of lines to parse. Now we need to fill out the constructor of the class and then return that object. For the deleteDodecahedron method I highly recomend looking at the example files, they are extreamly helpfull in writing this method. The goal for the method is to delete and return an object found in an array. So first we declare a null object to eventually copy the found object in the array. Then we must itterate though the array until we find the desired object, or use the findDodecahedron method you should have made earlier in the class. Copy the object to the copy variable you created earlier and set them equal, now you need to delete the object from the array. This can be done by overwriting the folowing objects in a index below them. Dont forget to set the final object to null or you will have two of the same object in the array. Now your object should be 'deleted' from the array, now make sure decriment the size variable that you should have created at the begining of the class, and return the copied object. For the editDodecahedron method I have a for loop that goes through the list, this can also be done by using the findDodecahedron method and checking if its label is equal to the input label. Then I created a statment that checks the label name and if thats true it edits the object by calling the setColor and seEdge methods and returning true, else returning false.