Need Help With Project

edited March 2018 in How To...

this is for a class project ,

You will be writing a program to place a Spring/Easter order. A Lindt chocolate bunny (3.5oz) is $4.00, chocolate Easter eggs (88 pieces) are $5.99 and Peeps (Yellow Chick 15 count) is $2.99. These prices should be declared as constants. Likewise, Suffolk County Sales Tax should also be a constant (8.625%)

You will be creating a function for the calculation of the cost (item quantity and cost). As per the traffic light classwork, only one light was on at a time. You can use this mechanism to “place” the orders. Quantity is randomly generated between the values of 1 to 7.

can someone help me?

Answers

  • edited March 2018

    Sure.

    The reference is your friend.

    What is a constant?

    final is for making a constant from a variable :

    https://www.processing.org/reference/final.html

    So start with final float LindtChocolateBunny=4.00; etc.

    Go on with that.

    Quantity

    • Parallel to those constants you need a Quantity for each product and have it filled with random between 1 and 7: .... int(random(1,8));

    Function

    • Write your function calculateCost()

    The Output

    Give it out as a table using text()

    • product | single cost | quantity | cost

    Remark

    • When you are into classes you could make a class Order with product, quantity, cost
  • Break the task down into steps

    Write a code section for every step and make progress this way

    Show your attempt as code

Sign In or Register to comment.