Geeks With Blogs
Melanie Draves programming and what not

Before I program solutions, I like to write pseudo-code to plan out the steps that I intend to take!

The following is my plan for the Hospital Charges program

/*

  Pseudo-code
Program: Hospital Charges
Name:  Melanie Draves
Date:  Feb 26 2012

 Narrative Description:
Program will calculate the total cost for a patient's hospital stay.  Calculation variables include:
 number of days of hospital stay
 medication charges incurred
 surgical charges incurred
 lab charges incurred
 physical rehabilitation charges incurred
Program will calculate totals using the following methods:

 CalcStayCharges  = $350 * number of days of hospital stay
 CalcMiscCharges  = medication charges incurred + surgical charges incurred + lab charges incurred + medical rehabilitation charges incurred
 CalcTotalCharges = CalcStayCharges + CalcMiscCharges

 Variables:
Inputs
 numdays -  int
 medchrg -  real
 srgchrg -  real
 labchrg -  real
 rehbchrg - real
Outputs
 totcost -  real
Temps
 staychrg - real
 miscchrg - real


 Pseudo-code:
MAIN
 get inputs
 calc tot's
  staychrg = CalcStayCharges(numdays)
  miscchrg = CalcMiscCharges(medchrg, srgchrg, labchrg, rehbchrg)
  totcost  = CalcTotalCharges()
 display tot's
 HALT
-----
method CalcTotalCharges(real lstaychrg, real lmiscchrg)
ret ltotcost - real
 ltotcost = lstaychrg + lmiscchrg
 return(ltotcost)

-----
method CalcMiscCharges(real lmedchrg, real lsrgchrg, real llabchrg, real lrehbchrg)
ret: lmiscchrg - real
 lmiscchrg = lmedchrg + lsrgchrg + llabchrg + lrehbchrg
 return(lmiscchrg)
 
-----
method CalcStayCharges(int lnumdays)
ret: lstaychrg - real
 lstaychrg = 350 * lnumdays
 return(lstaychrg)

*/v

Posted on Sunday, March 4, 2012 6:30 PM Beginning C# | Back to top


Comments on this post: Hospital Charges program - Pseudo-code

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © MoDraves | Powered by: GeeksWithBlogs.net