www.webdeveloper.com
Results 1 to 2 of 2

Thread: Here is my dilemma........

  1. #1
    Join Date
    Mar 2012
    Posts
    8

    Here is my dilemma........

    I am new to the world of programming. I currently in my sophomore year of a software engineering bachelors program. This semester was suppose to be a introductory class to JavaScript. I'm a night-class student full-time age 34 making a career change. Not stupid in any means (3.87GPA) i learn when taught properly. Well needless to say i have a first time teacher who never taught before. Excellent webdeveloper, not so good of a teacher. Just cant make that connection with students. whole class is *****ing they dont know what hes talking about. Doesnt know how to teach javascript basics. skips a lot of the coding in the middle. I have an A in the class along with all of my other classmates and i haven't learned a lick. Which SUCKS cuz javascript is an important language to know a little about when you jump out into the workforce.

    this is the XHTML code that was given to work with:

    /*<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Temperature Converter</title>
    <link rel="stylesheet" type="text/css" href="default.css" />
    <script type="text/javascript" src="jquery.js"></script>
    <script type="text/javascript" src="convert_temp.js"></script>
    </head>
    <body>
    <div id="content">
    <h1>Convert temperature</h1>

    <input type="radio" name="conversion_type" id="to_celcius" checked="checked" />From Fahrenheit to Celcius<br />
    <input type="radio" name="conversion_type" id="to_fahrenheit" />From Celcius to Fahrenheit<br />
    <br />

    <label>Degrees Fahrenheit:</label>
    <input type="text" id="degrees_fahrenheit" class="disabled" /><br />
    <label>Degrees Celcius:</label>
    <input type="text" id="degrees_celcius" disabled="disabled" class="disabled"/><br />
    <br />

    <input type="button" id="convert" value="Convert" /><br />
    <br />
    </div>
    </body>
    </html>*/

    Not the issue because this was given, now the assignment is to:
    operation

    1....If the user selects one of the radio buttons, this application disables the text box that's used to diplay the results of the calculation, it enables the text box that's used to get the data from the user, and it removes any data from both text boxes

    2....This application displays the concerted temperature in the disabled text box when the user clicks on the convert button

    Functional specs
    ---formula for converting fahr to cels... celsius = (fahr - 32) * 5/9
    ---formula for converting cels to fahr.... fahr = cels * 9/5 + 32
    ---this application should accept decimal entries like 77.5, but it should round the result of the conversion to the nearest int value
    ---this application should validate data to make sure that the user enters a valid number for the conversion

    Additional coding requirements

    ---To demonstrate you know how to write and use a function (LOLOLOL) that returns a value in javascript, use a separate function for at least one of the temperature conversions

    --to demonstrate knowledge of techniques related to form validation, use a regular expression to ensure the input values are valid (dont forget about negative numbers, but you can ignore octal and hexadecimal temperatures

    That is the assignment!

    Ill show you what i've done in the on the .js page...Its doing something but nothing right (lolol)....its keeping my degrees celsius text box always in read only, the conversion in the math seems screwed up, everytime i hit convert button the value inside the celsius box which is in read only stays there and i"m not gonna type evrything that is wrong here you can probably find what im doing completely wrong just from my code so here it is.......its incomplete just running into trouble and figuring out hoiw to make this thing run the way its suppose too

    /*var $ = function (id) {
    return document.getElementById(id);
    }

    var calculateCelcius_click = function()
    {
    if ($("to_celcius").checked)// checks to see if fahrenheit to celcius button is clicked
    {
    var fahrenheit = parseFloat($("degrees_fahrenheit").value);//var to take text entered into degrees fahrenheit and make it number value
    $("degrees_celcius").diabled = true;
    if (isNaN(fahrenheit))//error check to see if user input is a number
    {
    alert("Invalid Entry, please neter a valid number")// error message to display if anything other than numbers are entered
    }
    else if (!isNaN(fahrenheit))// if numbver is valid do the following calculations
    {
    var celsius = (fahrenheit - 32) * 5/9;
    celsius = parseInt(celsius);
    $("degrees_celcius").value = celsius;
    }
    }
    }

    var calculateFahrenheit_click = function()
    {
    if ($("to_fahrenheit").checked)// checks to see if celcius to fahrenheit button is clicked
    {
    var celcius = parseFloat($("degrees_celcius").value);//var to take text entered into degrees fahrenheit and make it number value
    $("degrees_fahrenheit").diabled = true;
    if (isNaN(celcius))//error check to see if user input is a number
    {
    alert("Invalid Entry, please neter a valid number")// error message to display if anything other than numbers are entered
    }
    else if (!isNaN(celcius))// if numbver is valid do the following calculations
    {
    var fahrenheit = celcius * 9/5 + 32;
    fahrenheit = parseInt(fahrenheit);
    $("degrees_fahrenheit").value = fahrenheit;
    }
    }
    }

    window.onload = function ()
    {
    $("convert").onclick = calculateCelcius_click;
    $("convert").onclick = calculateFahrenheit_click;
    }

    */

    like i said its incomplete and im just getting frustrated because im using my text book to figure things out and its not much help when you feel like your teaching yourself and dont know where to start....im sure this a simple temperature converter for some of you but being as green as i am any help with this thing would be greatly appreciated..

  2. #2
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,356
    Now, for future reference, try not to double post.
    See: http://www.webdeveloper.com/forum/sh...d.php?t=257914

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles