{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Check05A - switch(roots.getRootCount case-1...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
import type.lib.Equation; import java.io.PrintStream; import java.util.Scanner; i public class Check05A { public static void main(String[] args) { PrintStream out = System.out; Scanner in = new Scanner(System.in); out.println("Enter a,b,c pressing ENTER after each ..."); Equation roots = new Equation(in.nextDouble(), in.nextDouble(), in.nextDouble()); out.printf("The equation: %s %n", roots.toString());
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: switch (roots.getRootCount()) { case -1: out.printf("is an identity - any value is a root.%n"); break; case 0: out.printf("has no real roots.%n"); break; case 1: out.printf("has the single root: %.1f%n", roots.getRoot(1)); break; case 2: out.printf("has the two roots: %.1f and %.1f%n", roots.getRoot(1), roots.getRoot(2)); break; } } }...
View Full Document

{[ snackBarMessage ]}