Re: Tutorial of sorts

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

Hi
I like Irv's idea of programming problems as a way of teaching
Euphoria.

Here's my attempt at his first problem:
--Euphoria code starts:
--This is a version of PAY.ex
sequence cmd, name, temp
atom taxrate, hours, payrate, takehome, gross, tax

include get.e

cmd=command_line()

name=cmd[3]
temp=value(cmd[4]) hours=temp[2]
temp=value(cmd[5]) payrate=temp[2]

taxrate=0.25

gross=hours*payrate
tax=gross*taxrate
takehome=gross-tax

printf(1, "%9s %12.2f %12.2f %12.2f %12.2f", {name, hours, gross, tax,
takehome})
--Euphoria code ends



> It looks like writing a tutorial is more work than anyone wants
> to do - mainly because it's necessary to teach *programming* along
> with *Euphoria*. So here's an alternative that makes it easier on
> everybody, since anyone on this list can help when and if they want:
>
> Assignment 1;
> Write a program that takes input at the command line as follows:
> C:> ex PAY Jose 40 12.00
> and returns:
> Name         Hours worked       Gross pay     Tax       Net pay
> Jose         40                 480.00        120.00    360.00
> Hints:
> See command_line and printf in your Euphoria docs.
> For simplicity, tax is assumed to be fixed at 25% of gross.
>
> Everyone is welcome to post solutions. Credit will be given for
> clear, concise code, good comments, and use of Euphoria-specific
> language features. Major points will be deducted for programs that
> do not work. A lovely certificate of completion will be awarded at
> the end of the course. That and $1.75 will get you a cup of Starbucks.
>
>

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

Search



Quick Links

User menu

Not signed in.

Misc Menu