Search:

Type: Posts; User: Dixxon

Search: Search took 0.22 seconds.

  1. Replies
    7
    Views
    200

    Re: how to add strings as numbers?

    oh yeah thanks , i got it work with String.valueOf()

    but while adding 3333333333333 + 3 it gives me an error :

    Exception in thread "main" java.lang.NumberFormatException: For input string:...
  2. Replies
    7
    Views
    200

    Re: how to add strings as numbers?

    i think it would look like :

    public static String addera (String tal1, String tal2)
    {
    String Numb1= "30";
    String Numb2 ="30";
    int IntNumb1 = Integer.parseInt(Numb1);
    int IntNumb2 =...
  3. Replies
    7
    Views
    200

    Re: how to add strings as numbers?

    will that work ? as the method i am using is a string method , looks like this


    public static String add (String numb1, String nub2)
    {
    // any code
    }
  4. Replies
    7
    Views
    200

    how to add strings as numbers?

    hey

    i am trying to add two strings as numbers, as an exampel :

    String numb1 ="30";
    String numb2 ="30";

    where the answer would be 60 and not 3030. any ideas how to do that ?
  5. Replies
    22
    Views
    232

    Re: something is wrong with if-statement?

    i am very new to java and this was the best i could come up with... so i will just wait for some who can fix the problem
  6. Replies
    22
    Views
    232

    Re: something is wrong with if-statement?

    i meant that it doesnt really matter for me if the code is poorly written as long it works and are able to run the porgram ... so any idea how to get the highest vaule ?
  7. Replies
    22
    Views
    232

    Re: something is wrong with if-statement?

    hehe no i meant that it works as it should except registering the right highest value
  8. Replies
    22
    Views
    232

    Re: something is wrong with if-statement?

    what do you mean ? i just put the code in eclipse (editing program) and run the program. i just tested and it worked.
    and yh i know its poorly formatted but it does not matter right now as long as...
  9. Replies
    22
    Views
    232

    Re: something is wrong with if-statement?

    so i did my best
    import java.util.*; // Scanner, Locale

    class tempraturmätningar
    {
    public static void main (String[] args)
    {
    System.out.println ("values\n");
  10. Replies
    22
    Views
    232

    Re: something is wrong with if-statement?

    ahh its kinda written in swedish (i translated the the small code above before posting ) so will it be any help to get the program? .... btw exercise is about using arrays so maybe there is a better...
  11. Replies
    22
    Views
    232

    Re: something is wrong with if-statement?

    ohh yeah i enter "5"and "6" and yet the array had a zero value
    also here is the behavior when entering negtive vaules
    input:
    week 1 :-5.0 -8.0
    week 2 : -6.0 -3.0

    output:
    an ID [0.0,...
  12. Replies
    22
    Views
    232

    Re: something is wrong with if-statement?

    ah never mind , my bad ... it gave "an ID [0.0, 5.0, 6.0]"
  13. Replies
    22
    Views
    232

    Re: something is wrong with if-statement?

    it gives a error

    ps:sorry btw i am very new to java :)
  14. Replies
    22
    Views
    232

    Re: something is wrong with if-statement?

    ohh i hope that the code is cleaner now :)


    it should not contain any zeros as the array contains only users input which in this cause are only negative nummbers.
    i noticed that...
  15. Replies
    22
    Views
    232

    something is wrong with if-statement?

    double[]

    t[week][Measurement] = in.nextDouble (); // input
    int NumberOfWeeks = in.nextInt (); // input
    int MeasurementWeekly = in.nextInt (); // input

    sum = new double[NumberOfWeeks +...
Results 1 to 15 of 15