UCA08 - Algorithm GAUGE Given three products product1 product2 product3,current prices current price1 current price2 current price3 and old prices(old

UCA08 - Algorithm GAUGE Given three products product1...

This preview shows page 1 - 3 out of 3 pages.

Algorithm GAUGE . Given three products ( product1, product2, product3 ) ,current prices ( current price1, current price2, current price3 ) and old prices ( old price1, old price2, old price3 ) for each product. Calculate algebraic difference ( alg_diff) and percentage difference (pc_diff ). The product names are Strings and current and old prices are real numbers. [ Step 1 : Get product names and prices ] Read olive oil, gallon of milk, coffee. [ Step 2 : Calculate algebraic difference] Algebraic difference = Current price - Old price [ Step 3 : Calculate percentage difference] Percentage difference =(Current price - Old price) / old price * 100% [ Step 4 : Print the calculation and other information you want to print ] ITEM PURCHASED: <item> PRICE THIS MONTH: $<current_price> PRICE LAST MONTH: $<old_price> ALGEBRAIC DIFFERENCE: $<alg_diff> PERCENTAGE DIFFERENCE: <pc_diff>% [ Finished ] Exit Step item current_price old_pric e alg_diff pc_diff 1 Olive oil 8.59 8.49 0.10 ? 2
Image of page 1
Image of page 2
Image of page 3

You've reached the end of your free preview.

Want to read all 3 pages?

  • Spring '14
  • $3.30, $4.99, $5.29, $8.59, $8.49

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

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes