Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem b (PA2b.java) Write a program that solves a quadratic equation of the form: ar bor+c=0 Specifically, the user will input the values of a,

image text in transcribed
Problem b (PA2b.java) Write a program that solves a quadratic equation of the form: ar bor+c=0 Specifically, the user will input the values of a, b, and c. Your program must then calculate and output roots of the equation, following these rules. First, calculate the discriminant: d=b2 - dac If the discriminant is negative, the roots are imaginary. Print out a message informing the user this and stop the program. For example: Enter a b c: 1 14 Roots: imaginary COMP1000-Programming Assignment 2 If the discriminant is exactly zero, there is one root. Inform the user of this one root: -6/20. Yo must provide exactly two decimal places in your response, rounding as necessary. For example: Enter a b c Root: -2.00 1 4 4 If the discriminant is positive, there are two roots: and Inform the user of the value of the roots in increasing order of value (i.e. the smaller root first, followed by the larger) You must provide exactly two decimal places in your response, rounding as necessary. For example: Enter a b c 1 6 5 Roots: -5.00, -1.00 Note that the JUnit tests, and grading, will be very picky about exact spacing, spelling, capitalization, and number formatting

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Select Healthcare Classification Systems And Databases

Authors: Katherine S. Rowell, Ann Cutrell

1st Edition

0615909760, 978-0615909769

More Books

Students also viewed these Databases questions

Question

=+Is the WebApp fully compatible with the server OS?

Answered: 1 week ago