You are viewing our Forum Archives. To view or take place in current topics click here.
Can anyone help me? +Rep | Java beginner
Posted:

Can anyone help me? +Rep | Java beginnerPosted:

var
  • TTG Senior
Status: Offline
Joined: Dec 24, 201211Year Member
Posts: 1,498
Reputation Power: 79
Status: Offline
Joined: Dec 24, 201211Year Member
Posts: 1,498
Reputation Power: 79
I'm stuck on this project for AP Computer Science, and it's really pissing me off.
If someone can help me reference my indexOf line, and get it to print asterisks I'll rep.
I don't just want the answer though, I want to understand it..

[ Register or Signin to view external links. ]

Where I'm at(edited) > [ Register or Signin to view external links. ]

Edit: I just really don't get how to "Reference the index and replace the 4-letter word with asterisks (****) as follows:"
#2. Posted:
SK7
  • Powerhouse
Status: Offline
Joined: May 26, 201311Year Member
Posts: 491
Reputation Power: 22
Status: Offline
Joined: May 26, 201311Year Member
Posts: 491
Reputation Power: 22
I can't view the instruction for some reason, can you simplify it so I can read it?
#3. Posted:
JoeTheSloth
  • New Member
Status: Offline
Joined: Oct 13, 201310Year Member
Posts: 2
Reputation Power: 0
Status: Offline
Joined: Oct 13, 201310Year Member
Posts: 2
Reputation Power: 0
RicardoHill-Henry wrote I'm stuck on this project for AP Computer Science, and it's really pissing me off.
If someone can help me reference my indexOf line, and get it to print asterisks I'll rep.
I don't just want the answer though, I want to understand it..

[ Register or Signin to view external links. ]

Where I'm at(edited) > [ Register or Signin to view external links. ]

Edit: I just really don't get how to "Reference the index and replace the 4-letter word with asterisks (****) as follows:"



public class WordRemoval
{
   public static void main(String[] args)
   {
       String word1 = new String("The Bird flies");
       String the = new String("The ");
       String flies = new String(" flies");
       String birdSub = word1.substring(4,8);
       int birdNum = 4;
       
       String ast = new String("");
       
       if(birdSub.equals("Bird"))
       {
           for(int i = 0; i < birdNum; i++)
           {
               ast = ast += "*";
           }
           String newWord = new String(the += ast += flies);
           System.out.println(newWord);
       }
   }
}

There ya go.

I bet this code can be MUCH better, but oh well lol
#4. Posted:
Kyle93
  • Winter 2021
Status: Offline
Joined: Jun 25, 201013Year Member
Posts: 4,078
Reputation Power: 2628
Motto: https://www.thetechgame.com/Forums/t=7804 333/vote-for-tune-of-the-week-friday-nigh ts-lockdown-dj-sets.html
Motto: https://www.thetechgame.com/Forums/t=7804 333/vote-for-tune-of-the-week-friday-nigh ts-lockdown-dj-sets.html
Status: Offline
Joined: Jun 25, 201013Year Member
Posts: 4,078
Reputation Power: 2628
Motto: https://www.thetechgame.com/Forums/t=7804 333/vote-for-tune-of-the-week-friday-nigh ts-lockdown-dj-sets.html
RicardoHill-Henry wrote I'm stuck on this project for AP Computer Science, and it's really pissing me off.
If someone can help me reference my indexOf line, and get it to print asterisks I'll rep.
I don't just want the answer though, I want to understand it..

[ Register or Signin to view external links. ]

Where I'm at(edited) > [ Register or Signin to view external links. ]

Edit: I just really don't get how to "Reference the index and replace the 4-letter word with asterisks (****) as follows:"


I also can't view the instructions. Copy and paste them and I'll give you a hand
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.