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: java problem

  1. #1
    Junior Member
    Join Date
    Aug 2009
    Posts
    1
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question java problem

    i need help...i am a student, and a new enrollees of java...
    here is the problem...


    "write a program that ask the user to enter the size of a triangle (1 to 50).then print the triangle by printing a series of lines consisting of asterisks.the first line will have 1 asterisk, the next two will have two and so on....with each line having one more asterisk than the previous line up to the number entered by the user.on the next line print one less asterisk and continue by decreasing the number of esterisk by 1 for each successive line until any one asterisk is printed."
    hint: use nested loops, the outside loop controls the number of lines and the inside loops controls the number of asterisk to print on a line.

    i hope, anyone will help me on this problem...pls....


  2. #2
    Junior Member
    Join Date
    Aug 2009
    Posts
    8
    Thanks
    0
    Thanked 3 Times in 2 Posts

    Default Re: java problem

    although i suspicious that your just going to rip me off, as a way for cheating on an assingment, i going to type this out because it is incredibly easy I only hope you actually learn from what Ive sent or other wise fail this class your in because you're not doing what you needed to. Theres a

     import java.awt.*;
    import javax.swing.*;
    import java.applet.*;
    import java.util.*;
    public class Asterisk
    {
    	public static void main (String [] args)
    	{
    	 int size;
    	System.out.println("Enter Triangle size");
    	Scanner key = new Scanner(System.in);
    	size = key.nextInt();
     
    	System.out.println(size);
     
    	for (int i=0; i<size; i++)
    	{
    		for (int f=0; f<i; f++)
    		{
    		System.out.print("*");
    		}
    	System.out.println("*");
     
    	}
     
    	}
    }

  3. The Following 2 Users Say Thank You to JavaGreg For This Useful Post:

    JavaPF (August 14th, 2009), Mj Shine (August 17th, 2009)

Similar Threads

  1. Java session problem
    By Padmaja in forum JavaServer Pages: JSP & JSTL
    Replies: 2
    Last Post: August 5th, 2009, 09:06 PM
  2. [SOLVED] Error "TitleChanger is abstract; cannot be instantiated"
    By Uzual in forum AWT / Java Swing
    Replies: 2
    Last Post: May 26th, 2009, 11:23 AM
  3. Java GUI problem in paintComponent?
    By Richard_ in forum AWT / Java Swing
    Replies: 2
    Last Post: May 1st, 2009, 08:19 AM
  4. [SOLVED] JAVA JList Problem in visual images
    By antitru5t in forum AWT / Java Swing
    Replies: 4
    Last Post: April 15th, 2009, 03:09 PM

Tags for this Thread