Question

javascript

In this project you will write the JavaScript code to create a calculator. Good thing is that everyone knows how the calculator works. It is a challenging project, give yourself lots of time to complete it.

1. You are provided with an HTML, and CSS files.. Look at these files to understand

how to use them and modify them if needed based on your code. (Note: You can add

different selector (id, class) in HTML ONLY and cannot make any changes to CSS.)

Create your own .js file. All your work will be done in JS file.

2. Connect files and this is what you should see. All files must have your name in the

file’s name. You are ready to start.

3. Apply these changes :

a. Change the background colour of operation buttons (*, /, +, -), make each

button a different colour ( your choice).

b. Change the font colour for all number buttons (include decimal “.” button, to

blue.

c. Change the background colour of clear “C” button, to black. Also the font colour

to white.

4. Add three Buttons before “C” (clear) button as follow:

a. MS -Memory Store

b. MC – Memory Clear

c. MR – Memory Restore

All three buttons must have grey background and white font.

After you apply the changes(with your own colour selection), you should see

something like this:

image.png

5. Record any clicking of buttons and display its value on the screen.

Suggested steps: (Note: You can come up with your own solution)

a. Create variables that will store targeted DOM elements, input/outputs

b. Add an event listener to retrieve data from all buttons when they are clicked.

The handler, function(event) can be used to display the value of the button

(number or operation) on the screen. You can use event.target.dataset.num

to return the value and it should be stored as a new variable added to screen

value.

6. Perform calculations (*, /, +, -) when clicking on the equal “=” button,

Suggested steps:

a. Add an event listener for the equal button. When you click the button, the

handler function(event) can be used to calculate the expression using

eval(screen.value) method. Assign the answer that you obtain to the screen

value. (Note: eval() is a function/method that evaluates expressions. Like:

eval(“2+7”).)

7. Display a message such as “Please Enter a Value”, when clicking the equal “=” button

and nothing is displayed on the screen.

8. Make the memory functional; storing, clearing and retrieving data.

Suggested steps:

a. Add event listeners for:

i. MS- Store the data from screen to memory;

ii. MC - clear the data in the memory;

iii. MR - Recall the memory value to screen.

9. Clear data in screen by clicking on “C” button.

10. Text appearing on the calculator screen must be aligned to the right.

11. When the mouse hovers over a button, change the background colour of the button.

(your choice of colour). Ensure the colour changes back when the mouse cursor is

removed.


Can i get code for the above question?

3 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 7 more requests to produce the answer.

3 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
javascript
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • WEB230 - JavaScript 1 Assignment 6a Use Events and DOM manipulation to create a playable Tic...

    WEB230 - JavaScript 1 Assignment 6a Use Events and DOM manipulation to create a playable Tic Tac Toe game. Do the following using JavaScript. Do not modify the HTML file. When you see this symbol: save and refresh the browser (this should happen automatically if you are using Brackets with Live Preview), then check your code to make sure it is working before you proceed. 1. Create two variables called "playerX" and "playero". Set them to the DOM element with...

  • given below are the project description and their Html and css files i need javascript according to the project and other files!

    HTML------------------------------------------------------CSS---------------------------------------------------WEB230 - JavaScript 1 Assignment 7 - FormsSome of these tasks would be better done in HTML or CSS but do them in JavaScript to practice whatwe have learned.1. Select the form element and save it in a variable. From here we can access all of the form fields.2. When the page loads do the following:add the password value "monkey"select the favourite city "New York"clear the textarea3. Add an event handler to the "name" field to change the background color...

  • given below are the project description and their Html and css files i need javascript according...

    given below are the project description and their Html and css files i need javascript according to the project and other files! WEB230 - JavaScript 1 Assignment 6b - Event Delegation Before starting, study the HTML and open it in a browser so that you understand the structure of the document. You will add functionality to perform several tasks in our shopping list app. Clicking the red "X" at the right of an item will delete that item. Clicking on...

  • Write a calculator program using JavaScript in HTML in the same HTML file. (There will only...

    Write a calculator program using JavaScript in HTML in the same HTML file. (There will only be 1 HTML file containing everything that you use for this program.) *************JavaScript Functions should be written in the HTML <head> .............. </head> tag, **************** (Please be mindful of the formatting of the text of your program. Meaning that do not copy paste everything in a single line. Add clear comments for a better understanding of your program) as follows Assignment: create a form...

  • Please code the following Java App using Swing No additional classes are required. With that in...

    Please code the following Java App using Swing No additional classes are required. With that in mind ... Write a program that emulates a calculator. Create a Label with a title of "Super Calculator", a textbox, where the numbers are displayed, a series of buttons labeled as shown, and a “Clear” button. As the user enters the numbers, pressing the number buttons, display the numbers right justified to the textbox. When the user press any one of the operators, +,...

  • Visual Studio Code C# Well Document everyline saying what the code does. Include designer code and...

    Visual Studio Code C# Well Document everyline saying what the code does. Include designer code and .cscode Extra 6-1 Create a simple calculator In this exercise, you'l1 create a form that accepts two operands and an operator from the user and then performs the requested operation. Simple Calculator Operand 1: 86 Operator Operand 2 11.11 Resut 7.7408 1. Start a new project named SimpleCalculator in the Extra Exercises Chapter 06SimpleCalculator directory 2. Add labels, text boxes, and buttons to the...

  • Can someone help fix this JAVASCRIPT code according to comment instructions javascriot code: window.addEventListener("click", () =>...

    Can someone help fix this JAVASCRIPT code according to comment instructions javascriot code: window.addEventListener("click", () => { console.log("You clicked?"); }); let button = document.querySelector("button"); button.addEventListener("click", () => { console.log("First Button clicked."); }); // How can we modify this so that it will occur when the 2nd button is clicked? // We need to use querySelectorAll which will produce a nodelist/array of all the buttons. Then we can reference which button we want to apply the click event using [] with...

  • Create a windows form application in c# The form must look like a calculator and do...

    Create a windows form application in c# The form must look like a calculator and do the following. Add, subtract, multiply, and divide. Account for division by zero. Show at least two decimal places. Retain the last number on the window so that, when the user opens the calculator the next time, the number that was in the window at the last close appears. Have a memory, so that users can store values and recall them. Operate with a mouse...

  • This is for HTML / Javascript, Thank you very much! Which event handler, underlines the text...

    This is for HTML / Javascript, Thank you very much! Which event handler, underlines the text in an element with id of 'last'. 1. <p onclick="getElementById('last').style.textDecoration='underline'" > some text </p> 2. <p onclick="document.last.style.textDecoration='underlined'" > some text </p> 3. <p onclick="last.style.text-decoration='underline'" > some text </p> 4. <p onclick="getElementById('last').style.text-decoration='underline'" > some text </p> Which statement about the event handlers in these two paragraphs is correct. <p id="p1" onclick="getElementById('p2').style.color='red'" > This is the first paragraph </p> <p id="p2" onclick="this.style.backgroundColor='blue'" > This is the...

  • Need help with creating this JavaScript file. I'm not sure where or how to begin. 1. You are working solely with the DOM object. Thus, you should be coding primarily in the js file. You must use...

    Need help with creating this JavaScript file. I'm not sure where or how to begin. 1. You are working solely with the DOM object. Thus, you should be coding primarily in the js file. You must use the addEventListener, in addition you may need to use id and class attributes as needed. The .html and .css files have been provided to you. See the .png files for an example of what is expected. 2. Place the javaScript file in its...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT