PDA

View Full Version : JAVA help!


Raven
07-14-2006, 08:36 PM
Hey guys, a buddy of mine is taking java in school, and is really stumped as far as this one little assignment goes.. if any of you have a spare moment or two, please look it over and see if you can find the problem..

instructions:
"when a price is entered in the "price" txt box, i need it to be multiplied by
the selected province's tax.

(which should change to 14% if ON, or BC is selected.
and all the other are 15%)

the sum of the price X the selected tax should be displayed in a message box when the "calculate"
button is clicked.

also, if a letter is entered into the "price" field, then calculate is clicked
a msg box should appear and say "enter a number" or "price is not valid"


thanks alot, anyone who can figure this out!"



CODE:


<HTML>
<HEAD>
<TITLE>In class Assignment #2</TITLE>

<SCRIPT LANGUAGE="JAVASCRIPT">
<!--Hide from old browsers


//-->
</SCRIPT>

</HEAD>

<BODY>

<CENTER><H1>Provincial Tax Calculator</CENTER></H1>
<HR></HR>

<FORM>
<CENTER>Price: <INPUT TYPE="text" size ="10" name="Price" maxlength="10" value="">
<P>
<P>
<CENTER>Province
<SELECT NAME="Province">
<OPTION SELECTED>ON
<OPTION>QC
<OPTION>NS
<OPTION>NB
<OPTION>MB
<OPTION>BC
<OPTION>PE
<OPTION>SK
<OPTION>AB
<OPTION>NL
</SELECT>
<P>
<CENTER>Selected Province's Tax
<INPUT TYPE="text" size = "5" name ="CurrentTax" value="" Disabled>

<P>
<P>
<INPUT TYPE="Button" value="Calculate">
</FORM>

<SCRIPT LANGUAGE="JAVASCRIPT">
<!--Hide from old browsers

//-->
</SCRIPT>


</BODY>


</HTML>

Smashley
07-14-2006, 09:28 PM
where is the java script? are u wanting us to write the script for him? I usually charge $50 an hour for that... lol.

Animal
07-14-2006, 10:54 PM
This is a pretty easy and basic assignment. As our mutal friend Ashley stated, there is no actual java in your post. Did you just want us to give you something that meets the requirements and works? I would be more than willing to help you out but I would like to see what your friend came up with first. I have no desire to do anyones homework.

zero
07-15-2006, 12:01 AM
This is Javascript, not Java. And a monkey can right both either way.

Smashley
07-15-2006, 12:07 AM
This is a pretty easy and basic assignment. As our mutal friend Ashley stated, there is no actual java in your post. Did you just want us to give you something that meets the requirements and works? I would be more than willing to help you out but I would like to see what your friend came up with first. I have no desire to do anyones homework.

OMG! I almost fainted! AR said something sorta nice about me. I think IM gonna cry... this truly is a momentous ocassion! :cool:

lubs AR

McTucket
07-15-2006, 01:35 AM
This is Javascript, not Java. And a monkey can right both either way.


uh... id like to think i have more intelligence than a monkey, and im almost positive i cant "right" both... :badgrin: :badgrin: :badgrin:

Animal
07-15-2006, 07:18 AM
uh... id like to think i have more intelligence than a monkey, and im almost positive i cant "right" both... :badgrin: :badgrin: :badgrin:

Oh! SNAP!! PWNT!:badgrin:

zero
07-15-2006, 09:28 AM
ha ha, self pwnt. It was right before I went to bed, that's my excuse. :lol:

McTucket
07-15-2006, 09:44 AM
ha ha, self pwnt. It was right before I went to bed, that's my excuse. :lol:

:cool: :cool:

Raven
07-15-2006, 03:17 PM
well what's that shit that i posted at the end? that's from view --> source of his html file that he sent me (can't attach html files here..)
I am clueless as far as that shit goes, he just said he's having trouble doing it, so i figured i'd post it here and see if any of you douches can help.
I guess the 'source' stuff is not the actual javascript code.. so i'm gonna try to get that from him i guess
*shrug*

Smashley
07-15-2006, 06:28 PM
<FORM>
<CENTER>Price: <INPUT TYPE="text" size ="10" name="Price" maxlength="10" value="">
<P>
<P>
<CENTER>Province
<SELECT NAME="Province">
<OPTION SELECTED>ON
<OPTION>QC
<OPTION>NS
<OPTION>NB
<OPTION>MB
<OPTION>BC
<OPTION>PE
<OPTION>SK
<OPTION>AB
<OPTION>NL
</SELECT>
<P>
<CENTER>Selected Province's Tax
<INPUT TYPE="text" size = "5" name ="CurrentTax" value="" Disabled>

<P>
<P>
<INPUT TYPE="Button" value="Calculate">
</FORM>


That is the HTML that creates the form.
There should be JavaScript between the script tags.

Raven
07-15-2006, 08:27 PM
omg he's a douche.. i'm never helping him again after this ahaha
so apparently here is his assignment:

==============================
In-Class Assignment #2


Design a 1-page website that:

Has a textbox for entering the price of an item (10 characters wide). Validate the entry

Has a selection box for choosing the province (ON, QC, NS, NB, MB, BC, PE, SK, AB, NL)

Has a Selection List linked textbox for displaying the taxes for each of the provinces above (assume taxes for ON & BC are 14%, and rest 15%)

Has a button, which, when clicked, will calculate the total price of the item with taxes added and display it on a popup window.

For bonus marks, format the displayed value in the format of $,$$$.CC

Due on 19th July, 2006
==============================


if anyone is bored enough to write the code for this thing, be my guest, and I'll appreciate it.. but no biggie. It doesn't seem complicated at all.. I could do that in VB in 15 minutes.. *shrug*.. glad I never took javascript lol!

devil_dog
07-15-2006, 10:11 PM
That is all HTML. There is no Java Script code in it. All he has done is the interface that you'll see in the web browser, if that.

dd