Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Object oriented analysis and design hw Find a plate with name Rose from a stack

ID: 3786012 • Letter: O

Question

Object oriented analysis and design hw

Find a plate with name Rose from a stack of ten plates

Private stack plates;

Class ind_plate {

     string mark; …  

}

Int i;

While (i <= 10) Do {

      i++;

      Ind_plate iplate;

      Iplate= pop (plates);

      If (iplate.mark == “Rose”)

      System.outr.println(“plate”+ i + has “Rose as its mark”, /n);

   }

After finding the plate/s with “Rose” add a plate with “Mary” as the mark below the Rose Plate.

And add a plate with “Ms” as the mark above the Rose Plate.

Explanation / Answer

Private stack plates;

Class ind_plate {

     string mark; …  

}

stack anotherPlateStack = new stack();

Int i;

While (i <= 10) Do {

      i++;

      Ind_plate iplate;

      Iplate= pop (plates);

      If (iplate.mark == “Rose”) {

      System.outr.println(“plate”+ i + has “Rose as its mark”, /n);

anotherPlateStack.push(new ind_plate("Mary"));

anotherPlateStack.push(lplate);

anotherPlateStack.push(new ind_plate("MS));

}

else

anotherPlateStack.push(lplate);

   }