TestItem.java - By Cole Hudson Date Purpose Use different...

Info icon This preview shows pages 1–2. Sign up to view the full content.

/* * By Cole Hudson * Date: 4/12/2015 * Purpose: Use different sorting algorithms on various hardware items * * PMR in README.txt */ public class TestItem { public static void main(String[] args) { //array of items Item[] hardware = { new Item("1011", "Air Filters", 200, 10.5), new Item("1034", "Door Knobs", 60, 21.5), new Item("1101", "Hammers", 90, 9.99), new Item("1600", "Levels", 80, 19.99), new Item("1500", "Ceiling Fans", 100, 59), new Item("1201", "Wrench Sets", 55, 80), }; //original System.out.println("Original Array: \n"); printInventory(hardware); System.out.println(); //sort by id - merge System.out.println("Sorted by ID: \n"); sortID(hardware, 0, hardware.length - 1, 1); printInventory(hardware); System.out.println(); //sort by name - insertion System.out.println("Sorted by Name: \n"); sortName(hardware, 1); printInventory(hardware); System.out.println(); //sort by number in store - selection System.out.println("Sorted by inStore: \n"); sortInStore(hardware, 1); printInventory(hardware); System.out.println(); //sort by price - merge System.out.println("Sorted by Price: \n"); sortPrice(hardware, 0, hardware.length - 1, 1); printInventory(hardware); } //print inventory
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Image of page 2
This is the end of the preview. Sign up to access the rest of the document.
  • Fall '15
  • item, posmax

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern