Write a program called Q1.java. It should create a random GlobalCredit instance (see the type.lib.GlobalCredit API) called gc. It should then print out a header, as shown in the example, and all the cards in gc, one per line. It should then print a blank line and a second header and again all the cards in gc, except this time sorted in increasing order by the card number string.
The output should conform to that in the sample run of a correct program shown below. (Since the instances are random, the values will be different.) Note that, in this sample run, the % sign is not part of the program output.% % java Q1 A RANDOM GLOBAL CREDIT INSTANCE: RWRD [NO=459253-8, BALANCE=212.79, POINTS=22] CARD [NO=014397-3, BALANCE=204.63] RWRD [NO=443291-4, BALANCE=157.09, POINTS=32] CARD [NO=535465-8, BALANCE=113.40] CARD [NO=199624-5, BALANCE=237.57] CARD [NO=123456-6, BALANCE=56.77] CARD [NO=914680-8, BALANCE=166.84] CARD [NO=054436-5, BALANCE=233.25] CARD [NO=486111-6, BALANCE=160.86] RWRD [NO=623328-3, BALANCE=163.73, POINTS=20] THE GLOBAL CREDIT INSTANCE SORTED: CARD [NO=014397-3, BALANCE=204.63] CARD [NO=054436-5, BALANCE=233.25] CARD [NO=123456-6, BALANCE=56.77] CARD [NO=199624-5, BALANCE=237.57] RWRD [NO=443291-4, BALANCE=157.09, POINTS=32] RWRD [NO=459253-8, BALANCE=212.79, POINTS=22] CARD [NO=486111-6, BALANCE=160.86] CARD [NO=535465-8, BALANCE=113.40] RWRD [NO=623328-3, BALANCE=163.73, POINTS=20] CARD [NO=914680-8, BALANCE=166.84] %
Here (again) are the common APIs that you may access:
Here is the command to submit your work
(further details regarding the submit command can also be
obtained by
typing man submit
Once again, you are encouraged to submit
regularly.
Newer submissions overwrite older ones.
submit 1020 labtest3T1 Q1.java