Jump to content
Foe Clan Structure Final Ownage Elite Presents Foe Quick Links
[ Founder ] Bonesaw Pk, Ilx Ace Ilx [ Leader ] Danny
[ High Council ] Colin
don
Kruck
Polar
TBR
[ Council ] Rob

KIDS WHO CAN JAVASCRIPT THAT WANNA EARN SOME PAYPAL.


Tehh Skiller

Recommended Posts

Tehh Skiller

alright, Im offering $20.00 USD paypal to whoever can 'complete' my homework assignment for my Computer Science class.

I have finished all mywork, except for this fucking peice of shit.

Okanyways, the task; a calculator that can convert binary digits to decimal.

Specifications:

1. Your calculator must work with binary and decimal (normal) numbers.

2. Your calculator must allow 2 numbers to be entered (both in binary or both in decimal).

3. Your calculator must allow the 2 numbers to be subtracted, added and multiplied.

4. When doing a calculation you may display the result in decimal format for simplicity.

5. When entering a ‘binary’ number, you may assume it is 8 bits long. (10101111)

6. There must be no errors in your webpage. (Run-time errors and Syntax errors).

7. Your code must use an Array in the solution of this problem.

8. You must make sure you have covered all the items given in the check list below.

it should look along these lines:

Posted Image

If your good withthis, you can do it in an hour, $20 an hr IS FUCKING GREAT.

anyways, just get back to me on this TOPIC.

If it gets done before friday, i will bump up to $30USD.

thanks.

Link to comment
Tehh Skiller

I can do it in groovy ( which is java ) but javascript is not a part of my balls.

Naw dude, its gotta be in a .txt file, and saved as .HTML to use it. lol

good offer tho sorry

Link to comment

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">


<meta name="keywords" content="decimal, binary, calculator, conversion, number">
<meta name="description" content="Binary / Decimal Converter Calculator">
<title>Binary Decimal Converter Calculator</title>



<script language="JavaScript" type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}

function toggle_visibility(id) {
var e = document.getElementById(id);
if(e.style.display == 'none')
e.style.display = 'block';
else
e.style.display = 'none';
}
//-->
</script>
</head>

<body>

<table width="800" border="0" cellspacing="0" cellpadding="4">
<tr valign="top">
<form name="form1" method="post" action="">
<table border="0" align="center" cellpadding="4" cellspacing="0" class="datatable">
<tr>
<th class="datatable">Type</th>
<th class="datatable">Entry</th>
<th class="datatable">Convert</th>
<th class="datatable">Result</th>
</tr>
<tr>
<td height="60" class="datatable">
<div align="center">Decimal:</div>
</td>
<td height="60" class="datatable">
<input type="text" name="dec" size="12">
</td>
<td height="60" class="datatable">
<input type="button" name="calcdb" value="Decimal -> Binary" onClick="Dec2Bin()">
</td>
<td height="60" class="datatable">
<input type="text" name="dbanswer" size="12">
</td>
</tr>
<tr>
<td height="60" class="datatable">
<div align="center">Binary:</div>
</td>
<td height="60" class="datatable">
<input type="text" name="binary" size="12">
</td>
<td height="60" class="datatable">
<input type="button" name="calcbd" value="Binary -> Decimal" onClick="Bin2Dec()">
</td>
<td height="60" class="datatable">
<input type="text" name="bdanswer" size="12">
</td>
</tr>
<tr>
<td colspan="2" class="datatable"> </td>
<td class="datatable">
<div align="center">
<input type="reset" name="Reset" value="Reset">
</div>
</td>
<td class="datatable"> </td>
</tr>
</table>
<script language="JavaScript">
function Bin2Dec() {
binnum=form1.binary.value;
numlen=binnum.length;
answer=0;
place=numlen-1;
for(x=0; x < numlen; x++){
if(binnum.substr(x, 1) == 1) {
answer = answer + Math.pow(2, place)
}
else if(binnum.substr(x, 1) != 0) {
alert("Not a Binary Number.");
return
}
place--
}
form1.bdanswer.value = answer
}


function Dec2Bin() {
dec = document.form1.dec.value;

if (dec == "")
{

}
else
{scan(dec);};
};

function scan(ok)
{
var chr="1234567890";
count=0;
var ex;
var h;var hasil=0;
for(i=0;i<ok.length;i++)
{ ex=ok.charAt(i);
for(f=0;f<10;f++)
{h=chr.charAt(f);
if(h==ex){hasil=hasil+1;};
};
};
if (hasil != ok.length)
{
alert("Use numbers only ->'1234567890'.");
document.form1.dec.value = "";
}
else{bnr();};
};

