Notes On Pseudocode

Submitted By mohaxeneon
Words: 830
Pages: 4

Pseudocode:
Module: Main
Start
Declarations Declare j as a string Declare v as a string Declare G_Total as a float and set it to 0 Declare Bodyfluid_Total as a float and set it to 0 Declare BAC as a float Declare Grams_total as a float Declare BodyFluid as a float Declare number as an integer
Input
Write prompt the user to enter number
Process
Set Grams_total = AlcoholGrams module Set BodyFluid = BodyFluid_100 module Set BAC = Grams_total / BodyFluid
Output
Call Header module Write "Your Blood Alcohol Consumption is:" Write BAC
Call Personal_Info module
Call Status module Write "Would you like to know the status of another person?" Write "Please Press 1 for Yes, or 0 for No" Write number Call Closing module
End
Module: Header
Start
Declaration Declare H as a string
Input
None
Process
None
Output
Write “BAC Calculator” Write “Programmer: Moha Toma” Write “17 September 2013”
End
Module: AlcoholGrams
Start
Declaration Declare Grams_Total as a float and set it to 0 Declare number as an integer and set it to 0 Declare Drink_Number as a float
Input
Write Drink_Number Write number
Process
Set each value of Drink_Number with the corresponding Alcohol_Gram
Set Grams_Total = Grams_Total + Alcohol_Gram
Output
Write the names of the drinks and the numbers corresponding to each one. Write “Please select a type of drink that you had from the list, then press enter.” Write “Press 1 if you had more drinks, and 0 if this is all.” End
Module: BodyFluid_100
Start
Declaration Declare BodyFluid as a float and set it to 0 Declare Personal_BF_Liters as a float Declare Personal_BF_100Liters as a float Declare Age as an integer Declare Gender as an integer Declare Weight as a float
Input
Write Gender Write Age Write Weight
Process
Set the Age and Gender to the corresponding BodyFluid Set Personal_BF = BodyFluid * Weight
Set Personal_BF_Liters = Personal_BF / 2.2046
Set Personal_BF_100Liters = Personal_BF_Liters * 10
Output
Write "Please enter the number of your Gender (1: Male | 2: Female): "
Write "Please enter your Age: "
Write "Please enter your Weight in Pounds: "
Write "Your Personal Body Fluid in Pounds is: "
Write Personal_BF
Write "Your Personal Body Fluid in Liters is: " Write Personal_BF_Liters Write "Your personal body fluid in 100 ml liters is: " Write Personal_BF_100Liters
End
Module: Personal_Info
Start
Declaration Declare AwayFromLegal as a float Declare ToBe_Sober as a float Declare Grams_Drunk as a float Declare Alcohol_Loss as a float
Input
None
Process
Set AwayFromLegal = BAC1 - .1 Set Grams_Drunk = AwayFromLegal * Personal_BF_100Liters Set ToBe_Sober = (Grams_Drunk*60)/12 Set Alcohol_Loss = (Grams_Total*60) / 12
Output
When BAC is greater or equals to .1
Write "You are legaly under the influence to drive (DRUNK!)"
Write BAC
Write "Your BAC is “BAC” and to be under the legal limit, your BAC must be less than .1 grams for every 100 ml liter Body Fluid in your system"
Write AwayFromLegal
Write "Your BAC is "AwayFromLegal" far from being under the legal limit."
Write ToBe_Sober
Write "Your Blood Alcohol Consumption (BAC) will be under the legal limit in: "ToBe_Sober" minutes."
When BAC is less than .1
Write "You are not under the influence, and you can drive (NOT Drunk!)"
Write Alcohol_Loss
Write "Your Blood Alcohol Consumption (BAC) will be equal to zero in: "Alcohol_Loss" minutes."
End
Module: Status
Start
Declaration None
Input
Process
Output
When BAC2 is less than .01 Write "You are Sober and able to take legal decisions." When BAC2 is