Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Q8
- public static double TotalPrice(Node<Flower> flwrs)
- {
- double sum = 0;
- while (flwrs != null)
- {
- sum = sum + flwrs.GetInfo().Price;
- flwrs = flwrs.GetNext();
- }
- return sum;
- }
- //Q9
- public static Flower HighestFlower(Node<Stack<Flower>> flwrs)
- {
- double max = 0;
- Stack<Flower> temp;
- double prc = 0;
- Flower big = new Flower("temp", "temp", 0);
- Flower tempflower;
- while (flwrs != null)
- {
- temp = flwrs.GetInfo();
- max = temp.Top().Price;
- while (temp.IsEmpty() == false)
- {
- tempflower = temp.Pop();
- prc = tempflower.Price;
- if (prc > max)
- {
- max = prc;
- big = tempflower;
- }
- }
- flwrs = flwrs.GetNext();
- }
- return big;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement