Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 2,936,995 members, 7,107,336 topics. Date: Friday, 07 October 2022 at 05:43 PM 
Nairaland Forum / Science/Technology / Programming / Help A Beginner Code This Using Javascript (596 Views)
I Need An Expert To Code This For Me / How To Code This Logic With Php... / Programmers In The House, Kindly Help Me Table Like This....using Java Awt (2) (3) (4)
Help A Beginner Code This Using Javascript by Fisayo22: 5:02pm On Jun 06, 2020 
write a piece of code using javascript that solves second degree equations. You pass the a, b, c parameters of: ax2 + bx + c, and the solve function will compute delta = b2  4a*c. Test the sign of delta, and if it's equal to zero, then display (in the console, or better, in the page) the roots of the equation. 1 Like 1 Share 
Re: Help A Beginner Code This Using Javascript by Tim1212(m): 6:01pm On Jun 06, 2020 
Fisayo22: This is absolutely easy. Drop your email 
Re: Help A Beginner Code This Using Javascript by Fisayo22: 6:55pm On Jun 06, 2020 
idades489@gmail.com 
Re: Help A Beginner Code This Using Javascript by SUPREMOTM: 8:39pm On Jun 06, 2020 
Fisayo22: COPY AND PASTE it in your code editor, then link the javascript file to your HTML file so you can make use of the browser to view the operations. Ask for clarifications wherever you are confused. let input = prompt("Enter the coefficients of X squared, the coefficients of X and the CONSTANT respectively, separated by commas, and click OK", coefficients = input.split(",", a = coefficients[0], b = coefficients[1], c = coefficients[2]; alert(`Please Confirm if the information below is correct.\n\nCoefficient of X squared = ${a}\nCoefficient of X = ${b}\nThe constant term = ${c}\n\nNB: If any of the inputs is incorrect, please click OK and refresh your browser to input the correct values`); let delta = Math.pow(b,2)(4*a*c), root1 = (b  Math.sqrt(delta))/2*a, root2 = (b + Math.sqrt(delta))/2*a; alert("delta = "+ delta); if(delta >= 0){ alert(`Since delta is a positive number, the roots of the quadratic equation are ${root1.toFixed(2)} and ${root2.toFixed(2)}`); } else{ alert("The quadratic equation has complex roots"; }

Re: Help A Beginner Code This Using Javascript by kay9(m): 1:01am On Jun 10, 2020 
SUPREMOTM: Nice. I would have given different prompts for each of the 3 coefficients though... As in: //Prompt user to input values of a, b, and c...Simpler and eliminates need for the second alert (i.e. the "Please confirm..." bit). Still, neat coding. 
Re: Help A Beginner Code This Using Javascript by SUPREMOTM: 2:13am On Jun 10, 2020 
kay9: Okay 
Re: Help A Beginner Code This Using Javascript by PrinceDekunle: 9:07am On Jun 10, 2020 
Have you considered learning C# which is a top and highly demanded technology of the Microsoft .Net framework? Subscribe to this channel and learn everything for free from the scratch till you become a pro. https://www.youtube.com/channel/UCwNrlP_X_VV4vg00P2QmDnw You can as well join our Facebook community where we answer questions, discuss and share ideas about technologies https://www.facebook.com/groups/738709033333419/?ref=share 
(1) (Reply)
Coder Needed For Part Time Job / Programmers I Need Help / Learn HTML  HTML Training & Tutorials For Complete Beginners
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tvmovies musicradio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland  Copyright © 2005  2022 Oluwaseun Osewa. All rights reserved. See How To Advertise. 58 