Homework #2
You should work by yourself on this assignment.
Figure 1:
Include a main method to the GradeBookEntry class that
does the following:
Problem 2: Credit Cards
Characteristics of each type of credit card:
Once you have added these changes to the CreditCard class and you have tested
that they work correctly, do the following:
To implement some of the functionality in the GoldCard and LastChanceCard
classes, you may need to add (or change) methods in the CreditCard class
as well as add data members to this class.
Do not worry about formating floating point values for this assignment.
However, if you would like to play around with number formating, take a
look at the API documentation for the DecimalFormat and NumberFormat
classes. Here is an example of how you could format dollar amounts
to print the retail price of an Auto object from your last homework
assignment:
You should use the following classes as starting points for your programs:
Problem #2:
student field:
firstName = "first_i"
lastName = "last_i"
age = a random age between 18 and 22
gradYear = 2004
assignments field:
an array of 20 grades
each element in the array = random grade between 50 and 100
Student's Name Max Min Ave
-------------- --- --- ---
first_0 last_0 96 50 69.25
first_1 last_1 97 51 71.1
first_2 last_2 99 59 79.75
. . . .
. . . .
. . . .
You will write a Java program that allows a user to create a new credit
card of one of three types: a regular card, a gold card, or a last-chance card.
Next your program will enter a loop that will:
The menu will have the following options:
When the user selects option 3, to quit, your program should terminate.
Implementation Details and Requirements
Starting with the CreditCard class given in the book implement features
specified in the book problems R-1.3 and R-1.4. For R-1.4, use the regular
credit card interest rate and limit; in your program, regular credit card
objects will be instances of the CreditCard class. Each time a user makes
a payment, you should charge interest on any unpaid balance (note: unlike
a real credit card, you do not need to keep track of time in your program
and charge interest when a payment is late, instead every time a user chooses
to make a credit card payment your program should check to see if interest
should be charged based on the remaining balance alone).
Specific Requirements
NumberFormat mf = NumberFormat.getCurrencyInstance(Locale.US);
String priceOutput = mf.format(this.retailPrice());
System.out.println(" retail price is " + priceOutput );
Classes
Problem #1:
HAND IN
Using cs35handin, hand in a single tar file containing all the Homework 2
.java files necessary for compiling and running your solutions to both
problem 1, and 2 (including all of the files that we give you that you
use in your solution), and a copy of your Makefile.