0

i have my algorithm but i can't get the flowchart to come out.

Main()

Declare Sticker_Price as Real



Declare Discount_Percent as Real


Declare Tax_Percent as Real
Declare Tag_Color as Character
Declare Answer as Character
Declare Final_Price as Real
Set Tax_ Percent = 0.07
Final_Price = 0.00

Repeat
    Process Get_Price(Sticker_Price)
    Process Discount(Tag_Color, Discount_Percent)
    Process Calc_Final(Sticker_Price, Tax_Percent, Discount_Percent, Final_Price)
    Repeat
        Print "Do you want to enter another item (y,n)"
        Input Answer


        If Answer != 'y' or 'n'
                Print "That letter is invalid"
                End If
        Until Answer == ‘y’ or ‘n’
Until Answer == 'n'
    Print "The total is $" + Final_Price
End

Get_Price(Price as Real&)
    Repeat
        Print "Enter sticker price of item"
        Input Price
        If Price <0.01
            Print "Please enter a price greater than $0.00"
        End if
    Until Price >0.00
Exit



Discount(Tag_Color as Character, Discount_Percent as Real&)


    Repeat


    Print "Enter the first letter of the sales tag color as UPPERCASE (W - B - O - R)"
    Input Tag_Color
    Case of Tag_Color:
        = 'W':
            Discount_Percent = 0.00
        = 'B':
            Discount_Percent = 0.25
        = 'O':


                Discount_Percent = 0.50
            = 'R':
                Discount_Percent = 0.75
            Otherwise
                Print "That is a invalid tag color"
                Discount_Percent = -1
        End of Case
    Until Discount_Percent != -1
Exit

Calc_Final(Sticker_Price as Real, Tax_Percent as Real, Discount_Percent as Real, Final_Price as Real&)
    Declare Item_Price as Real
    Declare Discount_Amount as Real
    Declare Tax_Amount as Real
    Discount_Amount = Sticker_Price * Discount_Percent
    Tax_Amount = Sticker_Price * Tax_Percent
    Discount_Price = Sticker_Price - Discount_Amount
    Item_Price = Discount_Price + Tax_Amount
    Print "The Item price is $" + Item_Price + "that is with $" + Tax_Amount + "and a $" +
    Discount_Amount + "Discount"
Final_Price = Final_Price + Item_Price
Exit

Edited by pyTony: Formatting, forum change

4
Contributors
4
Replies
28
Views
2 Years
Discussion Span
Last Post by patrick.sylvester.90
0

i have my algorithm but i can't get the flowchart to come out.

What does that mean? Are you using a program to create a flow chart for you?

Anyway, here are my observations...

1) Line 15, shouldn't it be Set Final_Price = 0.00?
2) Lines 18, 19, and 20, do you really expect to pass variable by references? It is uncommon practice in this case for what you are dong (common practice: prefer a returned value from the function instead).

Edited by Taywin

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.