nineLab3 - Money mixed 1 mixed fraction =(random instanceof...

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

View Full Document Right Arrow Icon
import type.lib.*; i public class nineLab3 { public static void main(String[] args) { int mixed = 0, money = 0, fraction = 0; for (int i = 0; i < 100; i++) { Fraction random = Money.getRandom(); System.out.println((i + 1) + ": " + random.toString()); // money = (random instanceof Money) ? money + 1 : money; // mixed = ((random instanceof MixedNumber)) ? mixed + 1 : mixed; // //mixed = ((random instanceof MixedNumber) && !(random instanceof
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Money)) ? mixed + 1 : mixed; // fraction = (random instanceof Fraction) ? fraction + 1 : fraction; if (random instanceof Money) { money += 1; } else if (random instanceof MixedNumber) { mixed += 1; } else { fraction += 1; } } System.out.println(money + " " + mixed + " " + fraction); } }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online