Java Calculator Not Working – Need Help Troubleshooting ( Computer Science Beginner )

I’ve written a simple calculator in Java that takes user input for two numbers and an operator. It’s supposed to perform the corresponding mathematical operation and output the result. However, my code isn’t functioning as expected. I’m having issues with inputting the operator and correctly processing the operations using the switch statement. I would appreciate… Read More Java Calculator Not Working – Need Help Troubleshooting ( Computer Science Beginner )

Getting error in function with calculation function

I’m currently creating a macro calculator but I’m getting an error with the actual calculation function. The error I’m getting is ‘Missing initializer in const declaration’. const [weight,setWeight] = useState(""); const [height, setHeight] = useState(""); const [age, setAge] = useState(""); const [activityLevel, setActivityLevel] = useState(""); const handleSubmit = (e) => { e.preventDefault(); } const calculateMacros(weight,height,age,activityLevel)… Read More Getting error in function with calculation function

Why is my calculator adding the digits of its input together instead of updating to a multi-digit number?

I am making a simple calculator and so far its working pretty decently for me besides when I try to enter a digit larger than 9. If I put in 11+55 it will save the firstNumber as 2 and the secondNumber as 10 and return 12 when I obviously want it to save 11 and… Read More Why is my calculator adding the digits of its input together instead of updating to a multi-digit number?

JavaScript Calculator Does not respond

console img const num1Element = document.querySelector(“#num1”); const num2Element = document.querySelector(“#num2”); const resultElement = document.querySelector(“#result”); const operatorlememt = document.querySelectorAll(“[data-operation]”) function summary() { if (operatorElememt == “+”) { const sumElement = Number(num1.value) + Number(num2.value); resultElement.innerHTML = sumElement; } } function multi() { if (operatorElememt == “*”) { const multiElement = Number(num1.value) * Number(num2.value); resultElement.innerHTML = multiElement; }… Read More JavaScript Calculator Does not respond

How can i use eval function

I am creating calculator with Javascript and i have a problem with eval() function HTML ` <div class="calCul1"> <div id="firstCol"> <div id="wind"></div> </div> <div id="secondCol"> <div class="buttonsCol1"> <div id="underCol1"> <div id="bracketOpen"><button id="bracketOBut" onclick=" ">!</button></div> <div id="seven"><button id="sevenBut" onclick="add(7)">7</button></div> <div id="four"><button id="fourBut" onclick="add(4)">4</button></div> <div id="one"><button id="oneBut" onclick="add(1)">1</button></div> <div id="zero"><button id="zeroBut" onclick="add(0)">0</button></div> </div> <div id="underCol2"> <div id="bracketClose"><button… Read More How can i use eval function