A Simple Circle, or is it?

I'm trying to make a simple program that will take the input integer, radius, and apply it to the area formula a=(3.14)r^2. for some reason i can't get the math right in the language.
Here is my code.
import javax.swing.JOptionPane;
public class Circle{
public static void main(String args [])
     String radius;
     int r, a;
     radius = JOptionPane.showInputDialog("Enter the circle radius:");
     r = Integer.parseInt(radius);
     a = Math.PI * r;//how do i get this line to work, and change r to r^2?
JOptionPane.showMessageDialog(null,     "Area is " + a);
     System.exit(0);
Any hints or help you can offer is awesome. Thanks in advance!

Also a is an int and PI is a double so you will need to change a into a double or cast the result to int (this truncates the decimals).
double a;
a = Math.PI * r * r;or
a = (int) (Math.PI * r * r);

Similar Messages

  • How to create a simple circle crop in FCP7?

    I have two separate videos and basically I want one of them in the background and then the other on top of it with a circular crop. Anybody know a way to do this?

    Put your background on V1.
    Go to the Browser and click the Effects tab.
    Go to Video Generators > Shapes > Circle. Place this on V2.
    Put the video you want to crop on V3.
    Right click on V3 and choose Compostite Mode > Travel Matte Luma.
    A double click on V2 will send it to the Viewer, where you can adjust the size whilst observing the adjustment in the Canvas.

  • How can I make a simple circle in html5/css3?

    I have cs5 and the html5 pack installed. I draw a circle on a new document. Now what?

    You are right canvas can be used to render rastar graphics, however we don't generate the canvas code directly from Illustrator. Instead this pack lets you mark some elements within a design as Cavnas,  when the SVG output is generated those elemented would be treated as canvas within SVG so that you can have pixel level control on those elements.
    Please refer to http://download.macromedia.com/pub/labs/illustrator_html5/illustrator_html5_userguide.pdf for details on this and other features of the pack.

  • Circle Plot

    Hi all,
    I am trying to make a quite simple program, where I want to plot a simple circle, using parametric equations.
    The equations I am using are:
    X=Xc + Ro cos (theta)
    Y=Yc + Ro sin (theta)
    where Xc and Yc are the centre points of the circle and Ro its radius.
    I need to use a tool like "Simulate Signal" or something like this to generate the signal that will plot the graph (or not)?
    If so, this signal will be my theta variable, which I need to constraint it, between 0 and 2 (PI). Is it possible?
    Thanks,
    FGoulao
    Solved!
    Go to Solution.

    ToeCutter wrote:
    Those solutions are very elegant if you are familiar with complex numbers, however they add confusion for those not.
    The alternative is just to bundle the x,y values from the sine and cosine functions into the (non-complex) form compatible with an x-y graph input.
    Learning complex numbers might actually  be easier than learning two different trigonometric functions as well as cluster bundle operations.
    (... as long as we stick to the basic things as described in this thread.
    It gets a bit more complicated if we e.g. multiply a complex number with a complex number of (1,theta), which corresponds to a rotation in the complex plane. Multiplying by a complex number of (scale,theta) does a scaling and rotation in one step. Very useful. ).
    LabVIEW Champion . Do more with less code and in less time .

  • Simple graphic

    I'm sure I am losing my mind. I have a simple circle (no fill) with a 6
    pixel black stroke (edge). I need to make half of this circle black. I've
    tried everything I can think of and nothing works. i.e. make another solid
    black circle, cut it in half ...
    Your help will be appreciated.

    Thanks for posting another method.  I'm so green, I'm pathetic ... I'll <br />learn something in my attempt I'm sure.<br />Thanks again,<br />LinK<br /><br /><br /><[email protected]> wrote in message <br />news:[email protected]..<br />> Ooo... Another one of those "many many ways to do it" threads.<br />><br />> Fill a circle with the default linear white-to-black gradient. Pull the <br />> white stop to the center. Add a new black stop in between the original two <br />> stops. Pull it on top of the white stop.

  • How to draw a circle with fill