function bnr()
{
var dec=new Number(); dec=document.form1.dec.value; i=dec;
var hit="";
while(i >= 1)
{
var m=(i*10)/4;
while(m > 1){m=m-5;};
if(m < 0){i=(i-1)/2;hit+="1";}else{i=i/2;hit+="0";};

};

var b ="";
var bin;
bin=hit.length;
for(a=hit.length;a>=0;a--)
{
b += hit.substring(a-1,a);
};
document.form1.dbanswer.value=b;
if (b.length > 15){alert("the answer is longer than the textbox -> "+b)};
};
</script>
</form>

</body>
</html>

if you like it send to tj_paypal@hotmail.co.uk

Link to comment
Tehh Skiller

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">


<meta name="keywords" content="decimal, binary, calculator, conversion, number">
<meta name="description" content="Binary / Decimal Converter Calculator">
<title>Binary Decimal Converter Calculator</title>



<script language="JavaScript" type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}

function toggle_visibility(id) {
var e = document.getElementById(id);
if(e.style.display == 'none')
e.style.display = 'block';
else
e.style.display = 'none';
}
//-->
</script>
</head>

<body>

<table width="800" border="0" cellspacing="0" cellpadding="4">
<tr valign="top">
<form name="form1" method="post" action="">
<table border="0" align="center" cellpadding="4" cellspacing="0" class="datatable">
<tr>
<th class="datatable">Type</th>
<th class="datatable">Entry</th>
<th class="datatable">Convert</th>
<th class="datatable">Result</th>
</tr>
<tr>
<td height="60" class="datatable">
<div align="center">Decimal:</div>
</td>
<td height="60" class="datatable">
<input type="text" name="dec" size="12">
</td>
<td height="60" class="datatable">
<input type="button" name="calcdb" value="Decimal -> Binary" onClick="Dec2Bin()">
</td>
<td height="60" class="datatable">
<input type="text" name="dbanswer" size="12">
</td>
</tr>
<tr>
<td height="60" class="datatable">
<div align="center">Binary:</div>
</td>
<td height="60" class="datatable">
<input type="text" name="binary" size="12">
</td>
<td height="60" class="datatable">
<input type="button" name="calcbd" value="Binary -> Decimal" onClick="Bin2Dec()">
</td>
<td height="60" class="datatable">
<input type="text" name="bdanswer" size="12">
</td>
</tr>
<tr>
<td colspan="2" class="datatable"> </td>
<td class="datatable">
<div align="center">
<input type="reset" name="Reset" value="Reset">
</div>
</td>
<td class="datatable"> </td>
</tr>
</table>
<script language="JavaScript">
function Bin2Dec() {
binnum=form1.binary.value;
numlen=binnum.length;
answer=0;
place=numlen-1;
for(x=0; x < numlen; x++){
if(binnum.substr(x, 1) == 1) {
answer = answer + Math.pow(2, place)
}
else if(binnum.substr(x, 1) != 0) {
alert("Not a Binary Number.");
return
}
place--
}
form1.bdanswer.value = answer
}


function Dec2Bin() {
dec = document.form1.dec.value;

if (dec == "")
{

}
else
{scan(dec);};
};

function scan(ok)
{
var chr="1234567890";
count=0;
var ex;
var h;var hasil=0;
for(i=0;i<ok.length;i++)
{ ex=ok.charAt(i);
for(f=0;f<10;f++)
{h=chr.charAt(f);
if(h==ex){hasil=hasil+1;};
};
};
if (hasil != ok.length)
{
alert("Use numbers only ->'1234567890'.");
document.form1.dec.value = "";
}
else{bnr();};
};

function bnr()
{
var dec=new Number(); dec=document.form1.dec.value; i=dec;
var hit="";
while(i >= 1)
{
var m=(i*10)/4;
while(m > 1){m=m-5;};
if(m < 0){i=(i-1)/2;hit+="1";}else{i=i/2;hit+="0";};

};

var b ="";
var bin;
bin=hit.length;
for(a=hit.length;a>=0;a--)
{
b += hit.substring(a-1,a);
};
document.form1.dbanswer.value=b;
if (b.length > 15){alert("the answer is longer than the textbox -> "+b)};
};
</script>
</form>

</body>
</html>

if you like it send to tj_paypal@hotmail.co.uk

Its good yes, but its JAVA, not javascript, that will get me an 0. lol

sorry buddy

Link to comment
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members, 0 Anonymous, 0 Guests

    No registered users viewing this page.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.