The SpamLetter class generates a typical spam email message. The recipient, amount, and contact information is varied for each generated message.
The incomplete body of the class is:
import java.io.PrintStream;
/**
* SpamLetter generate a typically spam email message.
*
* @author
*/
public class SpamLetter {
public static void generate(
String recipient, int amount, String contact, PrintStream ps )
{
ps.print("This is the problem");
}
public static void main( String[] args ) {
String recipient = args[0];
int amount = Integer.parseInt( args[1] );
String contact = args[2];
generate( recipient, amount, contact, System.out );
}
}
One test example is:
% java SpamLetter sue 1 BILL
Dear SUE,
This is a life-time chance to win 1000 dollars.
You only have to reply to bill
Hurry now, this is a limited offer.
Another testing example is:
% java SpamLetter Fred 100 Mary
Dear FRED,
This is a life-time chance to win 100000 dollars.
You only have to reply to mary
Hurry now, this is a limited offer.
The first argument is the recipient, it should be output in upper case, the second argument is the amount, it should be multiplied by 1000, the last argument is the contact, it should be output in lower case.
My problem is I am not really sure what to do with the ps.print(" "); part. I am new to Java so this can be dreadfully confusing. Can someone please provide some help or direction!
Thanks!
Xo