Question
Any help is much appreciated! 3 classes with an input file from excel. I'll add a picture of the excel file below. Just let me
Any help is much appreciated! 3 classes with an input file from excel. I'll add a picture of the excel file below. Just let me know if you need anything else!
/** * Driver class that passes in the name of a csv file to UtilityBelt to parse. The csv file is a list of equipments. * The data is then displayed. */ public class Driver { public static void main(String[] args) throws IOException { // When you submit, you should only read in from "InputOfficial.csv". // You may test by using different .csv files, however. UtilityBelt utilityBelt = new UtilityBelt("InputOfficial.csv"); // TODO: test your code here: utilityBelt.writeEquipment("BeltInfo.txt"); utilityBelt.writeStatistics("BeltStats.txt"); // TODO: modify the Input.csv file to allow proper testing of playersFromState() and writePlayers(). Currently, // Input.csv has only equipments from the same state. writePlayers() with two parameters should only write // out information about a subset of equipments, not all equipments. This functionality needs to be tested. } }
/** * A class to represent items stored in Batman's utility belt. Several copies of an item may appear * in the Utility belt (e.g. 5 batarangs), so the Equipment class keeps a count variable tracking * the number of copies of the item. I.e. there would be one equipment object for "batarangs", for * which the count variable would be equal to 5. */ public class Equipment { /** * The name of the items. */ private String name; /** * The number of copies of the item stored in the belt. */ private int count; /** * The total weight of the items. */ private double totalWeight; /** * The total price of the items. */ private double totalPrice; /** * The description of the items. */ private String description; /** * Constructor for Equipment. Takes in information on the Equipment as a comma delimited string, * stores info on name, count, totalWeight, totalPrice, and its description. Note that the name and count * are separated by a comma, not a forward slash. * * @param strg Information about the Equipment in the format: * "name/count,totalWeight,totalPrice,description" * The description will not contain any commas or forward-slashes. * The count is an integer value. */ public Equipment(String strg) { // TODO: complete method } /** * toString override. Gives all information about the Equipment. * * @return All information about the Equipment formatted as (replacing parentheses with member variables): * "Name: (name), Number: (count), Weight: (weight, to 2 decimal places) lbs, Price: $(price, to 2 decimal places) - (description)" * * e.g. * "Name: Batarang, Number: 5, Weight: 3.22 lbs, Price: $700.75 - bat-shaped boomerangs" */ @Override public String toString() { // TODO: complete method } // TODO: create getters... } }
/** * Class that represents Batman's utility belt. Stores the list of all equipment * in the belt and computes statistics about the equipment. * * Reads in equipment information from files and outputs stats to other files. * */ public class UtilityBelt { /** * The list of equipment in the utility belt. * Don't worry about the "protected" for now; this is done to make tests easier. */ protected ArrayList
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started