Drawing this shape 'x' wide and with 'y' character, according to input

I need to draw a diamond shape with the character in which the user enters. It also has to be as thick as the user enters. So it would with $ and 5 spaces long it would be something like:
  $
$$$
$$$$$
$$$
  $Ican get the input and all that stuff correctly. And I figured on using a for statement to print the characters. But I cannot figure out how to put it all together with the correct spacing and correct number of characters on each line. What I have is basically:
tnumber= (number-((number/2)-1));
for(int i=0; i < tnumber;i++)
     System.out.print(" ");
System.out.println(character);

hmm I have this now, except it only works for the width of 5, because thats the number I was testing as I wrote the program. Now it only works for 5, lol - How can I fix it:
//Begin displaying the graphic
               tempnumber = (number-((number/2)+1));
               for(int i=0; i < tempnumber;i++)
                    System.out.print(" ");
               System.out.println(character);          //First line of the diamond
               tempnumber = (number-((number/2)+2));
               for(int i=0; i < tempnumber;i++)
                    System.out.print(" ");
               tempcharacter = tempcharacter+2;
               for(int i=0; i < tempcharacter;i++)
                    System.out.print(character);
               System.out.println();          //Line Break
               tempnumber = (number-((number/2)+3));
               for (int i=0; i <tempnumber;i++)
                    System.out.print(" ");
               tempcharacter = tempcharacter+2;
               for (int i=0; i < tempcharacter;i++)
                    System.out.print(character);
               System.out.println();          //Line Break
               tempnumber = (number-((number/2)+2));
               for(int i=0; i < tempnumber;i++)
                    System.out.print(" ");
               tempcharacter = (tempcharacter-2);
               for(int i=0; i < tempcharacter;i++)
                    System.out.print(character);
               System.out.println();          //Line Break
               tempnumber = (number-((number/2)+1));
               for(int i=0; i < tempnumber;i++)
                    System.out.print(" ");
               System.out.println(character);     //The last Line of the diamond
               System.out.println();

