not sure what additional information you are asking for itasks for me to copy a cod 4945089

//Not sure what additional information you are asking for? Itasks for me to copy a code for Project7 which I have provided acopy of. I have also provide copies of the codes for the methodsneeded to be included. I also provided Project6b which is what Ineeds to be used as part of the code. Please Advise and thank youfor your assistance. Please help with the followig I will supply copy ofProject6b.java file and copy of the code need for Project 7 tocomplete and will identify them: Goals • More test-driven development. • Learn how to create inherited classes. • Learn how to use multidimensional arrays. Problem The Weight program is limited to those steel shapes (plates androds) where the weight of the steel is calculated by multiplyingthe volume of the shape in cubic feet by the weight of a cubic footof steel (489lbs.). Now that the Weight program is extensible with our transition toobjects in 6b, we can add shapes that cannot be calculated usingtheir volume. There are several shapes (angles, I-beams, columns)that require a table lookup to get the shape’s weight per footwhich can be multiplied by the item’s length to get the item’sweight. To support adding angles to our shipments, we are going to haveto support the angle input which is of the form: L angle-size angle-thickness length Where thickness is expressed as a fraction and length isconsistent with the length dimension we have used in Project 6b(e.g. feet-inches). The angle-size input is of the form: leg-in-inchesxleg-in-inches For example, 2×2, 3×2, or 4×3. For the purposes of this Project,we are only supporting two sizes: • 2×2 1/4 • 3×3 ¼ User Story In addition to plates and rods, allow the user to enter an angleshape as shown below. For example: Enter shape and dimensions: L 2×2 1/4 3-4 Angle weighs 10.633333333333333 Tasks 1. Copy your Project6b project (only after you finish Project6b)to Project7 by right-mouse clicking on Project6b NetBeans andselecting Copy…. 2. In Project7 set TESTIT to true so that test() will run whenyou run Project7. 3. Copy Project7AngleTests.java into the test() method inyourProject7.
COPY OF THIS CODE: // Put this at the end of test() *but before* the return errors; statement. expected_result = 3.19; result = Angle.weightPerFoot(“2×2”, .25 / 12); if (result == expected_result) { System.out.println(“PASSED: Angle.weightPerFoot(“2×2″, .25)”); } else { System.out.println(“FAILED: Angle.weightPerFoot(“2×2″, .25) returned ” + result + ” and not ” + expected_result); ++errors; } item = shipment.addItem(1, “L 2×2 1/4 5-7”); expected_result = 17.81083333333333; result = item.weight(); if (result == expected_result) { System.out.println(“PASSED: Weight of L 2×2 1/4 5-7”); } else { System.out.println(“FAILED: Weight of L 2×2 1/4 5-7 is ” + result + ” and not ” + expected_result); ++errors; } 4. Build and note that the compilation errors are because of themissing Angle object. 5. Create the LookupShape object by copying the CalcShapeobject. a. Change _area element with _weight_per_foot. b. Change area setter method with weightPerFoot and make thenecessary changes to the weight calculation from area * length toweight-per-foot * length. 6. Copy Project7Angle.java from examples into your Project7.javafile. Put the new Angle class in a location in the file that makessense. Hint: Near the Plate and Rod classes.
COPY OF THIS CODE: class Angle extends LookupShape { private static double[][] _table = {{2, 2, .25/12, 3.19}, {3, 3, .25/12, 4.9}}; public static double weightPerFoot(String angleSize, double thick) { double wpf = 0.0; // The parameter angleSize is a string like “2×2”. Convert it into two // doubles for the first side and second side. You are going to use the // to look up the weight per foot. boolean found = false; // Loop through each row in the table to see if there is a row that matches the two sides // and thickness. The first two elements of a row are the two sides. The third element // in the row is the thickness (in feet) and the fourth is the weight to be returned from // this function if there is a match. When you do find a match, do the following: // 1. Set wpf to the fourth element // 2. Set found to true // 3. Break out of the loop because we are done. // Put lookup loop here. if (!found) { throw new IllegalArgumentException(“Angle of ” + angleSize + ” x ” + thick + ” not found”); } return wpf; } Angle(String angleSize, double thick, double length) { double wpf = weightPerFoot(angleSize, thick); super.weightPerFoot(wpf); super.length(length); }} 7. Write the code called out in the comments within the Angleclass. 8. Now run the unit tests. There are two new tests: a. Angle.weightPerFoot – This should pass. b. Weight of L 2×2 1/4 5-7 – should take an error because 2×2 isnot handled as a dimension. 9. Copy Project7ShipmentAddItem.java over the current Shipmentclass’ addItem to handle the 2×2 dimension.
COPY OF THIS CODE: public SteelShape addItem(int quantity, String description) { String[] desc_values = description.split(” “); String angle_size = “”; double[] values = new double[desc_values.length – 1]; String shape_letter = desc_values[0]; int values_index = 0; for (int i = 1; i < desc_values.length; i++) { if (desc_values[i].indexOf(“x”) > 0) { angle_size = desc_values[i]; } else { values[values_index] = getValueInFeet(desc_values[i]); ++values_index; } } SteelShape shape = null; if (shape_letter.equals(“P”)) { if (values.length != 3) { throw new IllegalArgumentException(“Plate needs three dimensions”); } shape = new Plate(values[0], values[1], values[2]); } else if (shape_letter.equals(“R”)) { if (values.length != 2) { throw new IllegalArgumentException(“Rod needs two dimensions”); } shape = new Rod(values[0], values[1]); } else if (shape_letter.equals(“L”)) { if (values.length != 3) { throw new IllegalArgumentException(“Angle needs three dimensions”); } shape = new Angle(angle_size, values[0], values[1]); } else { throw new IllegalArgumentException(“shape letter ‘” + shape_letter + “‘ not recognized”); } _weight += quantity * shape.weight(); return shape; } 10. Run the unit tests again. All should pass. 11. Set TESTIT to false and test interactively with the fourtests below making sure you end the items and see the totalshipment output. Checklist Use the following as guidance for getting a 10 on thisproject: • LookupShape class implemented for weight per foot (as opposedto area). (2 point) • Angle class implemented to calculate weights of angles intable (pass unit tests). (6 points) • Weight program successfully adds Angle items to shipments(pass test data below). (1 point) • Enter in a bad angle size and make sure it doesn’t end theprogram or shipment, outputs an error, and prompts again foranother shape. (1 point) Shape            Size      Thick.orDiameter       Width LengthWeight P                                         1/4                       5-6                     2-3                 126.07   R                                         3/4                                                   5-7                  8.376302    L                  2×2                1/4                                                   3-4                 10.63333    L                  3×3                 ¼                                               4-6                  22.05
This is Project6b.java: package project6b; import java.util.Scanner; class Shipment { private double _weight = 0.0; public double weight() { return _weight; } public static double inFeet(int feet, double inches) { // Return feet and inches in to feet and fractions of afoot.

// For example 5 feet 6 inches returns 5.5 from here.

// Note inches is a double. This is to support 0 feet 3/4 of aninch.

// Return the feet plus the inches divided by 12 here.

double inchesToFeet = inches / 12; return feet + inchesToFeet; } public static double fracInFeet(String frac) { // Take in string like “3/4” and return .0625.

// Use inFeet(feet, inches) to covert to feet.

// This is just like the thickness calculation you did but

// this time you can use inFeet(0, fractionOfAnInch)

// So split frac by a /. Convert the numerator anddenominator

// into inches. Then divide them. Watch out for integerdivide.

String inches[] = frac.split(“/”); double fraction = Double.parseDouble(inches[0]) /Double.parseDouble(inches[1]); return inFeet(0, fraction); } public static double feetAndInchesInFeet(String feetAndInches){ // Take in string like “5-6” and return 5.5.

// Use inFeet(feet, inches) to covert to feet.

// This is similar to the fraction code except you are going

// to split on “-“. You will have feet in the [0] element of

// the array and inches in the [1] element of the array.

// You will need to parse each into an integer.

// Then just return inFeet(feet, inches).

String inches[] = feetAndInches.split(“-“); return inFeet(Integer.parseInt(inches[0]),Double.parseDouble(inches[1])); } public static double getValueInFeet(String s) { double value; // If parameter s has an / in it then it must be a fraction like”3/4″.

// If parameter s has a – in it, then it must be feet and incheslike “5-6”.

// So check the parameter s to see if it contains a / or a -. Todo

// this you will use s.indexOf(). Look up string.indexOf() to seewhat

// you give it.

// Note that for fractions you can use fracInFeet(s) and forthe

// the feet-inches (e.g. 5-6), you can usefeetAndInchesInFeet()

if (s.indexOf(“/”) != -1) { return fracInFeet(s); } else if (s.indexOf(“-“) != -1) { return feetAndInchesInFeet(s); } else { return 0; } } public SteelShape addItem(int quantity, String description){ try { String[] desc_values = description.split(” “); double[] values = new double[desc_values.length – 1]; String shape_letter = desc_values[0]; for (int i = 1; i

+ “‘ not recognized”); } _weight += quantity * shape.weight(); return shape; } catch (Exception e) { System.out.println(“Bad Data provided”); return null; } } } class SteelShape { private double _length = 0.0; private double _weight = 0.0; public void length(double length) { _length = length; } public double length() { return _length; } public void weight(double weight) { _weight = weight; } public double weight() { return 0.0; } } class CalcShape extends SteelShape { private double _area = 0.0; public void area(double area) { _area = area; } @Override public double weight() { return _area * this.length() * 489; } } class Rod extends CalcShape { Rod(double diameter, double length) { double radius = diameter / 2; super.area(Math.PI * Math.pow(radius, 2)); super.length(length); } } class Plate extends CalcShape { Plate(double thick, double width, double length) { super.area(thick * width); super.length(length); } } public class Project6b { static boolean TESTIT = false; private static String[] parseInput(String line) { String[] input_values; input_values = line.split(” “); return input_values; } private static int test() { int errors = 0; double expected_result = 5 + 6 / 12.0; double result = Shipment.inFeet(5, 6); if (result == expected_result) { System.out.println(“PASSED: Shipment.infeet(5, 6)”); } else { System.out.println(“FAILED: Shipment.infeet(5, 6) returned”

+ result + ” and not ” + expected_result); ++errors; } expected_result = (3 / 4.0) / 12.0; result = Shipment.fracInFeet(“3/4”); if (result == expected_result) { System.out.println(“PASSED: Shipment.fracInFeet(“3/4″)”); } else { System.out.println(“FAILED: Shipment.fracInFeet(“3/4”)returned “

+ result + ” and not ” + expected_result); ++errors; } expected_result = 5 + 6 / 12.0; result = Shipment.feetAndInchesInFeet(“5-6”); if (result == expected_result) { System.out.println(“PASSED:Shipment.feetAndInchesInFeet(“5-6″)”); } else { System.out.println(“FAILED:Shipment.feetAndInchesInFeet(“5-6”) returned “

+ result + ” and not ” + expected_result); ++errors; } Shipment shipment = new Shipment(); SteelShape item; item = shipment.addItem(1, “P 1/4 5-6 2-6”); expected_result = 140.078125; result = item.weight(); if (result == expected_result) { System.out.println(“PASSED: Weight of P 1/4 5-6 2-6”); } else { System.out.println(“FAILED: Weight of P 1/4 5-6 2-6 is “

+ result + ” and not ” + expected_result); ++errors; } item = shipment.addItem(1, “R 3/4 5-7”); expected_result = 8.376302092249544; result = item.weight(); if (result == expected_result) { System.out.println(“PASSED: Weight of R 3/4 5-7”); } else { System.out.println(“FAILED: Weight of R 3/4 5-7 is “

+ result + ” and not ” + expected_result); ++errors; } return errors; } public static void main(String[] args) { if (TESTIT) { int errors = test(); System.exit(1); } Scanner input = new Scanner(System.in); String line; String[] values; Shipment shipment = new Shipment(); SteelShape shape; while (true) { System.out.print(“Enter shape and dimensions: “); line = input.nextLine(); if (line.equals(“end”)) { break; } shape = shipment.addItem(1, line); if (shape instanceof Plate) { System.out.println(“Plate weighs ” + shape.weight()); } else if (shape instanceof Rod) { System.out.println(“Rod weighs ” + shape.weight()); } System.out.println(“Total shipment weight: ” +shipment.weight()); } } } Thank you for your assistance. . . .

"Get 15% discount on your first 3 orders with us"
Use the following coupon
FIRST15

Order Now