Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: el gato as output

  1. #1
    Junior Member
    Join Date
    May 2010
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default el gato as output

    I don't get the right output when I run it. can somebody help me?

    import java.util.*;
    import java.io.*;
     
    public class Labex06
    {
         public static void main(String []args)
         {
                print_header();
                char []a = {'e','l',' ','g','a','t','o'};
                char []b = new char[8];
                char []c = new char[10];
     
                String thecat = Arrays.toString (a);
                b[0] = 'e';
                b[1] = 'l';
                b[2] = ' ';
                b[3] = 'g';
                b[4] = 'a';
                b[5] = 't';
                b[6] = 'o';
     
                for(int i = 1; i-1<= 7;i++)
                {
    				c[i-1] = (char) (-2720.0 + (6359.65 * i) -(5231.3167 * Math.pow(i,2)) + (2063.1875 * Math.pow(i,3)) - (421.9375 * Math.pow(i,4)) + (43.1625 * Math.pow(i,5)) - (1.7458333 * Math.pow(i,6)) + 0.5);
     
    			}
     
    			System.out.printf(" String a = %s%s%s%s%s%s%s\n",a[0],a[1],a[2],a[3],a[4],a[5],a[6]);
    			System.out.printf(" String b = %s%s%s%s%s%s%s\n", b[0],b[1],b[2],b[3],b[4],b[5],b[6]);
    			System.out.printf(" String c = %s%s%s%s%s%s%s\n", c[0],c[1],c[2],c[3],c[4],c[5],c[6]);
    			System.out.println("\n thecat =" + thecat);
     
    			 }
    			 public static void print_header()
    			 {
    				 System.out.println("Programmer:           Section: LD01");
    				 return;
    				 }
    				}


  2. #2
    Forum old-timer
    Join Date
    Nov 2008
    Location
    Faversham, Kent, UK
    Posts
    472
    My Mood
    Mellow
    Thanks
    4
    Thanked 58 Times in 54 Posts

    Default Re: el gato as output

    Maybe if you explained WTF it is supposed to be doing, we might take an interest...

    Also, getting your indentation and brackets consistent would make it a lot more readable.

Similar Threads

  1. non well-formed output
    By luca.santaniello in forum Web Frameworks
    Replies: 1
    Last Post: November 19th, 2009, 03:52 AM
  2. how to output using JLabel?
    By qaromi in forum AWT / Java Swing
    Replies: 1
    Last Post: August 30th, 2009, 02:09 PM
  3. OutPut.
    By chronoz13 in forum Java Theory & Questions
    Replies: 3
    Last Post: August 29th, 2009, 10:54 AM
  4. Replies: 3
    Last Post: August 19th, 2009, 11:30 AM
  5. [SOLVED] Java program error in displaying Output
    By crazydeo in forum AWT / Java Swing
    Replies: 9
    Last Post: May 14th, 2008, 10:42 AM