473,396 Members | 1,814 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Need: Javascript to solve for X (proportionality)


I need a javascript to solve for X as in the following:

120.85 X
----- = ---
16 24

24 x 120.85 / 16 = X

X = 181.28

Does anyone have such ... or anything like it that I might
play with to do the same ?

= Paul =

Aug 23 '07 #1
7 1377
Paul J. Dudley wrote on 23 aug 2007 in comp.lang.javascript:
>
I need a javascript to solve for X as in the following:

120.85 X
----- = ---
16 24

24 x 120.85 / 16 = X

X = 181.28

Does anyone have such ... or anything like it that I might
play with to do the same ?
Why would you "need" that?
A school assignment?
What code dit you make sofar?
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Aug 23 '07 #2
Paul J. Dudley wrote:
I need a javascript to solve for X as in the following:

120.85 X
----- = ---
16 24

24 x 120.85 / 16 = X

X = 181.28

Does anyone have such ... or anything like it that I might
play with to do the same ?
Wrong newsgroup, try alt.school.homework-help.
PointedEars
Aug 23 '07 #3
On Thu, 23 Aug 2007 19:37:12 +0000, Evertjan. wrote:
Paul J. Dudley wrote on 23 aug 2007 in comp.lang.javascript:
>>
I need a javascript to solve for X as in the following:

120.85 X
----- = ---
16 24

24 x 120.85 / 16 = X

X = 181.28

Does anyone have such ... or anything like it that I might
play with to do the same ?

Why would you "need" that?
A school assignment?
What code dit you make sofar?
I have no code so far. I am JS illiterate. I do a little hacking of
existing scripts when needed, but have never created from scratch.
I used to get JSs from a JS site, but nothing I can use for my purpose.

There are 5 of us who work for the same company and it would give us
a rough idea of how much take home pay we can expect given a certain
amount of hours worked. We all make the same low wages, so we can compare
against hrs worked vs amount paid previously. The numbers used were just
for analogy sake.

= Paul =

Aug 23 '07 #4
Paul J. Dudley wrote on 23 aug 2007 in comp.lang.javascript:
On Thu, 23 Aug 2007 19:37:12 +0000, Evertjan. wrote:
>Paul J. Dudley wrote on 23 aug 2007 in comp.lang.javascript:
>>>
I need a javascript to solve for X as in the following:

120.85 X
----- = ---
16 24

24 x 120.85 / 16 = X

X = 181.28

Does anyone have such ... or anything like it that I might
play with to do the same ?

A school assignment?
What code dit you make sofar?

I have no code so far. I am JS illiterate. I do a little hacking of
existing scripts when needed, but have never created from scratch.
I used to get JSs from a JS site, but nothing I can use for my
purpose.

There are 5 of us who work for the same company and it would give us
a rough idea of how much take home pay we can expect given a certain
amount of hours worked. We all make the same low wages, so we can
compare against hrs worked vs amount paid previously. The numbers
used were just for analogy sake.
Ask yourself:
What is the input format?
What are constants, what are input dependent variables?
What is the output format?
Then look at the Javascript FAQ of this NG and start learing.

Q not answered yet:
>Why would you "need" that?


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Aug 23 '07 #5
On Thu, 23 Aug 2007 20:08:54 +0000, Evertjan. wrote:
Paul J. Dudley wrote on 23 aug 2007 in comp.lang.javascript:
>On Thu, 23 Aug 2007 19:37:12 +0000, Evertjan. wrote:
>>Paul J. Dudley wrote on 23 aug 2007 in comp.lang.javascript:
I need a javascript to solve for X as in the following:

120.85 X
----- = ---
16 24
:
etc
:
>
Q not answered yet:
>>Why would you "need" that?
There are 5 of us who work for the same company and it would give us
a rough idea of how much take home pay we can expect given a certain
amount of hours worked. We all make the same low wages, so we can compare
against hrs worked vs amount paid previously. The numbers used were just
for analogy sake.

As for the FAQ, I believe I inadvertently deleted it ( without knowing ).

= Paul =

Aug 23 '07 #6
Paul J. Dudley wrote:
I have no code so far. I am JS illiterate. I do a little hacking of
existing scripts when needed, but have never created from scratch.
I used to get JSs from a JS site, but nothing I can use for my purpose.
It would seem that your problem is not JS, but a lack of programming skills.
Here you are:

window.alert("X = " + 120.85 * 24 / 16);

Beware of the precision error that comes with using IEEE-754 doubles.

http://jibbering.com/faq/
PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f8*******************@news.demon.co.uk>
Aug 23 '07 #7
On Thu, 23 Aug 2007 22:21:26 +0200, Thomas 'PointedEars' Lahn wrote:
Paul J. Dudley wrote:
> I have no code so far. I am JS illiterate. I do a little hacking of
existing scripts when needed, but have never created from scratch.
I used to get JSs from a JS site, but nothing I can use for my purpose.

It would seem that your problem is not JS, but a lack of programming skills.
Here you are:

window.alert("X = " + 120.85 * 24 / 16);

Beware of the precision error that comes with using IEEE-754 doubles.

http://jibbering.com/faq/
PointedEars
Thanks for the pointer ..

= Paul =
Aug 24 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Erik-Jan Bakker | last post by:
Hi I am not a javascript expert and I have a problem that the guru's in this newsgroup probably can solve quickly. ;-) I've made a webpage with three frames: top, left and mainframe. I...
6
by: Jeff | last post by:
Hi, does anyone know why this: <a onclick="insertatcaret(window.opener.document.formname.fieldname,'<td class="header">')">text</a> returns a "Unterminated String Constant" error message in IE...
6
by: francisco lopez | last post by:
ok , first of all sorry if my english is not so good, I do my best. here is my problem: I donīt know much javascript so I wrote a very simple one to validate a form I have on my webpage. ...
3
by: Sean McCourt | last post by:
Hi I am doing a JavaScript course and learning from the recommed book (JavaScript 3rd Edition by Don Gosslin) Below is one of the exercises from the book. I get this error message when I try to...
0
by: Casey Hawthorne | last post by:
The value of Big-O notation is for scale ability, since quite often a an algorithm used for small N is forgotten about in a large program and not changed when the program has to deal with larger...
6
by: news | last post by:
I need some concise, easy to grok examples of what .Net (preferably C#.Net) has over just using old ASP or PHP with JavaScript. See, I'm a PHP guy, and while I started server-side scripting with...
7
by: fox | last post by:
Hi, Lacking javascript knowledge, I just realized why my project has a bug. I am using ASP to loop through a set of records while it creates URLs with a querystring that has a single value pair....
5
by: settyv | last post by:
Hi, Below is the Javascript function that am trying to call from asp:Button control. <script language="javascript"> function ValidateDate(fromDate,toDate) { var fromDate=new Date();
25
by: Oltmans | last post by:
Hi guys, I'm learning JavaScript and I need some puzzles that can make me a better JavaScript programmer. I mean I'm looking out for programming puzzles (e.g. Project Euler or TopCoder) but I'm...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.