SophiaPretty

(5)

$14/per page/Negotiable

About SophiaPretty

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing Hide all
Teaching Since: Jul 2017
Last Sign in: 211 Weeks Ago, 3 Days Ago
Questions Answered: 15833
Tutorials Posted: 15827

Education

  • MBA,PHD, Juris Doctor
    Strayer,Devery,Harvard University
    Mar-1995 - Mar-2002

Experience

  • Manager Planning
    WalMart
    Mar-2001 - Feb-2009

Category > Computer Science Posted 14 Nov 2017 My Price 8.00

prgram to change the word cartons to tcarons

I need the prgram to change the word cartons to tcaronst plz dont only give the code I also need an explanation on how to do it and how i would change other letters aroudn if i needed to thanks! this is what i have so far

 

import java.util.Scanner;

/**

 * CS 170 Proficiency Quiz 4.

 * InsideOut2 program.

 *

 * @author Summer 17

 */

public class InsideOut2

{

  /**

   * Write the insideOut2() function.

   *

   * @param str an even-length String of at least 2 characters.

   * @return a String as described below.

   *

   * The function has one parameter: a String str 

   * that is at least 2 characters long and of even 

   * length. The function returns a new String where 

   * the middle two characters have been removed 

   * and placed at the end. 

   * 

   * Here some sample input and output:

   *  insideOut2 ("Carton") returns "Caonrt" // rt moved to end

   *  insideOut2 ("Hi") returns "Hi" // Hi removed and then moved to end, so no change. 

   *  insideOut2 ("Barbara Anne") returns "Barba Annera" //ra moves end.

   */

  // TODO WRITE THE FUNCTION insideOut2 HERE

  public static void main(String[] args) 

  {

    Scanner in = new Scanner(System.in);

    System.out.print("Type the String to be converted: ");

    String str = in.nextLine();

    System.out.println(insideOut2(str));

  }

   

  public static String insideOut2(String str) 

  {

    int wordLen = str.length();

    int centerLen = wordLen / 2;

     

    //output

    String answer = (str.substring(0, centerLen - 1))

      + (str.substring(centerLen + 1, wordLen))

          + (str.substring(centerLen - 1, centerLen + 1));

        

        return answer;

        }

}

Answers

(5)
Status NEW Posted 14 Nov 2017 01:11 PM My Price 8.00

-----------  ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly

Not Rated(0)