Results 1 to 2 of 2
Like Tree1Likes
  • 1 Post By JosAH

Thread: can u please Help me . please .. !!!

  1. #1
    nakz15 is offline Member
    Join Date
    Oct 2011
    Posts
    1
    Rep Power
    0

    Default can u please Help me . please .. !!!

    Java Code:
    /**
     *
     * @author BAG-AO
     */
    public class ass {
        private static String ms (String S) {
            int i = 0,k=0,n,m=0;
            String T,X, Y;
            S=S.trim();
            while (S.indexOf(' ',i) !=-1){
                i=S.indexOf(' ',i);
                T=S.substring (k,i);
                Y=S.substring(m,i);
                n=Y.length();
                X=""+n;
                S=T+n+S.substring (i);
                i=i+X.length()+1;
                m=i;
            }
            T=S.substring (i);
            n=T.length();
            S=S+n;
            return S;   
            }
        private static int[] ma (int[] arr, int value) {
            int k, n=0;
            for (k=0;k<arr.length; k++)
            if (arr[k]==value) n++;
         int [] newarr= new int [arr.length+n];
            for (k=0;k<n;k++) 
                newarr[k]= (int) Math.cos (Math.PI/4*k);
            for (k=0;k<arr.length;k++)
                newarr[n+k]=arr[k];
                return newarr;
            }
        private static int mi (int a,int b){
            return (a+b)%100/10;
        }
        public static void main (String []args){
            int[] A ={1,1,2,3,5,2,1};
            int k,n;
            for (k=3;k>-1;k--){
                A=ma(A,k);
       
           }for (n=0;n<A.length;n++){
                System.out.print(A[n]+"*");
            }
            System.out.println ();
            
            String mystr=" This is your Java programming examination ";
            String result=mystr.toUpperCase();
            result=ms (mystr);
            System.out.println(result);
            
            int num1=9876;
            int num2=26445;
            int num3;
            num3=mi (num1,num2);
            System.out.println(num3);
        }
        
        
        }
    OUTPUT:
    -9.0
    0.0
    5.2
    14.5




    i need an output like this :
    1*0*0*0*1*0*0*0*-1*1*0*1*1*1*2*3*5*2*1
    this4 is2 your4 programming11 examination11
    2

    what statement should i change ?
    can anybody HElp me please .!!!
    Last edited by JosAH; 10-10-2011 at 07:14 PM. Reason: added [code] ... [/code] tags

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    12,999
    Blog Entries
    7
    Rep Power
    19

    Default Re: can u please Help me . please .. !!!

    The last print statement in your program is supposed to be printing an int value; how on earth can it be 14.5? The other output statements don't match either. I think this is all nonsense.

    kind regards,

    Jos
    Fubarable likes this.
    cenosillicaphobia: the fear for an empty beer glass

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •