Analysis Section:

Analysis Section:

  1. Receive the input from the user
  2. Calculate the tip amount
  3. Calculate total cost
  4. Display the results

Input:

            Bill Amount       (float: > 0.00)

Tip Percent       (integer: > 0)

Output:

            Total Cost         (float: > 0.00)

Input

Processes

Output

Name:   BillAmount

Type:    float

Range:  > 0.00

 

Name:   TipPercent

Type:    Integer

Range:  > 0

1. InputData

 

 

Name:   BillAmount

Type:    float

Range:  > 0.00

 

Name:   TipPercent

Type:    Integer

Range:  > 0

Name:   TotalCost

Type:    float

Range:  > 0.00

2. CalculateCost

 

 

Name:   Totalcost

Type:    float

Range:  > 0.00

Name:     TotalCost

Type:    float

Range:  > 0.00

3.DisplayResults

 

 

Name:   Totalcost (Display)

Type:    float

Range:  > 0.00

 

 

 

 

 

 

 

Design:

Main Module

Declare BillAmount as float

Declare TipPercent as integer

 

Call InputData

Call CalculateCost

Call DisplayResults

End Main Module

 

InputData

Write, “What is the amount of your bill?”

Input BillAmount

 

Write, “What percent will you be leaving as a tip?”

Input TipPercent

End InputData

 

CalculateCost

TotalCost = BillAmount * (TipPercent / 100)

End CalculateCost

 

DisplayResults

Display “The total cost including tip is $” TotalCost

End DisplayResults

 

Leave a Reply