Results 1 to 4 of 4
Thread: Exponential Shape Program
- 09-23-2008, 03:59 AM #1
Member
- Join Date
- Sep 2008
- Posts
- 3
- Rep Power
- 0
Exponential Shape Program
Hi, I am making a program that will display a design. I am trying to make it look like a fish. So far I have a tail and a body. I do not know how to complete the arc. Here is the code:
-------------------------------------------------------------------------
package fivefifteen;
public class fivefifteen
{//start fivefifteen
public static void main(String[]args)
{//start main
int x = 0;
int y = 0;
x = 0;
y = 10;
System.out.println();
for(int i = 0; i<=10;i++)
{//start for
for(int j = 0; j<=x;j++)
{//start another for
System.out.print(" ");
}//end another for
x++;
for(int j=0;j<=y;j++)
{//start for
System.out.print("_//_");
System.out.print(" ");
}//end for
y--;
System.out.println();
}//end for
x= 10;
y = 0;
System.out.println();
for(int i = 0; i<=10;i++)
{//start for
for(int j = 0; j<=x;j++)
{//start another for
System.out.print(" ");
}//end another for
x--;
for(int j=0;j<=y;j++)
{//start for
System.out.print("_//_");
System.out.print(" ");
}//end for
y++;
System.out.println();
}//end for
}//end main
}//end fivefifteen
-------------------------------------------------------------------------
output:
_//_ _//_ _//_ _//_ _//_ _//_ _//_ _//_ _//_ _//_ _//_
_//_ _//_ _//_ _//_ _//_ _//_ _//_ _//_ _//_ _//_
_//_ _//_ _//_ _//_ _//_ _//_ _//_ _//_ _//_
_//_ _//_ _//_ _//_ _//_ _//_ _//_ _//_
_//_ _//_ _//_ _//_ _//_ _//_ _//_
_//_ _//_ _//_ _//_ _//_ _//_
_//_ _//_ _//_ _//_ _//_
_//_ _//_ _//_ _//_
_//_ _//_ _//_
_//_ _//_
_//_
_//_
_//_ _//_
_//_ _//_ _//_
_//_ _//_ _//_ _//_
_//_ _//_ _//_ _//_ _//_
_//_ _//_ _//_ _//_ _//_ _//_
_//_ _//_ _//_ _//_ _//_ _//_ _//_
_//_ _//_ _//_ _//_ _//_ _//_ _//_ _//_
_//_ _//_ _//_ _//_ _//_ _//_ _//_ _//_ _//_
_//_ _//_ _//_ _//_ _//_ _//_ _//_ _//_ _//_ _//_
_//_ _//_ _//_ _//_ _//_ _//_ _//_ _//_ _//_ _//_ _//_
- 09-23-2008, 04:07 AM #2
Take a piece of graph paper and design what you want the output to look like. Then go row by row and create println() statements to output each row with the chars and blanks to match the design on the graph paper.
- 09-23-2008, 04:15 AM #3
Member
- Join Date
- Sep 2008
- Posts
- 3
- Rep Power
- 0
- 09-23-2008, 04:31 AM #4
The first step is to design the output. Then figure out how to output each line of the figure starting at the top and moving down.
You have to look at each line and write some code to output it.
isn't there an easier way to do it?
Similar Threads
-
Help with Move Shape
By romina in forum AWT / SwingReplies: 2Last Post: 12-09-2010, 04:25 AM -
implementing shape
By sidkdbl07 in forum Java 2DReplies: 1Last Post: 01-12-2008, 07:42 PM -
weird looking shape JButton is it possible?
By unhurt in forum AWT / SwingReplies: 8Last Post: 11-03-2007, 10:10 AM -
tool to create shape frame
By boy22 in forum AWT / SwingReplies: 1Last Post: 08-05-2007, 05:10 AM -
How to change shape of JButton
By FaRuK in forum AWT / SwingReplies: 1Last Post: 05-19-2007, 01:56 PM
Bookmarks