Question

In: Computer Science

Create a form in which the user enters two separate numbers (x and y), and when...

Create a form in which the user enters two separate numbers (x and y), and when the user clicks the appropriate button, math functions are performed on these two numbers and output back on to the form.

INPUT

  • User can enter two separate numbers (one for the x variable, and one for the y variable)
  • User can input their information:
    • The user must be able to enter information about themselves, including first name, last name, address, phone

PROCESSING

  • The user will be allowed to click a button (or multiple buttons if desired) on the form
  • Store the user input into two separate variables to be able to perform math
  • Once the button(s) is clicked, several math functions must be performed
    • Adding x and y
    • Subtracting x and y
    • Multiplying x and y
    • Dividing x and y

OUTPUT

  • After the button is clicked and the math functions are performed, the answers to the math problems should be output on the form
    • Addition =
    • Subtraction =
    • Multiplication =
    • Division =
  • Output the data into a listbox
  • Output the data into text box

CRITERIA

  • Make the form visually appealing – use alignment, formatting, spelling, font controls, etc.
  • Must be usable (tab order, adequate labels)
    • Include a clear button so the user can start again
  • Make use of methods we have learned in class
  • Variable names can be creative, but they must include the appropriate prefixes
  • Include access keys on each button
  • Set tab order from top to bottom
  • Include field masking where appropriate
  • Use at least one input box
  • Display at least one output box
  • Include documentation within code
  • Must give accurate information when performing functions
  • Any other special instructions mentioned in Input, Output or Processing section

GRADING

  • Creativity
  • User friendliness of form
  • Use of multiple methods discussed in class
  • Include all criteria listed above

SUBMISSION INSTRUCTIONS

  • Must be submitted to BlackBoard drop box No LATER THAN midnight on the due date

All files should be included in submission

Solutions

Expert Solution

<html>
   <head>
       <title>Math Operations</title>
       <script>
           function calc(){
               var x = parseInt(document.maths.x.value);
               var y = parseInt(document.maths.y.value);
               document.getElementById("output").innerHTML = "Addition="+(x+y)+"<br>Subtraction="+(x-y)+"<br>Multiplication="+(x*y)+"<br>Division="+(x/y)+"<br>";
               console.log(document.maths.x.value);
           }
           function reset(){
               document.maths.x.value = null;
               document.maths.y.value = null;
               document.getElementById("output").innerHTML = "";
           }
       </script>
   </head>
   <body>
       <div style="text-align: center !important;">
           <br>
           <h2> CALCULATOR </h2>
           <hr><br>
       <form name="maths">
           X: <input style="margin: 5px;" type="number" name="x" id="x" placeholder="Enter value of x"><br>
           Y: <input style="margin: 5px;"type="number" name="y" id="y" placeholder="Enter value of y">
       </form>
       <button style="margin: 5px; height:30px; width: 100px; background: green; color: white;" onclick="calc()">Calculate</button>
       <button style="margin: 5px; height:30px; width: 100px; background: red; color: white;" onclick="reset()">Reset</button>
       <p id="output"></p>
   </div>
   </body>
</html>


Related Solutions

Using Visual Basic 2017, Create a form with two textboxes and one button. A user enters...
Using Visual Basic 2017, Create a form with two textboxes and one button. A user enters the course she is taking in the first text box and then clicks on the button. Then if the user entered "Program Language" in the first text box, the second text box will show "Awesome pick!". If the user entered something else, the text box shows "Ok." Please write the correct code.
Design the logic for a program that has two parts: The user enters 15 numbers that...
Design the logic for a program that has two parts: The user enters 15 numbers that are stored into an array. The program uses the array to display the numbers back to the user in reverse order. You must use an array and one or more loops to get full credit. Can someone please help me figure this out?
Using an ArrayList, create a program which does the following: If the user enters quit, the...
Using an ArrayList, create a program which does the following: If the user enters quit, the program ends. If the user enters add followed by a string, program adds the string only to your ArrayList. If the user enters print, the program prints out the ArrayList contents. If the user enters size, the program prints out size of ArrayList, If the user enters remove followed by string, it removes all strings. interface example: **** Welcome to my List Program ****...
Write a C++ program that reads numbers from the user until the user enters a Sentinel....
Write a C++ program that reads numbers from the user until the user enters a Sentinel. Use a Sentinel of -999. Ignore all negative numbers from the user input. Do the following: Output the sum of all even numbers Output the sum of all odd numbers Output the count of all even numbers Output the count of all odd numbers You must use loops and numbers to do this. You must not use any arrays or vectors for this program.
create two random numbers between 1 and 6. if when the sum of two numbers are...
create two random numbers between 1 and 6. if when the sum of two numbers are added togethere their sum is less than 5 or greater than 12, output to the console: "you win". if is not, output "you lose" C++
Write Java code that allows a user to repeatedly enter numbers. Each time the user enters...
Write Java code that allows a user to repeatedly enter numbers. Each time the user enters a number, the program should print out the average of the last 3 numbers (or all numbers if 3 or less have been entered). I would like a detailed explanation so that a beginner level Java programmer could understand.
When water and oil are added to a test tube, the two liquids form two separate...
When water and oil are added to a test tube, the two liquids form two separate layers (think of oil and vinegar in a bottle of salad dressing). If a solution of phospholipids was added to a mixture of water and oil, where would you find the phospholipids? Describe their orientation. 2.What is the name of the linkage that connects two nucleotides together in a strand of DNA or RNA? 3.In order to separate the two strands of DNA in...
Two numbers x and y that are not machine numbers are read into a 32-bit word-length...
Two numbers x and y that are not machine numbers are read into a 32-bit word-length computer. The machine computes to xy2. what sort of relative error can be expected? Assume no underflow or overflow
Create a function that will return true if numbers X and Y exist within S such that X + Y = Z, return false otherwise.
Given:   S = [ 2, 1, 3, 4, 7, 5 ] Z = 8   Create a function that will return true if numbers X and Y exist within S such that X + Y = Z, return false otherwise.   Code in Java 8. 
C# Create a console application that asks the user for two numbers in the range 0-255...
C# Create a console application that asks the user for two numbers in the range 0-255 and then divides the first number by the second: Enter a number between 0 and 255: 100 Enter another number between 0 and 255: 8 100 divided by 8 is 12 Enter a number between 0 and 255: apples Enter another number between 0 and 255: bananas FormatException: Input string was not in a correct format.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT