hi,
I don't think a code like this would need to be modular, I suppose it could be a module in an entire program.
I'm also a bit hesitant, seeing as i've only been programming for around two years, but i think your pseudo code is wrong... or maybe its just what i have been taught, but if i was going to display that pseudo code it would go something like this,
ok, i'm not sure what you have been taught but you should stick to that, but if you look at the way I have set out the pseudo code you should see that I input all of the data first, and then display the relevant information. i also use print instead of display, but this once again is down to your school of programming.
the reason i did this pseudo code the way i did is because i program in php, and so i would have previously captured all of the variables
if you have a wamp server(http://lmgtfy.com/?q=wamp) you can run process below as long as the two files are in the same folder in your server
save this file as : process.php
save this file as : employee_form.php
I don't think a code like this would need to be modular, I suppose it could be a module in an entire program.
I'm also a bit hesitant, seeing as i've only been programming for around two years, but i think your pseudo code is wrong... or maybe its just what i have been taught, but if i was going to display that pseudo code it would go something like this,
Code:
START
SET employeeName = Matthew Robinson
SET hoursWorked = 40
SET hourlyPay = 10
PRINT “Employee Pay Calculator”
PRINT “Simply input required info to calculate employee pay.”
PRINT“What is employee’s name?”
INPUT employeeName
PRINT“What are his/her total hours worked?”
INPUT hoursWorked
PRINT“What is employee hourly rate?”
INPUT hourlyPay
PRINT “Employee gross pay is:”
PRINT "hoursWorked * hourlyPay"
PRINT “Program Complete.”
END
the reason i did this pseudo code the way i did is because i program in php, and so i would have previously captured all of the variables
if you have a wamp server(http://lmgtfy.com/?q=wamp) you can run process below as long as the two files are in the same folder in your server
save this file as : process.php
PHP:
<?php
//[email protected] Creator (^_^)
if (!isset($_POST['name']))
{
echo"Employee pay calculator</br> Simply input required info to calculate employee pay";
require('employee_form.php');
}
else
{
echo"Employee pay calculator</br> Simply input required info to calculate employee pay";
require('employee_form.php');
$name = $_POST['name'];
$hours = $_POST['hours'];
$pay = $_POST['pay'];
$earn = "$hours" * "$pay";
echo"$name worked for $hours for $pay an hour, and so should earn $$earn";
}
?>
save this file as : employee_form.php
PHP:
<form name="form1" method="post" action="process.php">
<table width="0" border="0">
<tr>
<td>Employee's Name</td>
<td><label>
<input type="text" name="name" id="name">
</label></td>
</tr>
<tr>
<td>Hours Worked</td>
<td><label>
<input type="text" name="hours" id="hours">
</label></td>
</tr>
<tr>
<td>Employee's pay</td>
<td><label>
<input type="text" name="pay" id="pay">
</label></td>
</tr>
<tr>
<td> </td>
<td><label>
<input type="submit" name="submit" id="submit" value="Calculate!">
</label></td>
</tr>
</table>
</form>