Cerrado

Small Java homework for school -- 2

Este proyecto recibió 8 ofertas de freelancers talentosos con una oferta promedio de $20 USD.

Obtén cotizaciones gratis para un proyecto como este
Empleador trabajando
Presupuesto de Proyecto
$10 USD
Ofertas Totales
8
Descripción del Proyecto

Write a program that has the main method and another method called parseString.

The parseString method:

• is public

• is static

• does not return a value

• has one parameter of type String

• takes the individual characters in the String passed as an argument, capitalizes them and separates them by a hyphen

• it then prints the resulting string to the output console

For example, if the method was called from the main method passing the string “hello”, it should print to the output console the string: “H-E-L-L-O”.

To test the parseString method, you may call it multiple times from the main method passing different strings.

The following is the header for the method:

public static void parseString(String str)

{

// provide your implementation here

}

Hints:

My solution involved writing a for loop to get the individual characters in the String argument.

I also used the length, charAt and toUpperCase methods of the String class; as well as the toString method in the Character class to convert a char value to a String value.

You, of course, don’t have to use the same solution I did, but make sure that your method works correctly regardless of the string that is passed as an argument.

Buscando hacer algo de dinero?

  • Establece tu presupuesto y período de tiempo
  • Describe tu propuesta
  • Consigue pago por tu trabajo

Contrata Freelancers que también oferten en este proyecto

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online