I need help with a assignment im doing....i would really appreciate it
im new to java programming, so im learning the basics of programing...
my assigment is that i have to replace a word from a sentence to a different word
i.e
have a happy happy christmas
i have to change happy to horrible
the output sentence should look like this
have a horrible happy christmas
how do i change happy to horrible?
and + the concept of how i wrote it...am i goign the right direction or no
this is how i written my program.....any suggestions would do, iw oudl aprreciate it
import java.util.*;
public class LastName
{
public static void main (String[] args)
{
String name;
int space1 ;
int length;
String newname;
int space2;
int space3;
int space4;
Scanner keyboard = new Scanner (System.in);
// prompt the user
System.out.print ("Enter Sentence: ");
name = keyboard.nextLine ();
space1 = name.indexOf ( " ");
length = name.length();
newname = name.substring (0,18);
space2 = newname.indexOf (" ");
System.out.print ("Enter Sentence: ");
System.out.println (newname);
}
}

