Friday, May 30, 2008

W6 Problem 4

Problem 4 (uses StampMachine class as defined on page 157, step 5, of Big Java book)

Write a main method that prompts a user for the following information and reads the user response from the keyboard:

  • 16 digit credit card number, read as a string
  • Month/year from the credit card, in the format MM/YY, read as a string
  • a dollar amount to be spent on a stamp purchase, read as a double

Using the StampMachine class, the method should then determine and display the following information to the user:

· the number of first class stamps purchased

· the number of penny stamps purchased

· the credit card information, in the following format, showing only the last 4 digits of the card number:

Card: XXXXXXXXXXXX1234 Month: 10 Year: 09

No comments: