Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Help me figure out this pseudocode!!

pewee1988pewee1988 Member Posts: 1
You are the owner of a vegetarian pizzeria and you want to write a program to allow the customer to order only ONE pizza online. You will prompt the customer for his/her name, pizza size being order (small, medium, or large), and pizza type being ordered (veggie or cheese), and then input this data. You are to output the customer name, pizza size, pizza type, and cost of pizza back to the customer. For a veggie pizza, small costs $10, medium costs $12.25, and large costs $14.50. For a cheese pizza, small costs $7, medium costs $8, and large costs $9. Be sure to validate the size and type of pizza, and if the data is invalid, output an appropriate message to the customer.

I don't understand how to write this as a pseudocode. This is not my homework. This is an extra problem I'm trying to do on my own to understand how to do other kind of pesudocode's problems.

Comments

  • schmiley397schmiley397 Member Posts: 3
    Doesn't sound very pseudocodable! Pseudocode is intended for describing algorithms, not really form-filling. Especially not html. But I guess you could write something like :

    [code]Begin
    name <- prompt('Your name : ')
    size <- prompt('Size (s/m/l) : ')
    type <- prompt('Type (v/c) : ')

    if (size equals 's') then
    if (type equals 'v') then cost <- 10
    else cost <- 7
    end
    if (size equals 'm') then
    if (type equals 'v') then cost <- 12.25
    else cost <- 8
    end
    if (size equals 'l') then
    if (type equals 'v') then cost <- 14.50
    else cost <- 9
    end

    display(name)
    display(size)
    display(type)
    display(cost)

    ok <- prompt('is this okay (y/n)?')
    if (ok equals 'y') validate(size, type)
    end[/code]

    This is without handling invalid data. But again, it's not a very pseudocode like program.
Sign In or Register to comment.