How can i make a program of conversion?

pls give me a hint in making a program of any conversion.tnx

Would this work? (Sorry couldn't help myself)
class ConversionApp
    Believer[] believers = new Believer[Religion.values().length];
    public ConversionApp()
        for (int i = 0; i < believers.length; i++)
            believers[i] = new Believer(Religion.values(), i);
public void displayAll()
for (int i = 0; i < believers.length; i++)
System.out.println(believers[i]);
public void convertAll(Religion religion)
for (int i = 0; i < believers.length; i++)
believers[i].setReligion(religion);
public static void main(String[] args)
ConversionApp ca = new ConversionApp();
System.out.println("Before Conversion:");
ca.displayAll();
System.out.println();
ca.convertAll(Religion.TAOIST);
System.out.println("After Conversion:");
ca.displayAll();
enum Religion
JEWISH, CATHOLIC, PROTESTANT,
MUSLIM, HINDU, BUDDHIST, SIKH,
BAHAI, CONFUCIANIST, JAIN,
SHINTOIST, TAOIST, ZOROASTRIAN
class Believer
private Religion religion;
private int number;
public Believer(Religion religion, int number)
this.religion = religion;
this.number = number;
public Religion getReligion()
return religion;
public void setReligion(Religion religion)
this.religion = religion;
@Override
public String toString()
return "Believer " + number + ", Religion: " + getReligion();

Similar Messages

  • How can I make my program Run forever?

    I would like to know how can I make my program execute some method while the GUI still open. I have something like this.
      public static void main(String args[]) {
        System.out.println("****************************");
        System.out.println("    PACKET READER CONSOLE   ");
        System.out.println("****************************");
        IPDetector window = new IPDetector(); // IPDetector is the JFrame
        window.setTitle("IPDetector Analyzer");
        window.pack();
        window.show();
        PortListener pl = new PortListener();// Is my portlistener class
        PacketReader c = new PacketReader();
        while(JFrame still open){// I dont know how to put a statemente here
          pl.start();// this method reads from a port and returns a string
          String cc = pl.data;// gets the string from the port listener
          while(!cc.equals("")){
            c.portWriter(cc);// writes the string into a file
      }I want that my portlistener keeps reading all the time, and if is something in the socket information.
    Should I use a thread? Any ideas? thanks.
    Chris

    I still not understanding how to make it thread. My main class is this one IPDetector. and it looks like this.
    public class IPDetector extends JFrame {
      // Declaration of the instance variables
      private static ArrayofDisplay  ad = new ArrayofDisplay();
      private ArrayofCreators database = new ArrayofCreators();
      JLabel sourceLabel;//etc..
      public IPDetector() {
        IPDetectorLayout customLayout = new IPDetectorLayout();
        getContentPane().setFont(new Font("Helvetica", Font.PLAIN, 12));
        getContentPane().setLayout(customLayout);
        sourceLabel = new JLabel("Source IP Add.");
        getContentPane().add(sourceLabel); 
        addWindowListener(new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
      // I get confused here...
      private boolean alive; // Do I need to declared here?
      public void setAlive(boolean val) { // This one also?
        alive = val;
      // IPDetector Methods...
      public void displayCaller(ArrayofDisplay aD){  }
      public void setAndReplace(String text)  {    }
      public void refresh(){ }
      public boolean action(Event evt, Object arg){ }
      //etc...
      public static void main(String args[]) {
        System.out.println("***********************************************");
        IPDetector window = new IPDetector();
        window.setTitle("IPDetector");
        window.pack();
        window.show();
        PortListener pl = new PortListener();
        PacketReader c = new PacketReader();
        while (alive) {// Is this correct here?
          pl.start();
          String cc = pl.data;
          while(!cc.equals("")){
            c.portWriter(cc);
            window.refresh();
            cc = "";
    class IPDetectorLayout implements LayoutManager {
      public IPDetectorLayout() {  }
      public void addLayoutComponent(String name, Component comp) {  }
      public void layoutContainer(Container parent) {  }
    }

  • How can i make simple program to match colors ?(photos taken by camera)

    how can i make simple program to match colors ?(photos taken by camera)

    Hi khaledyr,
    use a "random number" and compare for ">0.5" to get a (1 or 0) signal
    What exactly are you searching for?
    - Hints for choosing hardware?
    - How to output voltage or relais signals?
    - Help on using DAQ(mx)?
    - Help on generating (boolean) waveforms?
    Message Edited by GerdW on 04-16-2010 08:15 AM
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • How can I make a program run in the background?

    I'm working on a custom console program. I plan to have the commands as seperate applications and create a server/client relationship so they can communicate with each other. However whenever I call a command I don't want to have a console window pop up, flicker out, etc. I want it to look like it's one complete app. So I'm wondering how can I have the app run in the background?

    If you're using a unix system, use the "&" argument (or character, what is its name anyway?) at the end of the command line.
    I think you can use javaw in the MS-Windows world.

  • �How can i make my program not to shutdown after using wsimport on runtime?

    I have this code:
    // More code before this one
    WsImport ws = new WsImport();
    String[] s = new String[3];
    s[0] = "-d";
    s[1] = "wsdl";
    s[2] = URL;
    try {       
        ws.main(s);
    } catch (java.lang.Throwable e) {
    // More code after this onewhen ws.main(s) finish its job it forces my program to shutdown too ='(
    How can i fix that?
    Any help will be really appreaciated.

    kevjava wrote:
    jschell wrote:
    [...] run it in another app and interact with it from your main app.As shown in the example here:
    [http://www.java2s.com/Code/JavaAPI/java.lang/ProcesswaitFor.htm|http://www.java2s.com/Code/JavaAPI/java.lang/ProcesswaitFor.htm]
    If the other application's main() method is calling System.exit(), this is the only semi-sane way that i know of to get around it.thanks, it worked:)

  • How can I make my program run faster ? (changing colour indicators quicker)

    Hi everyone, I have a program with 100 indicator colour backgrounds that change according to 100 temperatures. A case structure (with 100 cases) sets the background colours one after the other and runs in a while loop with no timing (as fast as possible). The temperatures are loaded up from an array that is initialized at the beginning of the program. The idea is to have an overall view of the change of temperatures (just by looking at the change of colours). Everything works fine except that it doesn’t run fast enough... The change of colours is not smooth at all ... you can really see the increments. It works fine with 20 temperatures for instance. 1) Would anybody have a solution to improve this? I was wondering if Labview perhaps actualises all of the values each time one changes (just like with the excel cells: an option that you can desactivate and make things run quicker when you use a macro) which would make a big loss of time....  
    There is no data saving this is just a post treatment program. So My my program isn't doing anything else.
     2) I have attached a screen print of a problem a faced when making up the VI I attached. Why can’t I wire directly to the Index Array that is in the For Loop in my VI… I had to go throw a shift register to make up the example. When going back to my original program I couldn’t use the index array a second time (screen shot). Thanks a lot for any help, Regards, User  
    Solved!
    Go to Solution.
    Attachments:
    Forum question.vi ‏13 KB
    forum.JPG ‏50 KB

    Here's a possible solution:
    Ton
    Message Edited by TCPlomp on 11-03-2010 11:16 AM
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!
    Attachments:
    Forum question.png ‏23 KB

  • How can I make a part of the body of my content full width of the screen with a fluid grid layout in CSS? (In dreamweaver program)

    How can I make a part of the body of my content full width of the screen with a fluid grid layout in CSS? (In dreamweaver program)
    and I know it is being over-ridden by
    .gridContainer {
      width: 88.5%;
      max-width: 1232px;
      padding-left: 0.75%;
      padding-right: 0.75%;
      margin: auto;
      clear: none;
      float: none;

    Abdelqader Alnobani wrote:
    How can I make a part of the body of my content full width of the screen with a fluid grid layout in CSS? (In dreamweaver program)
    and I know it is being over-ridden by
    .gridContainer {
      width: 88.5%;
      max-width: 1232px;
      padding-left: 0.75%;
      padding-right: 0.75%;
      margin: auto;
      clear: none;
      float: none;
    Logically a structure something like below should work BUT whether or not it will upset the FG I don't know as I wouldn't ever use it.
    <div class="gridContainer">
    Top Code Section Goes Here
    </div>
    <!-- close gridContainer -->
    <div id="fullWidth">
    Full width section goes here
    </div>
    <!-- close fullWidth -->
    <div class="gridContainer">
    Bottom Code Section Goes Here
    </div>
    <!-- close gridContainer -->

  • I'v just installed creative cloud 64 bit windows. How can I make bridge the default program to upload pictures rather than lightroom?

    I've just installed creative cloud 64 bit windows.  How can I make bridge the default program to upload pictures rather than lightroom?

    Usually the default program associated with an image file extension is an image developing Program like Lightroom or an image editing program like Photoshop. If you want to change the default associated program to Adobe Bridge you would use Window's Controls Panel file association applet.

  • I have two accounts to my computer as administrator. How can I make it so both accounts have access to the same folders and programs? grateful for answers. Martin

    I have two accounts to my computer as administrator. How can I make it so both accounts have access to the same folders and programs? grateful for answers. Martin

    Obvious question: If you want to have access to the same folders andapplications, why have two accounts? The point of different accounts is that you don't have access to the other person's data.
    Any application in the HD/Applications folder is available in all accounts.
    Sharing data between accounts depends on the material being shared. So, if you can provide more details we maybe able to help you better.
    Regards
    TD

  • How can I make my PowerPC/Windows programs work in Mac OS X Lion?

    In a few months I will be buying a MacBook Pro and I have a lot of old games that I would like to be able to play on it. But those games are Windows/PowerPC only and Mac OS X Lion does not support PowerPC. How can I make my old programs work in Mac OS X Lion?

    For porting Windows programs to Mac OS X, you can check out Wineskin.  It can be very simple to very hard to do though... its all a case by case basis.  The older the game is the more likely you are to get it to work easily though.

  • How can I make a screensaver from a Java program?

    Hi!
    I've made a Java program works as a screensaver, and I've grouped all files into a jar file. How can I make a screensaver from this jar file?
    Thanks.

    check https://jdic.dev.java.net/documentation/incubator/screensaver/
    - I think it's still in development, but it's something...

  • When I insert my memory card iPhoto opens. How can I make the default program Preview?

    When I insert my memory card from my camera, iPhoto opens. How can I make Preview the default?

    Denny,
    Open Image Capture which is located in your Applications Folder.
    Connect your device to your computer, then turn the device on.If the device is locked with a passcode, enter it.
    Select the device in the Devices list.
    Choose Image Capture from the “Connecting this [device] opens” pop-up menu.Click “Show device settings” if you don’t see that pop-up menu.

  • How can I make a slideshow with pictures and burn it to a dvd? what program to use?

    how can i make a slideshow with my pictures and then burn it to a dvd?

    Apple's builtin "iPhoto" application can do that easily.  Open iPhoto and click on "Help" at the top of the screen for assistance in creating it.
    Hope this helps

  • I don't know the programming in Xcode ¿How can I make a App on it ?

    Hi Am new on all this, i learn very fast languages, and I already pay the $99 sow know what???? how can i make my app in Xcode Fast and Cool ?????

    Nelson Rolanso wrote:
    well look somebody have a Tuturial ??????
    No one here is going to personally take the time to teach you.  Look for instructional videos on youtube, or search google for websites or go to the library and look for books on the subject. Take some initiative. 

  • How can i make a free facetime video call? There's always appearing that my provider might charge for the call?

    How can i make a free facetime video call? There's always appearing that my provider might charge for the call?

    If you make a call then tap the Facetime button to connect Facetime, the duration of call up to Facetime connection will be charged under your regular airtime.  However, duration during facetime conversation will not consume airtime.
    But if you tap the Facetime button on the Contact Page, then the whole duration will not consume airtime.
    For Facetime to work, both parties must be connected to wifi.

Maybe you are looking for