RE: Army Composition

new topic     » topic index » view thread      » older message » newer message

I'm no good at math (read: really, really bad), so this may be totally 
wrong.  But I like the challenge and I'd like to see the correct code if 
mine isn't it.
[code]
--Rank over Population Problem
--By A. Cassidy Napoli

--For a given population, what is the maximum number of persons at each 
rank?

--Soldiers     no requirements
--Squad Leader commands 20 soldiers
--Lieutenant   commands 10 Squad Leaders
--Captain      commands 10 Lt.s
--General      commands 5  Captains
include get.e
integer population,soldier,leader,lieutenant,captain,general

population = prompt_number("Population Size: ", {})
soldier    = floor(population / 1)

leader     = floor(soldier / 20)
if remainder (leader,20) then leader += 1 end if

lieutenant = floor(leader / 10)
if remainder (lieutenant,10) then lieutenant += 1 end if

captain    = floor(lieutenant / 10)
if remainder (captain,10) then captain += 1 end if

general    = floor(captain / 5)
if remainder (general,5) then general += 1 end if

puts(1, "Population: ")
? (population)

puts(1, "Soldiers: ")
? (soldier)

puts(1, "Squad Leaders: ")
? (leader)

puts(1, "Lieutenants: ")
? (lieutenant)

puts(1, "Captains: ")
? (captain)

puts(1, "Generals: ")
? (general)
[end code]



C. K. Lester wrote:
> I want to know how many a certain population can support.
> 
> If I have 2 million people, how many will be soldiers, how many 
> Generals,
> and how many of each rank in between... You have to build it from the 
> bottom
> up... Maybe there won't be any generals if the population isn't over a
> certain number...
> 
> Don't let the military designations confuse things. This isn't strictly 
> a
> military problem as much as it is a tiered-organization problem.
> 
> Thanks!
> ck
> 
> ----- Original Message -----
> From: <euman at bellsouth.net>
> To: "EUforum" <EUforum at topica.com>
> Sent: Wednesday, October 10, 2001 1:35 PM
> Subject: Re: Army Composition
> 
> 
> > First, how many Generals are there per people in the population?
> >
> > Euman
> > euman at bellsouth.net
> >
> > ----- Original Message -----
> > From: "C. K. Lester" <cklester at yahoo.com>
> > To: "EUforum" <EUforum at topica.com>
> > Sent: Wednesday, October 10, 2001 11:46
> > Subject: Army Composition
> >
> >
> > > For a given population, what is the maximum number of persons at each
> rank?
> > >
> > > Soldiers - no requirements
> > > Squad Leader - commands 20 soldiers
> > > Lt. - commands 10 Squad Leaders
> > > Captain - commands 10 Lt.s
> > > General - commands 5 Captains
> > >
> > > I need a EUPHORIA program to compute these values given a population.
> > >
> > > Who's got one?
> > >
> > > Thanks!
> > > ck
> 
>

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu