Current location: Hot Scripts Forums » Programming Languages » Everything Java » Java Assignment Help: Method


Java Assignment Help: Method

Reply
  #1 (permalink)  
Old 10-02-11, 03:08 PM
ashleywinsor ashleywinsor is offline
New Member
 
Join Date: Oct 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Java Assignment Help: Method

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
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Video Java Game Programming phys.rainbow Everything Java 0 10-03-10 01:50 AM
87 video Java Tutorial phys.rainbow Everything Java 0 09-15-10 04:34 AM
Java Platform and Technologies Take Center Stage at India’s No.1 Software Developer Conference wonkim785 JavaScript 0 04-17-10 01:39 AM
Help With Java Assignment monkeymam General HotScripts Site Discussion 0 04-14-04 02:00 PM
one main method sniperx Everything Java 6 01-23-04 06:02 AM


All times are GMT -5. The time now is 05:59 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.