logo Hurry, Grab up to 30% discount on the entire course
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Persimmon BissoondathBusiness
(4/5)

959 Answers

Hire Me
expert
Piper SharpMathematics
(5/5)

879 Answers

Hire Me
expert
Angel BoultonStatistics
(5/5)

643 Answers

Hire Me
expert
Violeta BaoMarketing
(5/5)

869 Answers

Hire Me
Java Programming

Write a program that reads in a quadratic equation from the keyboard as a string.  It should then extract the coefficients as integers and use them to produce a graph showing the curve from the x-axis values -20 to +20.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Write a program that reads in a quadratic equation from the keyboard as a string.  It should then extract the coefficients as integers and use them to produce a graph showing the curve from the x-axis values -20 to +20.

For simplicity in parsing the string, you need to be able to examine the characters one at a time, and if their numerical equivalent is 0 – 9 (use positive, single-digit coefficients for simplicity’s sake) then record those as one of the three values needed to produce the output.  So, you will need to do some reading on the methods available to strings, as well as the character-to-integer conversion method.  For example, if the input (again, with no spaces for simplicity) were:

3x2+5x+6

The relevant values for graphing the curve would be 3, 5 and 6.  Note that the second value (2) is just an indication of the squaring of x, and should, therefore, be ignored.

A window should appear showing the x/y axes as a cross, and a point for each value along the -20 to + 20 range.  Remember to provide a proper offset for your x/y values so that they appear on the screen properly (play with the numbers a bit).

For example, with a 400 by 400 window, my input equation is:

2x2 + 3x + 4

The code extracted the relevant integers 2, 3 and 4, and produced the image below using a 2x2 oval for each “dot.”  Since the window is 400 × 400, I ran my loop from -20 to +20, multiplied the horizontal value by 10 and offset it by 200 (so it would appear relative to the middle).

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme