Coin Dates

Coin Dates preview image

1 collaborator

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.1.0 • Viewed 172 times • Downloaded 22 times • Run 0 times
Download the 'Coin Dates' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

globals [ change-amount ]

to go 
  clear-all
  make-change-amount
  count-out-change   
end 

; this procedure generates a random "change" amount  

to make-change-amount
  set change-amount random 100
  set change-amount change-amount * 0.01
  print "Change amount is " show change-amount
end 

; this procedure subtracts out the "coins" 

to count-out-change
   while [ change-amount >= .25 ]
   [
     select-date-quarter
   ]
   while [ change-amount >= .10 ]
   [
     select-date-dime
   ]
   while [ change-amount >= .05 ]
   [
     select-date-nickel
   ]
   while [ change-amount >= .009 ] ;  0.009 (not .01) is use to help with rounding errors
   [
     select-date-cent
   ]
   if change-amount > 0
   [
     set change-amount 0
   ]
end 

to select-date-quarter
  ;1916-2013 is the date range we want
  let date 1916
  set date date + random 98
  type date print " quarter"
  set change-amount change-amount - .25 
end 

to select-date-dime
  ;1916-2013 is the date range we want
  let date 1916
  set date date + random 98
  type date print " dime" 
  set change-amount change-amount - .10
end 

to select-date-nickel
  ;1913-2013 is the date range we want
  let date 1913
  set date date + random 101
  type date print " nickel"  
  set change-amount change-amount - .05
end 

to select-date-cent
   ;1909-2013 is the date range we want  
  let date 1909
  set date date + random 105
  type date print " cent" 
  set change-amount change-amount - .01
end 

There is only one version of this model, created over 9 years ago by Creighton Edington.

Attached files

File Type Description Last updated
Coin Dates.png preview Preview for 'Coin Dates' over 9 years ago, by Creighton Edington Download

This model does not have any ancestors.

This model does not have any descendants.