sassy
shapes
1 Answer(s)      4 years and 10 months ago
Posted in : Java Beginners

View Answers

August 13, 2008 at 6:58 PM


Hi friend,

import java.io.*;
import java.io.IOException;

public class PiramidExample{
final static int WIDTH = 10;
public static void main(String args[])throws Exception{
System.out.println("Piramid example");
BufferedReader buff=new BufferedReader(new InputStreamReader(System.in));
String str="y";
while(str.equals("Y")||str.equals("y")){
System.out.print("Enter the String value:");
String s=buff.readLine();
if(s.equals("A")){
for (int i = 1; i <= WIDTH; i++) {
for (int j = 1; j <= 2*i - 1; j++) {
System.out.print("");
}

for (int j = 1; j <= WIDTH; j++){
System.out.print("*");
}
System.out.println();
}
System.out.println();
}

if(s.equals("B")){
for(int i=6;i>=1;i--){
for(int j=1;j<=6-i+1;j++)
System.out.print(" ");
for(int k=1;k<=i;k++){
System.out.print("*");
}
System.out.println("");
}
}

System.out.print("would you like to Continue y or n:");
str=buff.readLine();
}
}
}

-------------------------------------------------

Thanks & Regards

Amardeep









Related Pages:
java program of different shapes
java program of different shapes  pls help me to get the code of a java program of different shapes using menu
drawing shapes in applet - Applet
drawing shapes in applet  hi, i need a single applet prgm which draws cone,cube and square in circle.  Hi manju, This is cube example import java.awt.*; import java.awt.event.*; import java.awt.geom.*; import
Java Shapes Bouncing App
Java Shapes Bouncing App  hi guys, im trying to implement... JApplet and contains a panel where * shapes move around on the screen. Also... and reset all margins for all shapes public void
Finding shapes in digital photos - java
Finding shapes in digital photos - java  Hello, I need some hints/tips regarding some project I'm doing. The project is about finding shapes... this information to separate the main different coloured shapes in the photo
Write a Java applet to draw cylinder and pentagon shapes.
Write a Java applet to draw cylinder and pentagon shapes.  Write a Java applet to draw cylinder and pentagon shapes
Creating Shapes using Shape Groups
Creating Shapes using Shape Groups In this section, you will learn how to create shapes using Apache POI library. EXAMPLE import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import
Java - Drawing Shapes Example using color in java
Java - Drawing Shapes Example using color in java  ... will show you how to draw the different types of colorful shapes. This example show the different types of colorful shapes like line, circle and the rectangle. It also
Java - Drawing Shapes Example in java
Java - Drawing Shapes Example in java       Introduction Applet is a program to run... the different types of shapes like line, circle and rectangle
Show Intersection between the Area of two Shapes
Show Intersection between the Area of two Shapes  ... the intersection between the area of shapes in Graphics. Intersection means... by the package java.awt.geom.*. These classes provides the shapes rectangle and oval
Show the Exclusive OR between the Area of two Shapes
Show the Exclusive OR between the Area of two Shapes...*. These classes provides the shapes rectangle and oval respectively. Set... the ExclusiveOR between the two shapes: area1.exclusiveOr(area2);  
Photoshop Cloud Shape Tutorial
org.htmlparser.util.ParserException: C:\downloadingarticles\websitereader\In this tutorial, i'll show you how to make shapes formed by clouds (The system cannot find the file specified
Drawing with Color in Java
;  In this section, you will see how to draw colorful shapes in java swing. There are various colorful shapes have been drawn in the given program. This program has used various types of methods to draw shapes and fill
Summary: Graphics
Java: Summary: Graphics This is a summary of simple graphics methods in the java.awt.Graphics class for drawing with shapes, colors, text, ... Other... Straight-sided shapes (eg, triangles) can be created with Polygon class
Drawing with Gradient Color in Java
gradient shapes. First of all you will know about the gradient color. The gradient... of Gradient class. It used to fill the gradient color in the shapes
Show General Path
Show General Path       This section illustrates you how to create GeneralPath. We have used the class GeneralPath to create three different shapes. For this, we have create
Online Real-Time GPS Phone Tracking Service
Online Real-Time GPS Phone Tracking Service Online Real-Time GPS Phone Tracking Service is a useful service handy to track mobile phones and devices. They come in all forms and different shapes and sizes. Not only they are used
Types of GPS tracking devices
Types of GPS tracking devices GPS tracking devices come in all forms and different shapes and sizes. Whilst they are used on an advanced platform to track satellites and vehicles, they can also be used in households for tracking
Drop Box
Drop Box  program draw 2d shapes in java
Drop Box
Drop Box  program draw 2d shapes in java
openGL
openGL   hii, what is openGL ??   hello, Opengl is used for creating basic shapes and provides these shapes with animation
Fashion Diamond Accessories
Fashion Diamond Accessories Fashion diamond accessories come in many different shapes and sizes, which means that you have to carefully choose the ones you use for a specific outfit. It is very important these days
rob
draw a series of shapes of increasing dimension  Write a java applet (File Name is SectionC.java) which will draw a series of shapes of increasing... and type of the shapes will be determined by the user. So the user will choose
Fresher-Trainee
Fresher-Trainee  a java program to calculate the area of different shapes using Multilevel Inheritance
java
java  Design a simple applet that can draw shapes such as rectangles, circles, Lines and ovals. Set them to different colors
rob
) which will draw a series of shapes of increasing dimension as shown on the following diagram. [Hint: Use a loop]. The number and type of the shapes... in JOPtionPane Question) and the number of shapes to be drawn. Based on the input
rob
will draw a series of shapes of increasing dimension as shown on the following diagram. [Hint: Use a loop]. The number and type of the shapes will be determined... in JOPtionPane Question) and the number of shapes to be drawn. Based on the input number
rob
is SectionC.java) which will draw a series of shapes of increasing dimension as shown on the following diagram. [Hint: Use a loop]. The number and type of the shapes... or Square in JOPtionPane Question) and the number of shapes to be drawn. Based
rob
) which will draw a series of shapes of increasing dimension as shown on the following diagram. [Hint: Use a loop]. The number and type of the shapes... in JOPtionPane Question) and the number of shapes to be drawn. Based on the input
rob
is SectionC.java) which will draw a series of shapes of increasing dimension as shown on the following diagram. [Hint: Use a loop]. The number and type of the shapes... in JOPtionPane Question) and the number of shapes to be drawn. Based
help
help  pls help me to get the code of a java program a program to perform different shapes in a menu using javaapplet
class - Java Beginners
) Abstract class Shapes has one abstract method-area() and a concrete method display(). Class Rectangle should implement the abstract class shapes Interface Shapes has abstract methods-area(),display(). Classes Rectangle and Triangle should
class - Java Beginners
) Abstract class Shapes has one abstract method-area() and a concrete method display(). Class Rectangle should implement the abstract class shapes Interface Shapes has abstract methods-area(),display(). Classes Rectangle and Triangle should
java sample program - Java Beginners
main(String[] args) { Shape shapes[] = new Shape[4]; shapes[0]= new Shape(); shapes[1] = new Square(); shapes[2] = new Rectangle(); shapes[3] = new Circle(); for(int i=0;i
java
the respective shapes. Use the Graphics class components to draw the shapes on a JPanel
Java map building - Development process
Java map building  Hello All I want to build a map for a road network from ESRI shapefiles. Up to now i have the code that can read the shapfiles like polyline, polygon, points etc fetch the coordinates from the shapes. Now
how can i print the selected content of a frame
how can i print the selected content of a frame  hello sir, I am designing a bill calculate program. I want to print the bill in crystal form. I want to skip all the text fields shapes and all the button from the frame.. but all
Java Bouncing Application
to create new shapes -Sorting function in array list The code is too large
coding shape
coding shape  i need to write a simple java program. the system must be in an applet and allows a user to choose whether to draw shapes such as circles, rectangles or lines on the screen. also, user can add circles by choosing
Graphics2D
Java: Graphics2D The javax.swing.Graphics2D class of Java 2 supports many more graphics operations than the Graphics class. For example, Graphics2D additional features Aliasing Shapes Affine transformations (scaling, rotation
Structural Design Patterns
there are several sockets of different sizes, and shapes in a house. Due
Drawing
the Graphics2D class, classes to represent shapes, easier and more powerful image
java - Applet
java  1.An applet program to draw a line graph for y=2x+5.[for suitable values of x & y] 2. An applet program to draw following shapes (1)cone, (2)cube, (3)square inside a circle  Hi friend, this is cubic code
Screen Coordinates
extends Graphics and allows floating-point coordinates, arbitrary shapes, affine
How to design a stone
: Choose "E7E7E7" color and Pen tool (P key) to make two shapes
How to make an animated navigation bar with css
rectangle shapes. Arrow shape: Choose "White" color and "
What is Logo Design
shapes, colors, fonts, and images usually are different from others in a similar... of company. The images, shapes, typefaces and colors display the image of your
java.applet package examples
.    Drawing Shapes This section shows you how to draw circle and lines in applet.    Drawing Shapes using color Applet... different shapes using colors of your choice.    Event Listeners

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.