Question: Im having trouble figuring out why my code doesnt work. First off, Im new to Java so bear with me.
The task is:
Write a program that reads a sequence of integer inputs and prints the cumulative totals. If the input is 1 7 2 9, the program should print 1 8 10 19.

```
package lektion05forb;

    import java.util.Scanner;

/**
 *
 * @author Lars
 */
public class P52LoopsC 
{

/**
 * @param args the command line arguments
 */
public static void main(String[] args) 
{

    Scanner input = new Scanner(System.in);
    System.out.print("Numbers: ");
    double cumulative_sum = 0;
    String output_cumulative_sum= "";

    while (input.hasNextDouble())
    {
        double input_number = input.nextDouble();
        cumulative_sum += input_number;
        output_cumulative_sum += String.format("%s ", String.valueOf(cumulative_sum));
        break;
    }
    input.close();
    System.out.println(output_cumulative_sum);
}

}

```

When I input a sequence of numbers like 3 4 5 8 2, it returns with 34582, instead of the cumulative sum of the numbers. Can anyone explain why, and how i can fix it so it returns the cumulative total of the sequence?

Answer: 
You can do this with [parse\_url](http://php.net/manual/en/function.parse-url.php)

```
$url = 'www.google.be';
if (parse_url($url, PHP_URL_SCHEME) === null) $url = 'http://'.$url;

```
Just use [str\_replace](http://php.net/manual/en/function.str-replace.php):

```
<a href="http://<?php str_replace('http://', '', $model->www); ?>" Click me</a>

```

UPDATE: If you are also concerned about other protocols (see DarkBee's comment):

```
<a href="http://<?php str_replace(array('http://', 'https://', 'ftp://'), '', $model->www); ?>" Click me</a>

```