www.webdeveloper.com
Results 1 to 2 of 2

Thread: Javascript

  1. #1
    Join Date
    Apr 2013
    Posts
    1

    Javascript

    hello,

    I have an assignment for a class and I missed a day so I am having trouble with an assignment. I need to make a calculator using a prompt that can solve a simple math equation (+,-,/,*) with any number, and it has to use the while loop (and possible do or for or all three). I don't even really know how to start it so any help would be great!

    This is the assignment if it helps:

    Create a calculator that prompts the user for a simple expression (4+233, 14-2, 4/24, 33.5*33) and then gives the correct result.

    The calculator should loop indefinitely until the user enters just # in for their equation

    I donít expect any further error checking, assume the user will follow the instructions

    The user may enter in numbers of any size and any one of the basic 4 math expressions +-/*, no spaces will be entered nor do they need to be checked for

    You will need to ensure the user doesnít try to divide by zero!

    HINT1: Use loops to walk through the input string and use if statements to split the string up into the three different sections (first number, expression, second number)

    HINT2: Use a switch structure to determine which mathematical operation to run

    As with all assignments, I expect proper HTML with a title and adequate documentation for your JavaScript. Donít give up easy points!

    Take your time and put effort into making your input and output user friendly. Create a nice welcome message that states the restrictions. Have the results nicely formatted as well (see demo in class). When the program is done being ran, have a goodbye message.

  2. #2
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,380
    You should make an attempt at the code solution.
    You should at least be able to provide the HTML layout.

    Have you check your fellow classmates notes for the missing day?

    Also, read the rules of the forum (in the sticky notes) concerning asking for homework code.

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