473,794 Members | 2,804 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need: Javascript to solve for X (proportionalit y)


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 1406
Paul J. Dudley wrote on 23 aug 2007 in comp.lang.javas cript:
>
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.home work-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.javas cript:
>>
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.javas cript:
On Thu, 23 Aug 2007 19:37:12 +0000, Evertjan. wrote:
>Paul J. Dudley wrote on 23 aug 2007 in comp.lang.javas cript:
>>>
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.javas cript:
>On Thu, 23 Aug 2007 19:37:12 +0000, Evertjan. wrote:
>>Paul J. Dudley wrote on 23 aug 2007 in comp.lang.javas cript:
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.de mon.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
18878
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 defined this in a frameset called index.htm. Each frame is loaded with a specific page: top:title.htm, left:menu.htm and mainframe:start.htm. So far so good...
6
13492
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.0 but if I take out the double quotes around header it does not? I need double quotes around header, I thought this was possible in javascript so long as the pair of double quotes is surrounded by a pair of single quotes.
6
2158
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. could you please have a look at the following script: ------------------------------------------------------------
3
2571
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 use the calculator. "document.Calculate.Input is null or not an object" Can someone please tell me why this is?
0
1227
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 inputs. It's also useful to know the constant of proportionality, for different platforms, for code optimization issues. -- Regards, Casey
6
5741
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 ASP, I hate it. But last year I had the opportunity to work with a company that was developing sites in VB.Net. And I was wowed! The stuff they could do was really nice and impressive, and I got the chance to learn a little about datagrids. Was...
7
2537
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. This URL needs to open in a floating window if clicked. (this is for an administrator and so opening a small floater gives them more efficient access to the data that will be displayed). I now understand that because the ASP executes first, that...
5
2582
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
5469
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 looking out for language specific puzzles that can make me a top-notch JavaScript programmer. a) Any puzzles you can recommend? b) Any programs that you can suggest that can make me learn JavaScript internals in greatest depth. Please recommend...
0
9672
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10213
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10163
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10000
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6779
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.