Cant get it to replace or print to new line, please help

2 problems. The instructions are to first replace each 's' with '$' and then print each word to a new line. Here is an example:
Give me a phrase: Viva Las Vegas, babies!
Viva
La$
Vega$,
babie$.
Here is my code that is not working:
import java.util.*;
public class StringEdit {
     private static Scanner input ;
     private static String makeMoney[] ;
     public static void main(String[] args)throws Exception {
          System.out.print ("Give me a phrase: ") ;
          input = new Scanner (System.in) ;
          makeMoney = input.nextLine().split(" ") ;
          //makeMoney = makeMoney.replace("s", "$") ;
          int i = 0;
          while (i < makeMoney.length) ;{
          if (makeMoney.contains("s")){
               System.out.println("Show me here");
               makeMoney[i].replace("s", "$");
          if (makeMoney[i].contains("S")){
               System.out.println("Show 2");
               makeMoney[i].replace("S", "$");
          System.out.print(makeMoney[i].toString());
          i++ ;
Please help me figure out what is wrong

your first post was the one which you really wanted to use for the assignment in order to get the output you desire. anyways like jverd said that you cannot update string because they are immutable. you can always do this
makeMoney[i] = makeMoney.replace(blah blah).
here is your program
import java.util.*;
public class StringEdit {
     private static Scanner input ;
     private static String makeMoney[] ;
     public static void main(String[] args)throws Exception {
          System.out.print ("Give me a phrase: ") ;
          input = new Scanner (System.in) ;
          makeMoney = input.nextLine().split(" ") ;
          //makeMoney = makeMoney.replace("s", "$") ;
          int i = 0;
          while (i < makeMoney.length) {
          if (makeMoney.contains("s")){
               System.out.println("");
          makeMoney[i] =     makeMoney[i].replace("s", "$");
          if (makeMoney[i].contains("S")){
               System.out.println("");
          makeMoney[i] =      makeMoney[i].replace("S", "$");
          System.out.print(makeMoney[i].toString());
          i++ ;
output
Give me a phrase: Viva Las Vegas
Viva
La$
Vega$Message was edited by:
fastmike

Similar Messages

  • HT5621 I Have followed all the steps and still cant remove iCloud to my existing account and add to the new one, the old email account was changed a year ago and cant get that email plus the password don't work please HELP!!

    I Have followed all the steps and still cant remove iCloud to my existing account and add to the new one, the old email account was changed a year ago and cant get that email plus the password don't work please HELP!

    Welcome to the Apple community.
    This feature has been introduced to make stolen phones useless to those that have stolen them.
    However it can also arise when the user has changed their Apple ID details with Apple and not made the same changes to their iCloud account/Find My Phone on their device before upgrading to iOS 7, or if you restore from a previous back up made before you changed your details.
    The only solution is to change your Apple ID back to its previous state with Apple at My Apple ID using your current password, you don’t need access to this address if it’s previously been used with your Apple ID, once you have saved these details enter the password as requested on your device and then turn off "find my phone".
    You should then change your Apple ID back to its current state, verify it once again, delete the iCloud account from your device and then log back in using your current Apple ID. Finally, turn "find my phone" back on once again.
    This article provides more information about Activation Lock.

  • How do i get message+  on my pc... my phone has crashed and i cant get my text messages from it.... please help

    how do i get message+  on my pc... my phone has crashed and i cant get my text messages from it.... please help

    mandingo8005,
    Look no further help is here! Let's get those text messages going on your computer. You need to download the desktop client http://www.verizonwireless.com/wcms/consumer/products/verizon-messages.html to your computer to use Message +. Were you already using Message + on your phone?
    What phone do you have? You mentioned the phone crashed. What issues are you having with the phone?
    JohnB_VZW
    Follow us on Twitter @VZWSupport
    If my response answered your question please click the �Correct Answer� button under my response. This ensures others can benefit from our conversation. Thanks in advance for your help with this!!

  • Cant get itunes to install it keeps saying HRESULT:0x80073712 please help!!!

    I cant get itunes to install on my computer. I uninstalled it and now it wont let me reinstall. It keeps saying error HRESULT:0x80073712 please HELP!!

    Locked Out, Forgot Lock or Restrictions Passcode, or Need to Restore Your Device: Several Alternative Solutions
    A
    1. iOS- Forgotten passcode or device disabled after entering wrong passcode
    2. iPhone, iPad, iPod touch: Wrong passcode results in red disabled screen
    3. Restoring iPod touch after forgotten passcode
    4. What to Do If You've Forgotten Your iPhone's Passcode
    5. iOS- Understanding passcodes
    6. iTunes 10 for Mac- Update and restore software on iPod, iPhone, or iPad
    7. iOS - Unable to update or restore
    Forgotten Restrictions Passcode Help
                iPad,iPod,iPod Touch Recovery Mode
    You will need to restore your device as New to remove a Restrictions passcode. Go through the normal process to restore your device, but when you see the options to restore as New or from a backup, be sure to choose New.
    You can restore from a backup if you have one from BEFORE you set the restrictions passcode.
    Also, see iTunes- Restoring iOS software.

  • I had my hard drive replaced and I cant get my email to work on the new hard drive.  I have the ! in the triangle next to the inbox.  I tried "take all accounts online" and it ddidnt work.  The email account is working on my iphone and ipad.

    I had my hard drive replaced and I cant get my email to work on the new hard drive.  I have the ! in the triangle next to the inbox.  I tried "take all accounts online" and it ddidnt work.  The email account is working on my iphone and ipad, and my macBook is connected to the internet.

    Cant get help with this issue on Apple Support, so I have to go to the Apple store to the Genius Bar to get assistance.  All the help issues are so technical in their jargon, that I cannot understand how to fix the issue.

  • My phone wont let me download anything even free stuff or update.it keep saying something wrong with my billing info so i fix it but still cant download.I signed out sign back in still nothing please help i'm getting angry

    My phone wont let me download anything even free stuff or update.it keep saying something wrong with my billing info so i fix it but still cant download.I signed out sign back in still nothing please help i'm getting angry

    If it says your billing info is wrong that means that your credit card issuer is refusing to approve your account. You will have to solve the problem with your bank or credit card company.

  • How do i get backed up purchases from an old iphone to a new one, but the only problem is an ipod is backed up into the new phone and i cant get my iphone data on to the new phone because its under i pod

    how do i get backed up purchases from an old iphone to a new one, but the only problem is an ipod is backed up into the new phone and i cant get my iphone data on to the new phone because its under i pod?

    Thanks very much!
    Although I had to add everything again to the playlist, at least I can just copy it over in future!

  • Cant get @font-face to work on my new web site

    Hi everyone,
    I Cant get @font-face to work on my new web site.
    I tryed it before on other web sites and it worked just fine.
    Here is the code i am using:
    CSS:
    @charset "utf-8";
    @font-face {
    font-family:"Caviar Dreams",sans-serif !important;
    font-style: normal;
    src:url ("../fonts/CaviarDreams.ttf") format('truetype');
    src:url("../fonts/CaviarDreams.eot") format('eot');
    src: url("../fonts/CaviarDreams.svg") format('svg');
    src:url("../fonts/CaviarDreams.woff") format('woff');
    src:url("../fonts/CaviarDreams.otf") format('otf');
    /* Simple fluid media
    Note: Fluid media requires that you remove the media's height and width attributes from the HTML
    http://www.alistapart.com/articles/fluid-images/
    img, object, embed, video {
    max-width: 100%;
    /* IE 6 does not support max-width so default to width 100% */
    .ie6 img {
    width:100%;
    Dreamweaver Fluid Grid Properties
    dw-num-cols-mobile: 5;
    dw-num-cols-tablet: 8;
    dw-num-cols-desktop: 10;
    dw-gutter-percentage: 25;
    Inspiration from "Responsive Web Design" by Ethan Marcotte
    http://www.alistapart.com/articles/responsive-web-design
    and Golden Grid System by Joni Korpi
    http://goldengridsystem.com/
    /* Mobile Layout: 480px and below. */
    body{
    background-image:url(../images/background/wraper_bg.jpg);
    background-repeat:no-repeat;
    background-attachment:fixed;
    background-size:100% 100%;
    font-family:"Caviar Dreams", sans-serif !important;
    .caviar{
    font-family:"Caviar Dreams", Arial, Helvetica, sans-serif ;
    .index_bg{
    width:100% !important;
    height:100% !important;
    background:url(../images/graphics/index_bg.png) !important;
    background-size:cover !important;
    .welcome_image{
    position:absolute;
    top:35%;
    width:95% !important;
    margin:2% !important;
    .nav{
    color:#FFFFFF !important;
    font-family:"Britannic Bold" !important;
    font-size:14px;
    font-weight:lighter !important;
    .background_white{
    background:rgba(255,255,255,0.7);
    .background_black{
    background:rgba(0,0,0,0.65);
    .background_black_2{
    background:#000 !important;
    .background_noir{
    background:rgba(179,1,1,0.7);
    .background_purple{
    background:rgba(152,131,201,0.7)!important;
    color:#FFFFFF !important;
    width:100% !important;
    height:25px;
    text-decoration:none !important;
    font-family:"Caviar Dreams" ;
    border:0px !important;
    margin:0px !important;
    padding:0px !important;
    .background_purple:hover{
    background:#FFFF00!important;
    color:#000 !important;
    width:100% !important;
    text-decoration:none !important;
    font-family:"Caviar Dreams" ;
    border:0px !important;
    .white{
    color:#FFFFFF !important;
    .black{
    color:rgba(0,0,0,1) !important;
    .red{
    color:#B30101 !important;
    .yellow{
    color:#FFFF00 !important;
    .black_span{
    background:#000000 !important;
    color:#FFFFFF !important;
    margin:1% !important;
    margin-left:5px !important;
    padding:5px !important;
    .black_span_margin1{
    margin-left:0px !important;
    .black_span_margin2{
    margin-left:0px !important;
    .border_white{
    border:3px solid #FFFFFF !important;
    margin:0px !important;
    padding:0px !important;
    .border_gold{
    border:0px solid #000!important;
    margin:0px !important;
    padding:0px !important;
    h1, h2, h3, h4, h5, h6{
    font-family:"Britannic Bold" !important;
    font-weight:lighter !important;
    color:#FFD700 !important;
    margin-left:2% !important;
    margin-right:2% !important;
    margin-top:2% !important;
    margin-bottom:2% !important;
    p{
    font-family:"Caviar Dreams", Arial, Helvetica, sans-serif !important;
    font-size:16px !important;
    color:#FFFFFF !important;
    margin-left:2% !important;
    margin-right:2% !important;
    margin-top:2% !important;
    margin-bottom:2% !important;
    .text-small{
    font-size:12px !important;
    .caviar{
    font-family:"Caviar Dreams" !important;
    I am trying to use the font Caviar Dreams on my new web site but i cant get it right,
    Can anyone tell me what is wrong.
    And also i would like some help with IE9, it seems the header is displaying in blue instead of black on IE9 and 10.
    My web site adrees is marcoalexwebdesign.site11.com  .

    I already fixed the issue, it seems trhat in dreamweaver the fonts ttf , otf, etc must be in a folder named webfonts, and then dreamweaver connects the fonts stylesheet to the main stylesheeet with @inport.I had to unisntall the fonts from my windows and download them again and add tehm with dreamweaver add web fonts feature.
    Thanks ayway.

  • I cant get acces to iTunes store from My new iPad cellulær

    I cant get acces to iTunes store from My new iPad cellulær

    Close your iTunes,
    Go to command Prompt -
    (Win 7/Vista) - START/ALL PROGRAMS/ACCESSORIES, right mouse click "Command Prompt", choose "Run as Administrator".
    (Win XP SP2 &amp; above) - START/ALL PROGRAMS/ACCESSORIES/Command Prompt
    In the "Command Prompt" screen, type in
    netsh winsock reset
    Hit "ENTER" key
    Restart your computer.
    If you do get a prompt after restart windows to remap LSP, just click NO.
    Now launch your iTunes and see if it is working now.
    If you are still having these type of problems after trying the winsock reset, refer to this article to identify which software in your system is inserting LSP:
    iTunes 10.5 for Windows: May see performance issues and blank iTunes Store
    http://support.apple.com/kb/TS4123?viewlocale=en_US

  • I believe my ipads hard drive corrupted when i went from my macbook to a pc...I can get to the screen with cord and itunes but cant get past there to desktop of ipad...Any help would be appreciated....

    I believe my ipads hard drive corrupted when i went from my macbook to a pc...I can get to the screen with cord and itunes but cant get past there to desktop of ipad...Any help would be appreciated....

    Try using this article to help with your iPad not showing up in iTunes---
    http://support.apple.com/kb/TS1538     -This deals with the device not being recognized in iTunes for Windows
    The following steps work well with iPod but i would try them for help with your iPad issue:
    Try connecting your iPad to another USB port directly on the computer. Verify that you're connecting it to a high-powered USB 2.0 port on your computer to be sure iPad is getting power. If you're connecting to a Windows laptop computer through USB, connect the laptop to a power outlet before connecting your iPad. Also, see iPod not recognized when connected to Windows laptop over USB to be sure that your USB ports are supplying enough power.
    Avoid connecting to an external USB hub. If a hub must be used, make sure the hub is USB 2.0, and that it has its own power supply. Also, make sure the hub is connected to a high-power USB 2.0 port on your computer.
    If the issue persists, try disconnecting other USB devices from the computer such as printers, cameras, scanners, external hard drives, and USB hubs to determine if there is a conflict in the USB chain.

  • HT5622 i cant find where its says reset you security question? please help thanks

    i cant find where its says reset you security question? please help thanks

    The Three Best Alternatives for Security Questions and Rescue Mail
         1.  Send Apple an email request at: Apple - Support - iTunes Store - Contact Us.
         2.  Call Apple Support in your country: Customer Service: Contact Apple support.
         3.  Rescue email address and how to reset Apple ID security questions.
    A substitute for using the security questions is to use 2-step verification:
    Two-step verification FAQ Get answers to frequently asked questions about two-step verification for Apple ID.

  • Whenever I connect my 4th generation iPod thouch, all of the playlists on my iPod get deleted. This is very frustrating. Someone please help me? I searched the settings on iTunes and couldn't find anything.

    Whenever I connect my 4th generation iPod thouch, all of the playlists on my iPod get deleted. This is very frustrating. Someone please help me? I searched the settings on iTunes and couldn't find anything.

    Also, when I go on to safari, another alert pops up that safari cannot verify the identity of the website, anything that I type in to as common as google.com. It gives me 3 options to either cancel, look at details, and continue. I've looked at the details of the website of Google and it is legitimate the site. Any help?

  • Well, i was on my laptop now and all of a sudden a pop up message appeared and said "your download is complete" so i went to go check it out and it was 'MacProtector'. i cant delete it and it keeps opening unwanted web pages, please help me sort this out?

    Well, i was on my laptop now and all of a sudden a pop up message appeared and said "your download is complete" so i went to go check it out and it was 'MacProtector'. i cant delete it and it keeps opening unwanted web pages, please help me sort this out someone?

    Refer to:  http://cantalktech.com/2011/05/08/mac-protector/.

  • Every time I sync my Iphone 5c(with ios 8) to Itunes, it 1. deletes all of my purchased music 2. deletes all of my album artwork 3. replaces all of my deleted songs. please help! this is driving me crazy!

    Every time I sync my Iphone 5c(with ios 8) to Itunes, it 1. deletes all of my purchased music 2. deletes all of my album artwork 3. replaces all of my deleted songs. please help! this is driving me crazy! It syncs 100+ songs, when I only want to sync 1! I'm running Itunes 11.3.1.2

    After having experienced similar problems and having it back to work, I have a few suggestions:
    - Try to find out if the syncing stops at a particular track or song. That might - out of the blue - have gotten corrupted in one way or another. Since that song will not be on the iPod, iTunes will try over and over to put it on and crash in one way or another;
    - reformat the iPod as described in the iTunes 9 crash-thread. It takes time (at first it seems to do nothing, but that is because the green bar is moving with very small steps);
    HTH

  • I'm trying to download Lightroom 5 onto my 2nd computer, and I'm getting a message that my license number is invalid, please help!

    I'm trying to download Lightroom 5 onto my 2nd computer, and I'm getting a message that my license number is invalid, please help!

    Keith_Reeder wrote:
    Well - as long as he/she has registered it - it's not really going to hurt to do so.
    I wouldn't post mine up though...
    But in LR registration with Adobe is is not automatic as was the case for PS. It is an optional action that must be initiated by the user. He may not have done so.
    now i downloaded the trial version of lightroom in the new computer
    OP, be sure that you have downloaded the trial for the perpetual version and not for the rental (cloud) version.

Maybe you are looking for

  • How Do I Always Boot From An External Drive

    I successfully installed Mac OS X 10.4.8 on an external hard drive. It boots successfully into OS X, but only if you press option on boot and select the drive or if you boot from the drive inside my Mac Mini and go to startup disk and select the exte

  • No Sound Production

    Hello; I am an experienced linux/unix user and I've never had this problem before, but I'm rather desperate because I can't find a solution, upon STW I came to realize that many people have this problem, but none have a solution applicable to my syst

  • Windows 7 and Xtreme MusicUAA have Probleme on Sacred 2 with OpenAL

    Hi, i can not good English ! I have are Problem whit my Sound Card? " Creative Extreme MusicUAA " Windows 7 and the Game Sacred 2 Driver is install : SBXF_AZFORTE_2_20_0000_V_0? and XFI_SupportPack_2_0 Problem :? When OpenAL in the Sound Options from

  • Alarms ISE

    Hello We have a many alarms notifications you'll find the notification message on attached files Thanks

  • Pump motor stalled.

    When switch on the printer it gives error message " Pump motor stalled. Press ok ". I followed the steps as after press ok, it gives other error message " Cartridge Problem, the following ink cartridges appear to be missing or damaged. Replace the in