    This is probably the easiest question you'll get today, so enjoy!!!
    I'm trying to create a simple circle with fill (yeah, I know. Easy). So I used the Ellipse Tool and set the fill to blue. (below). The problem is the fill doesn't fill all the way to the border and there is a gray border around it.
    I really, really just want a nice blue circle...... is that too much to ask... ? (*sniff*)
    Thanks in advance!

    Hi,
    That looks like your seeing the path of the ellipse.
    If you go to the paths panel you can click below the path in the panel to hide the path.
    What version of photoshop are you using?
    Path visible
    path hidden

  • Work Paths, selections, and general doing my job better question...

    I currently work for a company that prints "Fathead" like wall graphics, i set the images up to print for them, but im looking for a better way to do what i do. Specifically my working with illustrator and Photoshop to setup the cut line for each image. Here is my current step by step procedure:
    1) Open image (usually a JPG) in Photoshop CS4
    2) Using mainly the Lasso tool's i select the subject to be printed. I'm very fast doing this.
    3) Copy/Paste the selection i just made into a new and save it as a TIF file.
    4) Back to the original selection i Smooth and Contract the line a few pixels and hit "Make Work Path"
    5) Export that path to illustrator (which leaves me with an .AI file)
    6) From here im done with Photoshop and i open both the .AI and TIF files into Adobe illustrator CS4
    7) The .AI file i give a stroke and then on the Swatches tab i hit New Swatch, name it "CutContour", and select Spot Color & RBG
    8) I then copy the CutContour line, paste it onto the TIF image, and line it up over the subject
    9) From here all that's left to do is make it the right size it's to be printed at and save it as an EPS file and im done.
    The main reason im asking for help here is because I'm not happy with the quality of the cutline Photoshop exports to illustrator (the ai file) after i make it a work path. The anchor points and handle's are often in need of a lot of adjustment despite the fact that my selection in Photoshop was right on the money.
    One side note that might be a direction for me to head in,...
    I recently was given a jpg file from a guy who said he had already made the selection for me. I wasn't quite sure what he meant but when i saved the image as a tif, opened it in illustrator, and hit CTRL-A to select everything i noticed a cutline was already present. After further examination of the jpg in Photoshop i noticed a "Path 1" on the paths tab, and more importantly that cutline when opened in illustrator was nuts on! Meaning none of the anchor points and handle's needed to be adjusted at all.
    Now the person who sent me this file was a customer so i can't rightly ask them how to better do my job :-) lol ...but maybe someone here can tell me how they (for lack of a better word) embedded a cutline or path i guess it's called into a jpg file like that? This would at least save me the step of exporting my selection to illustrator as an AI file and im wondering if however they did it is more accurate then the "Make Work Path" option i currently use.

    ...useing File | Export | Paths to Illustrator is what i outlined above that i currently do...
    My apologies for not catching that. Honestly, my eyes glazed over at about step 2 of your procedure.
    I'm not happy with the quality of the cutline Photoshop exports to illustrator (the ai file) after i make it a work path.
    A couple of possibilities come to mind. What Tolerance value are you using when you first make a work path out of your selection in Photoshop? 0.5 pixel is the highest precision available, and that's what you should use if you want your path to accurately reflect your selection. Be warned, however, that your path will likely end up with a lot of points, making for an unnecessarily complex path. (Try it with a simple circle.)
    Another possibility is that you're working with a low-quality, low-resolution JPEG as your source image. JPEG compression artifacts can affect selection accuracy (with automated tools, like the magic wand or eraser), and overall resolution, of course, will limit path precision. Not much you can do about that other than to start with better-quality images.
    After further examination of the jpg in Photoshop i noticed a "Path 1" on the paths tab, and more importantly that cutline when opened in illustrator was nuts on!... maybe someone here can tell me how they (for lack of a better word) embedded a cutline or path i guess it's called into a jpg file like that?
    Using a low tolerance (high precision) value make a path from your selection in Photoshop and save the path. Save As a JPG, and the path will be saved along with the image. Do not use Save for Web to create your JPG file.
    As others have pointed out in earlier posts, learning to use the pen tool is your best bet... and an absolute necessity if you're going to be doing a lot of this stuff.
    Regarding the creation of clipping paths in Photoshop, slap me silly, but I'm going to refer you to the manual (online Help) for that. And if you think that unkind, try posting the question over at the Photoshop forum. Wear a helmet.

  • Problem placing SVG graphic

    I created a simple circle with outlined text in Illustrator. I save it as svg 1.1. When I place the svg file into Muse, however, I get the dreaded transparent object with an exclamation point and "unable to generate thumbnail." I place it anyway, but there is no image. What am I doing wrong? THX

    Did you follow this?: Adobe Muse Help | Using SVG graphics

  • How do other video editors cope with Yosemite (xpc, icloud bugs...)

    Right so all I want is to be able to use Apple Motion on a stable system.
    I don't need icloud, photos or any of that bs.
    However I keep noticing icloud bugging out in the console, as well as photoagent and all kinds of needless process that slow down when not crash my editing software or even block me out of internet.
    And so I sign out of icloud and anything related. But then it gets worst, sandbox, xpc, my whole system gets completely  lost and throws identification errors left and right, making Motion super laggy.
    Has anyone else noticed that? Could it be possible that Icloud plays such a role in the way processes, including the ones used by pro apps, communicate with each other? Are we in a way forced to give in to icloud (and its load of issues), to be able to edit in a half way decent fashion?
    I tried keychain first aid, onyx, digital rebellion, fsck-fy, reset p-ram, smc,nothing gives.

    We all pretty much now by know that the OS has issues, serious ones (I 'm not the only apparently). I finally mitigated some of my issues (one fix entailed solving a huge mess in my keychains) and haven't slept in 2 days with a deadline tomorrow. Now that I can finally get back to work seriously, I find out that Motion 5 is excruciatingly slow to export, whether from the soft itself or via compressor . Even Motion 3 was a breeze in comparison.(by the way, Compressor offers to distribute batch among several computers, but the feature doesn't apply to projects sent from Motion and fcp, hence a completly useless feature for most workflows). I know that generators and replicators are ram hungry and so I'm resorting to export them one by one with the happy prospect of an additional round of compositing and export). As I speak, a simple circle with a paint stroke superimposed by an ulterior export of the corona emitter sigh....are rendering. and for only 16secs of a  4444 clip on alpha over a stroke outline is taking a good 30mn
    This is outrageous. knowing that it is only portion of a clip among a dozen others which need to be delivered all cut up tomorrow, I am basically dead. Needless to say that re-installing everything right now is unthinkable, especially since I'm working on a recent clean install and so who knows what defects I'll end up  getting the next time around
    If I could use help at this level of catastrophy, it would be some advice on the best quality/time ratio codec for exporting and re-importing 1080 w alpha clips. I'm currently going for 4444 + alpha with same settings as the project but there may be faster.

  • Using Apple IOS Numbers on my iPod Touch 4th gen, where would I find... ummm... let's say b200?

    Using Apple IOS Numbers on my iPod Touch 4th gen,
    where would I find... ummm... let's say b200??
    I use the row numbers and column alphabet all the time, and yet they don't appear on the IOS5 version of Numbers.
    This is kinda short-sighted, isn't it? On the desktop version they show up just by clicking on a cell.

    Yeah, we in the real world call it stupid design.
    I discovered a real stupid, stupid, stupid way of seeing the header columns and the row numbers. You need to select a cell, and double tap it and the keypad pops up, at the top of the keypad window is a black wide tool button-bar with "42", "a clock symbol ", a "T" and an "="  The "42" stands for numbers, stars dollar signs, ±, etc. The "Clock symbol" is to put in days, hours, minutes... that sort of thing. The "T" is for words. AND the "=" is for formulas and stuff. HOWever, when you selct the "=" the column header (ABC...etc) and the Row numerators appear! Done so you CAN select certain column and rows to include those certain cells for calculations.
    What a crappy design, right? Must be an engineer without any human interface design skills whatsoever who designed THIS Numbers for ios GUI... you have to hunt through crap to find the simplest of spreadsheet information. A real human interface designer would have made it easy option (for aesthetic reasons or "save space" Hah. Save space on a spreadsheet... why do you think they call them SPREADsheets anyway?).
    And while we are on the Stupid, Engineer-Minded GUI, whose idea was to make you shake your ios device to "UNDO"?  There is plenty of space where the title "Spreedsheets"  and 3 toolbar buttons are located at the top of the spreadsheet workspace for a simple ø <--(circle with a line symbol)
    This Numbers for IOS needs a big retooling.

  • Which component I should choose to simulated a stepper motor's winding?

    Dear all,
    I'm now trying to design a chopper type stepper motor driver. In order to learn from basic, I build a simple circle with only one motor winding. I choose advanced inductor for motor winding. But some of the parameters required in this component cannot get.
    I'm now able to measure target motor's parameters using a programable LCR meter, and get results below:
    Winding-1:
    Inductance : 524.6uH
    Z : 392.7 ohms
    Q factor : 1.758
    Winding-2:
    Inductance: 543.5uH
    Z : 392.9 ohms
    Q factor : 1.770
    How to use these readings to get :
    1.Inductor Self Resonant Frequency
    2.Inductor Rated Current(Idc)
    Or should I choose another component?
    Thanks
    Stanley Hsu

    Hi Jet,
    I used Multisim power pro version 10.1. Sorry I forget where I found this component, but I upload the property page of this inductor. Hope you can find something.
    Attachments:
    Inductor_Advanced.JPG ‏72 KB

  • What is wrong with the stroke in Photoshop CS5??

    The stroke tool (in the edit menu as well as the stroke effect) is a bit screwed up in CS5!! It renders really jaggy. Is this something that Adobe will fix soon?
    thanks;
    J.

    Hi;
    Thanks for the replies. I apologize for the "emotional" post. I should have provided more detail. I'm using PSD CS5 12.0.2 on a Mac Pro, running 10.6.7. I recently was upgraded to CS5, so yesterday was my first day using CS5. So to my dismay, a simple thing like stroking an object was not working as expected. I typically use shape layers, and stroke them with a stroke effect (although this issue is visible by stroking from the edit menu). I believe the image I attached showcases this issue. The black circle is a simple circle shape layer. The red stroke is visibly "jagged" and not a perfect circle.  So not sure what is going on with my setup or if this is a preference or setting that needs to be turned on or off. Appreciate any insight.
    thanks;
    John

  • Problem using stopDrag function

    hi there, im trying to put a simple circle over another circle (bigcircle with diferent x and y coordinates) but i got an error when i release the circle outside the bigcircle
    TypeError: Error #1009: Cannot access a property or method of a null object reference
    the 2 movieclip circles r in the stage ...
    help plz
    import flash.display.MovieClip;
    import flash.events.MouseEvent;
    smallcircle.addEventListener(MouseEvent.MOUSE_DOWN, dragit);
    smallcircle.addEventListener(MouseEvent.MOUSE_UP, stopit);
    function dragit(event:MouseEvent):void
    smallcircle.startDrag();
    function stopit(event:MouseEvent):void
    smallcircle.stopDrag();
    if (smallcircle.dropTarget.parent == bigcircle)
    trace("Ok");
    else
    smallcircle.x = 90;
    smallcircle.y = 315;

    Try adding a conditional to test if there's a dropTarget...
    if (smallcircle.dropTarget && smallcircle.dropTarget.parent == bigcircle)

  • Basic questions about high-quality output and PDFs

    I do volunteer work in a non-profit that interfaces with local county government.  We've been discussing a project to produce an atlas-type information as a service to the residents.  The maps would be rendered by the GIS software the county uses (ESRI's Arc suite).  The question is what file format should we ask for given the high-quality print and plot output we have in mind and our desire to add some simple vector markup in some cases to the maps.  The markup, when used, would be simple circles, rectangles, arrows or text. 
    Our idea is the do most of the printing and plotting ourselves (we'd use something like a local Kinkos).  This allows is to control paper sizes.  In addition, we might want to crop the map and upscale a bit so we need to be careful of data density (dpi).  The question is what file format do we request from the county?
    Obviously we can ask for PDFs but, as a novice with that output, I don't fully understand 1) its Tools capability (but I am learning about it) and 2) how to control data density.
    Since I think its best to envision a PDF as a "box" for other data, is the quality of the output going to be determined by the data density of the object inside the PDF?
    I know I may not be very clear so please help me get clear on the question if I haven't expressed it well here.
    BTW, I know I can place a PDF into an AI object and then add the vector stuff if needed, but I don't know from a workflow perspective if that's the best way to assure hight quality output.
    Thanks
    Tom
    P.S. We may end up with GIS viewing software as we move forward (ESRI has a grant program for non-profits).  All this would mean would be we would be the ones making the decision about output format but the question on workflow would still remain.

    4. Finally, with CDs burned this way through iTunes, does iTunes place some sort of DRM on the burned CDs? If so, what practical effect does that DRM have on my burned CD (how does it limit the functionality of the CD?
    No, so no limits to functionality.

  • Flash xml data loading and unloading specs

    hi i am trying to get specification information that i cannot
    find anywhere else.
    i am working a large flash project
    and i would like to load xml data into the same swf
    object/movieclip repeatedly.
    as i do not want the previously loaded items to unload i need
    to know if doing this will unload the items from the swf or just
    keep them in the library so they can be reposted without reloading.
    i cannot find any supporting documenation either way that
    tells me that if i load new content into a clip (i am aware
    levels overwrite) if it will or will not unload this content.
    thanks in advance.
    mk

    this is awful for me -- i cant even get the clip to duplicate
    -- and i thought this would be the simplest solution to keeping
    everything cached for one page before and one page after current in
    the project.
    i have used a simpler clip to test the code and see if i am
    insane.
    duplicateMovieClip(_root.circle, "prv", 5);
    prv._x = 300;
    prv._y = 300;
    prv._visible = true;
    prv.startDrag();
    this ALWAYS works when i use the _root.circle file of a green
    simple circle
    BUT
    when i change it to my main movie clip (which is loaded AND
    On screen -- it just doesnt duplicate at all!) -- i've even
    triggered it to go play frame 2 JUST IN CASE
    I've even set visibility to true JUST IN CASE
    ie all i do is change _root.circle to _root.cur
    and .... nada.
    AND _root.cur IS DEFINITELY on the screen and all xml
    components have been loaded into it. (it is a slide with a dynamic
    picture and dynamic type and it 100% works)
    has anyone had this insanity happen before?
    is this an error where flash cannot attach movie or duplicate
    a clip that has dynamic contents???

Maybe you are looking for

  • Apple Video Adapters

    Do the adapters Apple sells to drive the screen image on an external monitor provide sound as well? I'd like to set up my MBP to display on my TV for movies/shows/etc., but how do I get the sound to go through my TV's (or better yet, my receiver's) s

  • I installed photoshop 6, on my laptop, from a cd and can not open it; it is frozen.  Can anyone help me?

    I bought and installed a cd of photoshop cs6 on my Dell laptop.  once installed; it froze up and I can not use it.  Any advice??

  • How to remove a an ambulance siren without ruining a couples vows.

    Hello all, I just picked up Audition CS 6 hoping I could just watch a few tutorials and remove the siren from this couples vow of a wedding I shot yesterday. I want to have this highlight video posted no later than Noon on Sunday as I work within a 4

  • Early Access Program Ends Successfully

    As a follow-up to John's previous posting ... The Sun Java Studio Creator 2 Early Access Program ends with the multilanguage release of the IDE. Longer than a typical EA program, it was joined by over 21,500 enthusiastic developers who posted over 30

  • Java Icon set: Hour glass??

    Hi y'all!! I know of the free graphics repository that provides a set of basic icons http://java.sun.com/developer/techDocs/hi/repository/ but this set doesn't contain what I need for my app: I would like an hour glass, like the one displayed when yo