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; import java.util.Scanner; i public class Check05A { public static void main(String[] args) { PrintStream out = System.out; Scanner in = new Scanner(; 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

This note was uploaded on 09/16/2011 for the course CSE CSE 1020 taught by Professor Burton,ma during the Fall '10 term at York University.

Ask a homework question - tutors are online