Similar Messages

  • I just Draw a shape in Geometry and key framing and everything is good ,bu

    I just Draw a shape in Geometry and key framing and everything is good ,but as soon as I get to the secondary for set the changes everything will change !The shape will automatically change its place to couple pixel up and to the right ! my footage is in 2K red and was shot by Red Camera . I really don`t know what is the problem , any helps ?

    Howdy,
    This is a really good question about one of the bigger challenges of building a 3D project. When you add objects to the Canvas (including drawing), they get added in the camera's viewspace, facing the camera and sharing the same up-vector (i.e. positive Y is up). This is all well and good, but what about doing what you ask, where you want to add an object in the localspace of another object? Let's look at your example: adding a shape that is coplanar to a photo, with the camera not necessarily aligned with the photo.
    As Mark suggested, you can draw the shape in the camera's viewspace and then drag-and-drop the Position and Rotation channels from the photo onto the shape. This will replace the shape's Position and Rotation values with that of the photo, making them coplanar and located in the same place. The shortcoming of this method is that you draw the shape at a size that seems correct in the Canvas, but once it's moved to the same place as the photo, it will often turn out to be too small or large. Then you have to make further tweaks.
    Another solution is to use the Isolate command. Isolate temporarily aligns the current view to the selected object and solos that object. So you could isolate the photo and then draw the shape in the Canvas and it will be coplanar with the photo. The only caveat is that the moment you finish drawing the shape, it will disappear. This is because the photo is still isolated (and soloed). As soon as you de-isolate the photo, everything will reappear.
    The easiest way to use Isolate for new photos—not ones already in the project—is to place the photo in a 3D group, position the group where you want the photo and shape to be, then isolate the group and add anything you want to it (shapes, image, text, etc).

  • I just Draw a shap in Geometry and key framing and everything is good

    I just Draw a shape in Geometry and key framing and everything is good ,but as soon as I get to the secondary for set the changes everything will change !The shape will automatically change its place to couple pixel up and to the right ! my footage is in 2K red and was shot by Red Camera . I really don`t know what is the problem , any helps ?

    SKF5656 wrote:
    I just purchased a new laptop, so consequently had to buy Itunes Match to get all of my music back.
    No you didn't.
    Now everything is in the cloud
    Except for anything you did not purchase in iTunes Store.
    Only you iTunes purchases are in the cloud.
    Reada the article that brenden dv posted to copy your iTunes library to new computer.

  • How can a company sell a Times Capsule appliance as a solution for backup and die for this manufacturing fault? And with that Apple? nothing, or technical assistance. Of a sledgehammer, open the device and attempt to recover your files by force!???

    How can a company sell a Times Capsule appliance as a solution for backup and die for this manufacturing fault? And with that Apple? nothing, or technical assistance in Brasil. Of a sledgehammer, open the device and attempt to recover your files by force!???

    Heat up the bottom rubber mat with a hairdryer for 5-10 minutes to loosen the adhesive, then pull the rubber mat away from the bottom metal plate carefully.
    Then use a screwdriver to remove the 10-12 screws to open up the case.

  • Is there a way to simply draw combined shapes ?

    Hi,
    I try to draw a popup like that:
    Popup
    I'm searching for the simplest way to draw this shape, and I think it's by combined a Rectangle whith round corners and 2 ArcTo Shapes.
    My question is: can I merge these shapes to create the popup ?
    Thanks.

    Reviving an old thread after a little discovery!
    Actually, the ShapeCombine was there, but hidden...
    I found that by seeing the bug report [ShapeSubtract is poorly named and its fields obscure|http://javafx-jira.kenai.com/browse/RT-3153].
    Looking at the reference, I saw the object subtracts not two shapes, but two sets of shapes.
    I tried to put a pair of shapes only in the first field, and it worked!
    def BASE_SIZE = 500;
    def MARGIN = BASE_SIZE / 30;
    def RADIUS = BASE_SIZE / 2 - MARGIN * 4;
    Stage
      title:   "T"
      visible: true
      scene:   Scene
        width:   BASE_SIZE
        height:  BASE_SIZE
        fill:    Color.web('#00BABE')
        content:
          ShapeSubtract
            fill:    Color.YELLOW
            stroke:  Color.RED
            onMouseClicked: function (evt: MouseEvent)
              println("Ouch! {evt}");
            strokeWidth: 5
            a:
              Circle
                centerX: BASE_SIZE / 2
                centerY: BASE_SIZE / 2
                radius:  RADIUS
              Rectangle
                x:       MARGIN * 2
                y:       BASE_SIZE / 2 - BASE_SIZE / 6
                width:   BASE_SIZE - MARGIN * 4
                height:  BASE_SIZE / 3
                arcWidth:    50
                arcHeight:   30
    }So I can give a variant of my code above:
    class Popup extends CustomNode
      // As above
    // Simpler one!
    class SimplerPopup extends CustomNode
      var arcSize = 15;
      var width = 100;
      var height = 60;
      var fill = Color.LIGHTGRAY;
      var stroke = Color.DARKGRAY;
      override public function create(): Node
        ShapeSubtract
          fill: fill
          stroke: stroke
          a:
            Rectangle
              width:   width
              height:  height
              arcWidth:  arcSize
              arcHeight: arcSize
            // The stem
            Path
              elements:
                MoveTo { x: width - arcSize + arcSize / 1.7, y: arcSize / 4 }
                QuadCurveTo
                  absolute: false
                  x: arcSize / 1.5, y: -arcSize / 4
                  controlX: arcSize / 3, controlY: -arcSize / 3
                QuadCurveTo
                  absolute: false
                  x: -arcSize / 2.8, y: arcSize / 1.4
                  controlX: -arcSize / 2.7, controlY: arcSize / 3
    Stage
      title: "Popup with Stem"
      width:  300 * 2
      height: 300
      scene: Scene
        content:
          Popup
            translateX: 30, translateY: 30
            arcSize: 48, width: 200, height: 160
            fill: Color.YELLOW, stroke: Color.ORANGE
          Popup { translateX: 75, translateY: 20 }
          Popup { translateX: 10, translateY: 175, arcSize: 9, fill: Color.LIGHTBLUE }
          SimplerPopup
            translateX: 330, translateY: 30
            arcSize: 48, width: 200, height: 160
            fill: Color.YELLOW, stroke: Color.ORANGE
          SimplerPopup { translateX: 375, translateY: 20 }
          SimplerPopup { translateX: 310, translateY: 175, arcSize: 9, fill: Color.LIGHTBLUE }
    }Good to know!

  • It doesn't seem to be as sharp as it is in the "Develop" mode.  This seems to occur more with wide angle than macro.  Any suggestions would be extremely welcome...Norm

    Here's my problem: (Lightroom 4)  I will edit a photo in "Develop" to the point where it looks great and I'm satisfied with the results.  Then I click back to "Library" and the photo seems to go a little out of focus.  When I export the photo, it doesn't seem to be as sharp as it is in "Develop" mode.  This seems to occur more with wide angle than macro.  Any suggestions would be greatly appreciated!  Norm

    Okay guys, some good news!
    First of all, thanks again to Sean for his suggestion to look inside the transaction log!
    Indeed that specific table that I noticed was filling the transaction log, is the largest table in my database. Its size stands at about ~65GB. Like I said earlier, it has no LOB or Overflow columns. But one interesting fact about it is - it had absolutely
    no indexes! It was a heap, but it was also partitioned. I didn't know a case like this could cause such problems with shrink? It's weird but it also kinda makes sense in a way.
    Anyways, I ran a script to create a partitioned clustered index on that table. That took pretty much all day long due to the table size (almost 7 hours). But once that was finished, shrinking the data file was a breeze!
    At least... Until the shrink started "hanging" again because now it started dealing with my
    second largest table (~55GB). Like the first one, this one is also a partitioned
    heap without any indexes. So I expected this to happen. I guess the solution this time will be the same: Create a clustered index.
    Does this make sense to you? A partitioned heap table causing such heavy workload to SHRINK, but when it's moved to a clustered index, suddenly it flies?
    Eitan Blumin; SQL Server Consultant - Madeira SQL Server Services

  • When I import video from my iphone to imovie it doesnt look right, it makes everyone look wider and shorter. Is there a way to fix this?

    When I import video from my iphone to imovie it doesnt look right, it makes everyone look wider and shorter. Is there a way to fix this?

    This is close.  I did a bit more digging I have found a few more things.   It appears that the input dialog is a read once on connect and then it never updates.  I had my iPhone connected to my Mac when I did my convert from FILMiC Pro to my Camera Roll.  Just on a whim, I dissconnected my iPhone with FCPX open and then connected it again.  This time when I opened up the Import window the movie I converted showed up.   It appears my issue may have simply been related to the specific series of operations that I happened to use at the time I was trying to perform an import to FCPX.
    One last item of note.  There is a movie in my Camera Roll that FCPX still does not see.  This was a movie shot by my son-in-law of my grandaughter on his iPhone and then it was sent, via message, to my iPhone.  Obviously it is a highly compressed video of unknown compression and frame rate.   Regardless, FCPX does not see this video.  I'm guessing it is not a .mov quicktime file but some other format specific to imessage video.
    Thanks for the help Russ.  It at least pointed me in the right direction.  I understand why no one else could comment as I'm guessing no one else has had an issue.  A very subtle "feature".

  • Dear Friends, I am trying to draw a structure in Adobe Illustrator with 3D effect. But I am unable to give it proper shape. Can someone please help me for drawing the similar structure as showed below. I have facing problems in giving 3D effect.

    Dear Friends, I am trying to draw a structure in Adobe Illustrator with 3D effect. But I am unable to give it proper shape. Can someone please help me for drawing the similar structure as showed below. I have facing problems in giving 3D effect.
    Thanks a lot for your great help...

    i made a quick example:
    and what it's made of:
    just shapes and gradients. used a combination of pathfinder and shape builder to get the shapes exact.

  • How to draw a shape with line tool then fill with colour

    How can i draw a shape with the line tool and then fill it with colour

    Click and drag from one anchor point to the next, making sure that each new line segment begins where the last one ended. The Line Tool will snap onto the anchors.
    Once you're done creating what looks like a closed path, the lines are still separate objects. To combine them into one path, select them all and press Ctrl/Cmd+J (for Join) or via the menu select Object > Path > Join.
    The Pen Tool can be used in a similar manner, but each segment will be a continuation rather than a separate object. The last (closing) click will be indicated by a tiny circle on the mouse pointer.
    If you make an open path, Ai will still "fill" it with a fill color by assuming a straight path between the last open anchor points. Individual straight paths, however, such as those drawn by the line tool, have no "inside", so they won't show the fill color even if you have assigned one.
    Allen

  • Draw a shape and add it to cells in a JTabel. Help Please

    Hi all
    I have written some code that draws a shape using Graphics2D.
    What I am after being able to do is create this shape then place it in a cell of a JTable.
    One Other thing is I need to create different color shapes for each row in the table.
    is this posable ??
    Any help would be appreciated
    Craig
    import java.awt.*;
    import javax.swing.*;
    public class RectangleDemo2D extends JFrame {
      private Color color1 = new Color(255, 3, 3);// Color
      private Color color1a = new Color(255, 3, 3, 155); // Color with Alpha
      private Color color2 = new Color(255, 255, 255, 155); //Color White
      int x = 150;
      int y = 150;
      int w = 12;
      int h = 12;
      int arc = 6;
      GradientPaint gradient = new GradientPaint(5, 0, color1, 5, 90, color2, false);
      final static BasicStroke stroke = new BasicStroke(1.0f);
      public void paint( Graphics   g) {
        Graphics2D g2 = (Graphics2D) g;
        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
        g2.setPaint(gradient);
        g2.fillRoundRect(x, y, w, h, arc, arc);
        g2.setPaint(color1a);
        g2.setStroke(stroke);
        g2.drawRoundRect(x, y, w, h, arc, arc);
        //ImageIcon ico = new ImageIcon("check.png"); // This adds a check image
       // g2.drawImage(ico.getImage(), x, y - 3, this);
      public static void main(String s[]) {
        RectangleDemo2D demo = new RectangleDemo2D();
        demo.setBackground(Color.white);
        demo.pack();
        demo.setSize(new Dimension(300, 300));
        demo.show();
    }

    Hi,
    You can check out a similar thread where the poster has opted to use imageicons instead of shapes. That thread is here.
    http://forums.java.net/jive/thread.jspa?threadID=15074&tstart=0.
    As for creating different color shapes for different cells of the jtable, it is definitely possible once you have a custom renderer for your jtable. Just read up on how to create custom table cell renderer.
    cheers,
    vidyut
    http://www.bonanzasoft.com

  • I would like to find a program to draw lines, shapes and words for my iMac.

    If anyone can help me find a program or App for my iMac that lets me draw lines, shapes and letters.
         Thank You
         Sandy

    http://www.sketchup.com/
    Try this it is a free download and it is a great program. I almost feel guilty not paying anything:)

  • Drawing a shape with a mouseclick

    How could i set up an Applet that draws a shape such as a square or circle when the mouse is clicked?

    Basically I think you must have a thread that invokes your panel paint() method all the time. In the paint method I think you are painting different rectangles found in an array list. What you do is (as CeciNEstPasUnProgrammeur) add a mouse listener on the your panel, and on click you just create a new rectangle, and add it in that array. This will be cought immediatly by your paint method and you will see a rectangle displayed on the screen :)

  • I had 2 Apple IDs but now Apple implemented new conditions and i can't use one of them after 90 days using the prior one..! - "This Device Is Already Associated With an Apple ID"

    I have two Apple IDs because i travel frequently between Mexico and the US, and the apple stores offer different products, so i like to download music, movies and TV series from both sites.
    Apparently apple changed the conditions, becauise until a few days ago i could log our from one account and log in from my other one. Yesterday i was at Miami International Airport and wanted to download a few chapters from one of my TV series (Walking Dead) to watch on my way to Mexico City, but a pop up window came up saying "this device is already associated with an apple id". Curoiously, the ID to which i was connected to was precisely the one under which i had bought weeks ago the chapters i was wanting to download from the cloud. So it says i have to wait 90 days to change apple id.... weard! probably i accepted these terms when dowloading a new IOS version, so legally I'm dead in complaining, but why is it that if i am paying for all that i buy as a model citizen i am now blocked from jumping from one apple id to another one???? I can certainly buy another ipad and have one with one id and another one with the other, but is there any other way i can keep the two in just one device?? If i don't use i-could would anything change? This is really making me mad, and is the first time i have thought of moving our of mac products into samsung or others and buy my music and movies somewhere else where stupid restrictions like this one do not exist. Please help with a solution!

    OK, but in my ipad, the apple id i have in itues is already the one  iwant to have, but th one i used to sin in for i-coud is the other one. Any tip as to how to change the apple id for icloud and any idea how to know what apps i bought with the other apple id so as to delete them from my ipad to avoid being asked to enter another apple id every time they get updated? thanks!

  • I have a 2nd generation Ipod. I have it connected to my computer and see (my name) ipod on my screen. Everytime I try to add a new song to the Ipod, this message comes up and I am not sure what to do:   The Ipod, (my name) is synced with another ITunes li

    I have a 2nd generation Ipod.
    I have it connected to my computer and see (my name) ipod on my screen.
    Everytime I try to add a new song to the Ipod, this message comes up and I am not sure what to do:
    The Ipod, (my name) is synced with another ITunes library on A74F65. Do you want to erase this Ipod and sync with this ITunes Library?
    An Ipod can be synced with only one ITunes library at a time.  Erasing and syncing replaces the contents of this IPod with the contents of this ITunes library.
    Then it asks me if I want to delete and sync.
    I am not sure what to do for fear of erasing everything I have put on my Ipod.
    I would appreciate if someone could help me out. 

    If I understand you correctly, you are trying to use iTunes to play the Music in your iPod but which is not in your itunes library. I don't think Apple design iTunes for use in your way. As to put and play music in iPod, the music has to be in iTunes first, so you play music in the iTunes music Library. the window with Ipod music is just to show you which music are already in the Ipod, in case you want to Manually Manage your huge music library.
    Here is the iPod/iTunes manual from the Apple Support Site.
    http://manuals.info.apple.com/en_US/iPod_Features_Guide.pdf
    Have A NICE DAY!

  • I tried copying a photo and pasting it in another event/group within iPhoto but the paste feature doesn't work.  This wasn't an issue with both Leopard and Snow Leopard.  Do you have any solutions or tips?

    I bought a new MacBook Pro with OsX Lion as operating system.  I use iPhoto a lot and when I tried copying a photo then pasting it to another event/group, the 'paste' feature doesn't work.  This wasn't the case with Leopard and Snow Leopard where the 'paste' feature worked.  What I did was to paste the photo first to the desktop before transferring it to the new event/group.  I brought my Mac to the Apple store where I bought it and the technicians were themselves surprised that the 'paste' feature didn't work.  Chalked it up to glitches in the Lion os.  So how do we fix this?  I just find it absurd that a feature that used to work in Snow Leopard has been disabled in Lion, and the user still has to undergo an additional step to make it work, when new technology is supposed to make things easier for users. 
    Also, hasn't anyone noticed that it takes longer for the computer to boot upon opening? 

    Instead of copy and paste drag the photo to the new event. Or flag it and use the add flagged photos to selected event command
    LN

Maybe you are looking for

  • How do i share files between two computers using the ethernet?

    i have bought a cord that is ethernet to ethernet. i do not understand how or where to go after the two computers are seemingly connected. i have a bunch of photos on iphoto id like to transfer. thank you.

  • NumberFormat Exception while attaching files to Service Request

    We are getting this error from one responsibility and not from the other one. I have checked that the Type-responsibility mapping is similar for both the responsibilities. java.lang.NumberFormatException: For input string: "EEC000"      at java.lang.

  • Can I "show invisibles" in MUSE text?

    I'm working with a text column in MUSE, and every time I click in a paragraph the spacing above and below paragraphs goes haywire. I'm using paragraph styles with space above for subheads, and body text without for paragraphs, but it doesn't matter.

  • I have problems with my apps transfer

    i just got a new computer and my old computer doesnt work anymore and when i click transfer app purchause some of the app doesnt get transfered why? please help??

  • FRM-40400: Transaction complete: 1 records applied and saved

    Dear All, Hope all of you are doing well, Pls go through my problem... here is an application developed based on Oracle Forms & Reports 6i. I wrote a code, like for some specific Users, various permissions. Ex: User A (Payroll Person), User B (HR) fo