Check08D - double relative = cC.getBalance() /...

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

View Full Document Right Arrow Icon
import java.io.PrintStream; import java.util.*; import type.lib.*; i public class Check08D { public static void main(String[] args) { PrintStream out = System.out; Scanner in = new Scanner(System.in); out.print("Enter trigger level [1-100] . .. "); final int ABSOLUTE = in.nextInt(); int cardCount = 0; double avgBalance = 0.0; GlobalCredit random = GlobalCredit.getRandom(); for (CreditCard cC : random) { avgBalance += cC.getBalance(); cardCount++; } avgBalance /= cardCount; for (CreditCard cC : random) { final double CENT = 100.0;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: double relative = cC.getBalance() / cC.getLimit() * CENT; String isStar = cC.getBalance() > avgBalance ? "*" : ""; String isArrow = relative >= ABSOLUTE ? "\t<" : ""; out.printf("%s%s\t%d\t%.2f%s%n", cC.getNumber() , isStar , (int) cC.getLimit(), cC.getBalance() , isArrow ); } out.printf("%nNumber of cards = %d%n", cardCount); out.printf("Average balance = %.2f%n", avgBalance); //Line required to get rid of Eclipse bug. But crashes eCheck //System.exit(0); } }...
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