Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Including some feedback #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Binary file added Andrew Fralinger Lab 2/.DS_Store
Binary file not shown.
31 changes: 31 additions & 0 deletions Andrew Fralinger Lab 2/PayCalculator/Web.Debug.config
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>

<!-- For more information on using web.config transformation visit https://go.microsoft.com/fwlink/?LinkId=125889 -->

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<!--
In the example below, the "SetAttributes" transform will change the value of
"connectionString" to use "ReleaseSQLServer" only when the "Match" locator
finds an attribute "name" that has a value of "MyDB".

<connectionStrings>
<add name="MyDB"
connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
-->
<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
<!--
In the example below, the "Replace" transform will replace the entire
<customErrors> section of your web.config file.
Note that because there is only one customErrors section under the
<system.web> node, there is no need to use the "xdt:Locator" attribute.

<customErrors defaultRedirect="GenericError.htm"
mode="RemoteOnly" xdt:Transform="Replace">
<error statusCode="500" redirect="InternalError.htm"/>
</customErrors>
-->
</system.web>
</configuration>
15 changes: 15 additions & 0 deletions Andrew Fralinger Lab 2/PayCalculator/Web.config
@@ -0,0 +1,15 @@
<?xml version="1.0"?>

<!--
For more information on how to configure your ASP.NET application, please visit
https://go.microsoft.com/fwlink/?LinkId=169433
-->

<configuration>

<system.web>
<compilation debug="true" targetFramework="4.5.2" />
<httpRuntime targetFramework="4.5.2" />
</system.web>

</configuration>
50 changes: 50 additions & 0 deletions Andrew Fralinger Lab 2/PayCalculator/calculate_pay.js
@@ -0,0 +1,50 @@
var $ = function (id) {
return document.getElementById(id);
}

var calculatePay = function () {
var myHours = $("hours").value;
var myRate = $("rate").value;
var myTax;
var mySalary = 0; //Must be set to 0, or a logic error occurs below
// You didn't parse myHours to a number so isNan will always be fall becasue it's a string if blank.
if (isNaN(myHours) || myHours <= 0 || myHours > 160) {
$("hourError").hidden = false;
}
else if (isNaN(myRate) || myRate <= 0) {
$("rateError").hidden = false;
}
else {
$("hourError").hidden;
$("rateError").hidden;
for (var x = 0; x < 26; x++) {
mySalary += (myHours * myRate); //If mySalary is not set to 0, I think this will trigger the logic error that bugged my program.
}
if (mySalary < 8700) {
myTax = 10;
}
else if (mySalary >= 8700 && mySalary < 35350) {
myTax = 15;
}
else if (mySalary >= 35350 && mySalary < 85650) {
myTax = 25;
}
else if (mySalary >= 85650 && mySalary < 178650) {
myTax = 28;
}
else if (mySalary >= 178650 && mySalary < 388350) {
myTax = 33;
}
else if (mySalary >= 388350) {
myTax = 35;
}
//$("salary").value = parseFloat(mySalary); Used for debugging a logic error that was found.
$("gross").value = parseFloat((myHours * myRate)).toFixed(2);
$("net").value = parseFloat((myHours * myRate)-(myHours * myRate * myTax / 100)).toFixed(2);
}
}

window.onload = function () {
$("hours").focus();
$("calculate").onclick = calculatePay;
}
24 changes: 24 additions & 0 deletions Andrew Fralinger Lab 2/PayCalculator/index.html
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Bi-Weekly Pay Calculator</title>
<link rel="stylesheet" href="styles.css">
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<script src="calculate_pay.js"></script>
</head>
<body>
<h1>Welcome to Andrew's Bi-Weekly Pay Calculator!</h1>
<br />
<label>Hours Worked in this 2 week period: </label>
<input type="text" id="hours" /> <label id="hourError" hidden>Your Hours must be numerical and between 0 and 161.</label><br /><br />
<label>Your Hourly Rate: </label>
<input type="text" id="rate" /> <label id="rateError" hidden>Your Rate must be numerical and greater than $0.</label><br /><br />
<label>Your Gross Pay: </label>
<input type="text" id="gross" disabled="disabled" /><br /><br />
<label>Your Net Pay: </label>
<input type="text" id="net" disabled="disabled" /><br /><br />
<input type="button" id="calculate" value="Calculate Gross and Net Pay" />
<!--<input type="text" disabled="disabled" id="salary" />Used for debugging. Salary was registering as NaN.-->
</body>
</html>
4 changes: 4 additions & 0 deletions Andrew Fralinger Lab 2/PayCalculator/packages.config
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Net.Compilers" version="1.3.2" targetFramework="net452" developmentDependency="true" />
</packages>
Binary file added Andrew Fralinger Lab 2/lab 2 starts/.DS_Store
Binary file not shown.
@@ -0,0 +1,6 @@
{
"ExpandedNodes": [
""
],
"PreviewInSolutionExplorer": false
}