Who can help me write this Java code show the prime number ???? PLEASEEEEEE

Write java code print prime number like this
Sample Screen Print:
Initial matrix with N = 37
2 3 4 5 6 7 8 9 10
11 12 13 14 15 16 17 18 19 20
21 22 23 24 25 26 27 28 29 30
31 32 33 34 35 36 37
Intermediate results (after 1st iteration)
2 3 5 7 9
11 13 15 17 19
21 23 25 27 29
31 33 35 37
Intermediate results (after 2nd iteration)
2 3 5 7
11 13 17 19
23 25 29
31 35 37
Intermediate results (after 7th iteration)
2 3 5 7
11 13 17 19
23 29
31 37
Final results
2 3 5 7 11 13 17 19 23 29
31 37
How to write this code ?
Please Help me!
Thank you so muchhh ?????

h2. {color:#ff0000}Multiplepost{color}
Replies here: http://forum.java.sun.com/thread.jspa?threadID=5241012&tstart=0
There is a useful answer the original thread. Answer it, or ignore it as you like, but don't create multiple threads.

Similar Messages

  • I will pay for who can help me with this applet

    Hi!, sorry for my english, im spanish.
    I have a big problem with an applet:
    I�ve make an applet that sends files to a FTP Server with a progress bar.
    Its works fine on my IDE (JBuilder 9), but when I load into Internet Explorer (signed applet) it crash. The applet seems like blocked: it show the screen of java loading and dont show the progress bar, but it send the archives to the FTP server while shows the java loading screen.
    I will pay with a domain or with paypal to anyone who can help me with this problematic applet. I will give my code and the goal is only repair the applet. Only that.
    My email: [email protected]
    thanks in advance.
    adios!

    thaks for yours anwswers..
    harmmeijer: the applet is signed ok, I dont think that is the problem...
    itchyscratchy: the server calls are made from start() method. The applet is crashed during its sending files to FTP server, when finish, the applet look ok.
    The class I use is FtpBean: http://www.geocities.com/SiliconValley/Code/9129/javabean/ftpbean/
    (I test too with apache commons-net, and the same effect...)
    The ftp is Filezilla in localhost.
    This is the code, I explain a little:
    The start() method calls iniciar() method where its is defined the array of files to upload, and connect to ftp server. The for loop on every element of array and uploads a file on subirFichero() method.
    Basicaly its this.
    The HTML code is:
    <applet
           codebase = "."
           code     = "revelado.Upload.class"
           archive  = "revelado.jar"
           name     = "Revelado"
           width    = "750"
           height   = "415"
           hspace   = "0"
           vspace   = "0"
           align    = "middle"
         >
         <PARAM NAME="usern" VALUE="username">
         </applet>
    package revelado;
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    import javax.swing.*;
    import java.io.*;
    import javax.swing.border.*;
    import java.net.*;
    import ftp.*;
    public class Upload
        extends Applet {
      private boolean isStandalone = false;
      JPanel jPanel1 = new JPanel();
      JLabel jLabel1 = new JLabel();
      JLabel jlmensaje = new JLabel();
      JLabel jlarchivo = new JLabel();
      TitledBorder titledBorder1;
      TitledBorder titledBorder2;
      //mis variables
      String DIRECTORIOHOME = System.getProperty("user.home");
      String[] fotos_sel = new String[1000]; //array of selected images
      int[] indice_tamano = new int[1000]; //array of sizes
      int[] indice_cantidad = new int[1000]; //array of quantitys
      int num_fotos_sel = 0; //number of selected images
      double importe = 0; //total prize
      double[] precios_tam = {
          0.12, 0.39, 0.60, 1.50};
      //prizes
      String server = "localhost";
      String username = "pepe";
      String password = "pepe01";
      String nombreusuario = null;
      JProgressBar jProgreso = new JProgressBar();
      //Obtener el valor de un par�metro
      public String getParameter(String key, String def) {
        return isStandalone ? System.getProperty(key, def) :
            (getParameter(key) != null ? getParameter(key) : def);
      //Construir el applet
      public Upload() {
      //Inicializar el applet
      public void init() {
        try {
          jbInit();
        catch (Exception e) {
          e.printStackTrace();
      //Inicializaci�n de componentes
      private void jbInit() throws Exception {
        titledBorder1 = new TitledBorder("");
        titledBorder2 = new TitledBorder("");
        this.setLayout(null);
        jPanel1.setBackground(Color.lightGray);
        jPanel1.setBorder(BorderFactory.createEtchedBorder());
        jPanel1.setBounds(new Rectangle(113, 70, 541, 151));
        jPanel1.setLayout(null);
        jLabel1.setFont(new java.awt.Font("Dialog", 1, 16));
        jLabel1.setText("Subiendo archivos al servidor");
        jLabel1.setBounds(new Rectangle(150, 26, 242, 15));
        jlmensaje.setFont(new java.awt.Font("Dialog", 0, 10));
        jlmensaje.setForeground(Color.red);
        jlmensaje.setHorizontalAlignment(SwingConstants.CENTER);
        jlmensaje.setText(
            "Por favor, no cierre esta ventana hasta que termine de subir todas " +
            "las fotos");
        jlmensaje.setBounds(new Rectangle(59, 49, 422, 30));
        jlarchivo.setBackground(Color.white);
        jlarchivo.setBorder(titledBorder2);
        jlarchivo.setHorizontalAlignment(SwingConstants.CENTER);
        jlarchivo.setBounds(new Rectangle(16, 85, 508, 24));
        jProgreso.setForeground(new Color(49, 226, 197));
        jProgreso.setBounds(new Rectangle(130, 121, 281, 18));
        jPanel1.add(jlmensaje, null);
        jPanel1.add(jlarchivo, null);
        jPanel1.add(jProgreso, null);
        jPanel1.add(jLabel1, null);
        this.add(jPanel1, null);
        nombreusuario = getParameter("usern");
      //Iniciar el applet
      public void start() {
        jlarchivo.setText("Start() method...");
        iniciar();
      public void iniciar() {
        //init images selected array
        fotos_sel[0] = "C:/fotos/05160009.JPG";
        fotos_sel[1] = "C:/fotos/05160010.JPG";
        fotos_sel[2] = "C:/fotos/05160011.JPG";
         // etc...
         num_fotos_sel=3; //number of selected images
        //conectar al ftp (instanciar clase FtpExample)
        FtpExample miftp = new FtpExample();
        miftp.connect();
        //make the directory
         subirpedido(miftp); 
        jProgreso.setMinimum(0);
        jProgreso.setMaximum(num_fotos_sel);
        for (int i = 0; i < num_fotos_sel; i++) {
          jlarchivo.setText(fotos_sel);
    jProgreso.setValue(i);
    subirFichero(miftp, fotos_sel[i]);
    try {
    Thread.sleep(1000);
    catch (InterruptedException ex) {
    //salida(ex.toString());
    jlarchivo.setText("Proceso finalizado correctamente");
    jProgreso.setValue(num_fotos_sel);
    miftp.close();
    //Detener el applet
    public void stop() {
    //Destruir el applet
    public void destroy() {
    //Obtener informaci�n del applet
    public String getAppletInfo() {
    return "Subir ficheros al server";
    //Obtener informaci�n del par�metro
    public String[][] getParameterInfo() {
    return null;
    //sube al ftp (a la carpeta del usuario) el archivo
    //pedido.txt que tiene las lineas del pedido
    public void subirpedido(FtpExample miftp) {
    jlarchivo.setText("Iniciando la conexi�n...");
    //make folder of user
    miftp.directorio("www/usuarios/" + nombreusuario);
    //uploads a file
    public void subirFichero(FtpExample miftp, String nombre) {
    //remote name:
    String nremoto = "";
    int lr = nombre.lastIndexOf("\\");
    if (lr<0){
    lr = nombre.lastIndexOf("/");
    nremoto = nombre.substring(lr + 1);
    String archivoremoto = "www/usuarios/" + nombreusuario + "/" + nremoto;
    //upload file
    miftp.subir(nombre, archivoremoto);
    class FtpExample
    implements FtpObserver {
    FtpBean ftp;
    long num_of_bytes = 0;
    public FtpExample() {
    // Create a new FtpBean object.
    ftp = new FtpBean();
    // Connect to a ftp server.
    public void connect() {
    try {
    ftp.ftpConnect("localhost", "pepe", "pepe01");
    catch (Exception e) {
    System.out.println(e);
    // Close connection
    public void close() {
    try {
    ftp.close();
    catch (Exception e) {
    System.out.println(e);
    // Go to directory pub and list its content.
    public void listDirectory() {
    FtpListResult ftplrs = null;
    try {
    // Go to directory
    ftp.setDirectory("/");
    // Get its directory content.
    ftplrs = ftp.getDirectoryContent();
    catch (Exception e) {
    System.out.println(e);
    // Print out the type and file name of each row.
    while (ftplrs.next()) {
    int type = ftplrs.getType();
    if (type == FtpListResult.DIRECTORY) {
    System.out.print("DIR\t");
    else if (type == FtpListResult.FILE) {
    System.out.print("FILE\t");
    else if (type == FtpListResult.LINK) {
    System.out.print("LINK\t");
    else if (type == FtpListResult.OTHERS) {
    System.out.print("OTHER\t");
    System.out.println(ftplrs.getName());
    // Implemented for FtpObserver interface.
    // To monitor download progress.
    public void byteRead(int bytes) {
    num_of_bytes += bytes;
    System.out.println(num_of_bytes + " of bytes read already.");
    // Needed to implements by FtpObserver interface.
    public void byteWrite(int bytes) {
    //crea un directorio
    public void directorio(String nombre) {
    try {
    ftp.makeDirectory(nombre);
    catch (Exception e) {
    System.out.println(e);
    public void subir(String local, String remoto) {
    try {
    ftp.putBinaryFile(local, remoto);
    catch (Exception e) {
    System.out.println(e);
    // Main
    public static void main(String[] args) {
    FtpExample example = new FtpExample();
    example.connect();
    example.directorio("raul");
    example.listDirectory();
    example.subir("C:/fotos/05160009.JPG", "/raul/foto1.jpg");
    //example.getFile();
    example.close();

  • I need to download ferefox 9.0 but I cannot find it anywhere. Who can help me with this?

    I need to download ferefox 9.0 but I cannot find it anywhere. Who can help me with this?

    Please note that running out of date versions of Firefox is not recommended, as you will open yourself up to known security issues, alongside bugs and other issues. Is there a specific problem you are having with Firefox that I can help you with?
    You can download Firefox 9 at [http://ftp://ftp.mozilla.org/pub/firefox/releases/9.0.1/win32/en-US/ ftp://ftp.mozilla.org/pub/firefox/releases/9.0.1/win32/en-US/]

  • Error Message:"Cannot find or create the font 'WP-MathA'. Some characters may not display or print correctly."  Who can help me solve this problem?

    Some of the pdf files I work with (receive) come up with a comment: “Cannot find or create the font ‘WP-MathA’. Some characters may not display or print correctly.”  Who can help me solve this problem?
    Thank you in advance for  your time.
    Marlen

    Hello Anubha,
    I am having a similar problem on my machine.  I was using Word 2008 and I created a PDF inside Word.
    I am opening the file on the system itself and I am running Windows 8.1.  I am using Version 11 of Reader.
    When the PDF I created (my resume) attempts to open, it says:  cannot find or create the file Times, Bold.  Some characters may not display or print correctly. 
    However, the entire Reader keeps freezing and will not allow me to open or test print the document.  Also, it is not displaying any of the Bold Times New Roman Print.  Can you please help?  Thanks.

  • Since Ios 7 Update of my iPhone 5 I can not log into any WLAN any more - who can help to solve this major problem

    Hi all,
    I updated my iPhone 5 recently to IOS 7 - Since then I do not get any access to my home WLAN / WIFI with the iphone 5.
    At same time the iphone 3S and IPAD 1 of my wife (both IOS 5.x) still work fine in our homes WLAN / WIFI.
    Who can help to get my Iphone 5 with IOS 7 back to work in the home WIFI ?
    Thanks in advance for any possible solution.
    Best regards
    Dirk from Hamburg Germany

    Try this first.
    On the iPhone go to Settings > General > Reset and select Reset Network Settings.
    This will erase all saved wi-fi networks and settings.
    If no change after this, try resetting your modem and wireless router. Disconnect the router from the power source followed by disconnecting the modem from the power source. Wait a few minutes followed by powering your modem back on allowing it to completely reset before powering your wireless router back on allowing it to completely reset with the modem.

  • Hello is there anybody who can help me in german? i have the same problem like the guy with i tunes. it won´t open an give me an error "An application has made an attempt to load the C runtimelibrary incorrectly" Please contact the application´s support..

    I´ve so many privat things on I tunes like pictures, music etc.and i won´t loose them. is there anybody who can help me to save my private things and help me to solve teh problem
    Thanks you for help greetings from austria

    I just had the same error: 
    R6034
    An application has made an attempt to load the C runtime library incorrectly.  Please contact the apps support team for more info.
    I went to http://support.apple.com/kb/ht1925 and did a complete removal and reinstallation of iTunes. You MUST follow the directions here exactly...it's more than just iTunes that must be removed, and it MUST be done in the order in which the support article says.  I followed the exact instructions, and iTunes is back on my machine (no more C runtime error) and you do NOT lose your music...it's all in my library, as it was before.
    Good luck!

  • How to write this java code in jsp using jstl  tags?

    Can anybody help me on this?
    I dont know how to check the containsKey using jstl tags?
    <%
         LinkedHashMap yearMap     =     (LinkedHashMap)request.getAttribute("yearMap");
         TreeSet nocSet               =     (TreeSet)request.getAttribute("nocSet");
         Iterator     yearMapIt     =     yearMap.keySet().iterator();
         while(yearMapIt.hasNext())
              int yearValue               =     (Integer)yearMapIt.next();
    %>
    <tr>
              <td><%=yearValue%></td>
    <%
              LinkedHashMap monthMap     =     (LinkedHashMap)yearMap.get(yearValue);
              Iterator     nocSetIt     =     nocSet.iterator();
              while(nocSetIt.hasNext())
                   String nCase=(String)nocSetIt.next();
                   if(monthMap.containsKey(nCase))
                        String count     =     (String)monthMap.get(nCase);
    %>
                        <td> <%= count %> </td>
    <%            }
                   else
    %>          
                        <td> 0 </td>     
    <%          
    %>
    </tr>
    <% } %>Edited by: avn_venki on Feb 18, 2008 11:54 PM

    <c:forEach var="yearMap" items="${requestScope.yearMap}">
         <th> <c:out value="${yearMap.key}"/> </th>
    <bean:define id="monthMap" value="${yearMap.value}"/>
    <c:forEach var="nocSet" items="${nocSet}">
    then how to write containsKey using tags??

  • Actually i don't  know where to post this, but I'm MBA student and have to do a project about the HR functions in a famous company. and I'd like to talk about Apple inc, so how can i get some information about that, and who can help me in this?

    Can anyone help me in this?

    Sara ~ Apple's mission statement is HERE. But the following statement from Apple's now-CEO Tim Cook during a quarterly earnings conference call on 21 January 2009 may give more insight:
    "There is an extraordinary breadth and depth and tenure among the Apple executive team, and these executives lead over 35,000 employees that I would call "all wicked smart". And that's in all areas of the company, from engineering to marketing to operations and sales and all the rest. And the values of our company are extremely well entrenched.
    We believe that we're on the face of the Earth to make great products, and that's not changing. We're constantly focusing on innovating. We believe in the simple, not the complex. We believe that we need to own and control the primary technologies behind the products we make, and participate only in markets where we can make a significant contribution.
    We believe in saying no to thousands of projects so that we can really focus on the few that are truly important and meaningful to us. We believe in deep collaboration and cross-pollination of our groups, which allow us to innovate in a way that others cannot.
    And frankly, we don't settle for anything less than excellence in every group in the company, and we have the self-honesty to admit when we're wrong and the courage to change. And I think, regardless of who is in what job, those values are so embedded in this company that Apple will do extremely well."

  • Who can help me with this form?

    Having some problems with the form ive placed on my site.
    I cant find the problem. Is there someone who can tell me what i have done wrong.
    you can see the form on.
    http://www.salontouche.nl/explorers.htm
    and the error i get is..
    Oops! This page appears broken. DNS Error - Server cannot be found.
    hope to get some advice..
    this is the contactscript..
    <?php error_reporting(0);
        // VALUES FROM THE FORM
        $name        = $_POST['name'];
        $email        = $_POST['email'];
        $message    = $_POST['msg'];
        // ERROR & SECURITY CHECKS
        if ( ( !$email ) ||
             ( strlen($_POST['email']) > 200 ) ||
             ( !preg_match("#^[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)* )\.([A-Za-z]{2,})$#", $email) )
            print "Error: Invalid E-Mail Address";
            exit;
        if ( ( !$name ) ||
             ( strlen($name) > 100 ) ||
             ( preg_match("/[:=@\<\>]/", $name) )
            print "Error: Invalid Name";
            exit;
        if ( preg_match("#cc:#i", $message, $matches) )
            print "Error: Found Invalid Header Field";
            exit;
        if ( !$message )
            print "Error: No Message";
            exit;
    if ( strpos($email,"\r") !== false || strpos($email,"\n") !== false ){ 
            print "Error: Invalid E-Mail Address";
            exit;
        if (FALSE) {
            print "Error: You cannot send to an email address on the same domain.";
            exit;
        // CREATE THE EMAIL
        $headers    = "Content-Type: text/plain; charset=iso-8859-1\n";
        $headers    .= "From: $name <$email>\n";
        $recipient    = "[email protected]";
        $subject    = "Reactie van uw Website";
        $message    = wordwrap($message, 1024);
        // SEND THE EMAIL TO YOU
        mail($recipient, $subject, $message, $headers);
        // REDIRECT TO THE THANKS PAGE
        header("Location: http://www.salontouche.nl/thanks.php");
    ?>
    regards

    Having some problems with the form ive placed on my site.
    I cant find the problem. Is there someone who can tell me what i have done wrong.
    you can see the form on.
    http://www.salontouche.nl/explorers.htm
    and the error i get is..
    Oops! This page appears broken. DNS Error - Server cannot be found.
    hope to get some advice..
    this is the contactscript..
    <?php error_reporting(0);
        // VALUES FROM THE FORM
        $name        = $_POST['name'];
        $email        = $_POST['email'];
        $message    = $_POST['msg'];
        // ERROR & SECURITY CHECKS
        if ( ( !$email ) ||
             ( strlen($_POST['email']) > 200 ) ||
             ( !preg_match("#^[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)* )\.([A-Za-z]{2,})$#", $email) )
            print "Error: Invalid E-Mail Address";
            exit;
        if ( ( !$name ) ||
             ( strlen($name) > 100 ) ||
             ( preg_match("/[:=@\<\>]/", $name) )
            print "Error: Invalid Name";
            exit;
        if ( preg_match("#cc:#i", $message, $matches) )
            print "Error: Found Invalid Header Field";
            exit;
        if ( !$message )
            print "Error: No Message";
            exit;
    if ( strpos($email,"\r") !== false || strpos($email,"\n") !== false ){ 
            print "Error: Invalid E-Mail Address";
            exit;
        if (FALSE) {
            print "Error: You cannot send to an email address on the same domain.";
            exit;
        // CREATE THE EMAIL
        $headers    = "Content-Type: text/plain; charset=iso-8859-1\n";
        $headers    .= "From: $name <$email>\n";
        $recipient    = "[email protected]";
        $subject    = "Reactie van uw Website";
        $message    = wordwrap($message, 1024);
        // SEND THE EMAIL TO YOU
        mail($recipient, $subject, $message, $headers);
        // REDIRECT TO THE THANKS PAGE
        header("Location: http://www.salontouche.nl/thanks.php");
    ?>
    regards

  • Please help me whit this java code

    Hi!
    I have a litle problem whit this question:
    I try to write a program about Salary. The user writes(puts in from keyboard)
    the workers name, hourePayment and hour(how many hours He has worked).
    The program must compute first week ,second week....fourth week
    The user writes just one time name and hourPayment,
    but he must write hours(total hours he has worked)
    for every week(may be ha has worked 30 hours first week and 40 hours second week.....).
    when the user puts in zero the program stops(while(hour!=0)).
    I wrote the program but I have problem whit
    Test class when the program computes first ,second and...weeks, and if the user don not put in zero the program must compute another persons salary
    we should give new name new houre payement....
    how do I use the same information for second person and computes his salary.
    class Salary{
    private String name;
    private double hourPayment;
    public Salary (String name, double hourPayment, ..){
    this.name= name;
    this.hourPayment=hourPayment;
    public String getNamn(){
    return name;}
    public double getHourPayment(){
    return hourPayment;
    public double compute(int time){
    if(time<=40){
    normalSalary =(hourPayment*time);}
    else if(time>40){
    ....=(((40*hourPayment)+(time-40)*(3/2)*hourPayment));
    else if(timmar>70){
    System.out.println("WARRNING:"+" "+"You have worked more than 30

    The code you wrote only computes one week's salary. You need to wrap that inside loops that collect names, rates and hours. Here's some pseudocode to get you started:
    get name
    while name NOT ""
        get rate
        for i = 1 to 4
            get hours worked
            compute pay // this is the part you've coded
        next i
        get name
    end while

  • Who can help me,Open this file?

    The file is here
    Can't open-CS6.zip_免费高速下载|百度云 网盘-分享无限制

    You may want to be more clear.
    First of all, why can't you open it yourself? Is the file damaged? Does it give an error? Are you missing plugins?
    Second: it is last saved as a CS5 file:
    0: Created on Windows 5.1 in app version 5.0.0.488 (InDesign Japanese) build 488
    1: Save As on Windows 5.1 in app version 5.0.0.488 (InDesign Japanese) build 488
    2: Open As Copy on Windows 5.1 in app version 7.0.2.522 (InDesign Japanese) build 522
    3: Converted on Windows 5.1 in app version 7.0.2.522 (InDesign Japanese) build 522
    4: Save As on Windows 5.1 in app version 7.0.2.522 (InDesign Japanese) build 522
    5: Recovered MiniSave on Windows 5.1 in app version 7.0.2.522 (InDesign Japanese) build 522
    6: Recovered MiniSave on Windows 5.1 in app version 7.0.2.522 (InDesign Japanese) build 522
    7: Recovered MiniSave on Windows 5.1 in app version 7.0.2.522 (InDesign Japanese) build 522
    8: Recovered MiniSave on Windows 5.1 in app version 7.0.2.522 (InDesign Japanese) build 522
    9: Recovered MiniSave on Windows 5.1 in app version 7.0.2.522 (InDesign Japanese) build 522
    10: Save As on Windows 5.1 in app version 7.0.2.522 (InDesign Japanese) build 522
    11: Save As on Windows 5.1 in app version 7.0.2.522 (InDesign Japanese) build 522
    12: Save As on Windows 5.1 in app version 7.0.2.522 (InDesign Japanese) build 522
    13: Save As on Windows 5.1 in app version 7.0.2.522 (InDesign Japanese) build 522
    14: Most recent Save on Windows 5.1 in app version 7.0.2.522 (InDesign Japanese) build 522
    Finally, if someone *can* open it, then what?

  • Who can help me with this query???

    I have a table looks like:
    Group_id, Individual_id, field1, field2, field3...
    For individuals in this table who shares the same group id, they have exact same, filed1, 2, 3, 4 but different individual_id.
    How can I comebine them so I can creat a table that looks like:
    group_id, (Individual_id1, individual_id2, 3...), field1, field2, field3....
    Please Help!

    Use the WM_CONCAT function.
    http://www.psoug.org/reference/undocumented.html#uwmc

  • Using Iphoto 11 how do I change filename on photo so when it exports it does so in same sequence as Album created in.  Finder does not have option to keep as is... Thanks to anyone who can help me with this !

    The photos must be viewed in sequence as prepared with the filenames I have chosen to describe them.
    How can I just simply transfer this over to a dvd ?  Any help is appreciated !
    Thank You

    There are two ways to export photos so they remain in the same order as you put them in the iPhoto album:
    A:
    1 -  select the photos in the album and use the Photos ➙ Batch Rename  ➙ Title to Text menu with the option to add a sequential number to the file name.
    2 - Export out of iPhoto via File ➙ Export ➙ File Export with the option File Name = Title.
    B:
    1 - select all of the photos in the album and export via File ➙ Export ➙ File Export with the option File Name = Album name with number. 
    Both method will produce file with the following file name format:  xxxx-01.jpg, xxxx-02.jpg, etc., which will be in the order you had in iPhoto when view alphanumerically in the Finder.
    OT

  • Is there any one who can help me solve this?

    Hi.
    I'm taking AP Computer Scinece AB in high school now.
    I've been assigned many programs so far. But.. I can't figure them out.
    There are two programs I need your help. So..Please!!!!!! Help Me!!!!
    Please!! Enjoy helping me!
    <Program #1>
    It's divided into three small programs and I've figured out one of them, which was the easiest one..You will be able to see the programs if you click on the link below.
    (page1)
    http://iboard3.superboard.dreamwiz.com/board.cgi?db=90_darkoo&idx=2&page=1
    (page2)
    http://iboard3.superboard.dreamwiz.com/board.cgi?db=90_darkoo&idx=3&page=1
    <Program #2>
    http://iboard3.superboard.dreamwiz.com/board.cgi?db=90_darkoo&idx=4&page=1
    The way I figured out first part of program #1 was like this :
    public class ThreeX1
    public static void main ( string[] org )
    system.out.println ();
    int startValue = 21;
    int count = 0;
    while (startValue >1)
    count ++;
    if (startValue % 2 == 0)
    startValue = startValue/2;
    else
    startValue = 3*startValue +1;
    system.out.println ( count );
    ===================================================
    From there, for the second and third programs of program #1, I tried to figure it out by using 'for' statement instead of 'while', but I couldn't.
    So..Please help me out.. Thank you
    or you can e-mail me too. It would be great too.
    add. : [email protected]

    I probably shouldn't be doing your homework but here it is:
    public class ThreeX2{
         public static void main ( String[] org ){
              int startValue = 2;
              while(startValue<100){
                   System.out.print(startValue);
                   System.out.print("\t");
                   System.out.println(timesToGetToOne(startValue));
                   startValue++;
         private static int timesToGetToOne(int intForValue){
              int count = 0;
              while (intForValue!=1){
                   count ++;
                   if (intForValue % 2 == 0)
                        intForValue = intForValue/2;
                   else
                        intForValue = 3*intForValue +1;
              return count;
    public class ThreeX3{
         public static void main ( String[] input ){
              int maximumTries = 1000000;
              int numberOfitterations = 10;
              try{
                   numberOfitterations = new Integer(input[0]).intValue();
              }catch(Exception e){
              try{
                   maximumTries = new Integer(input[1]).intValue();
              }catch(Exception e){
              int startValue = 2;
              while(startValue<maximumTries){
                   if(timesToGetToOne(startValue)==numberOfitterations){
                        System.out.print("When startvalue is: ");
                        System.out.print(startValue);
                        System.out.print(" it will take exatly ");
                        System.out.print(timesToGetToOne(startValue));
                        System.out.println(" iterations to get to 1.");
                        // remove the next line and it will show all values that
                        // takes numberOfitterations amount of times to get to 1
                        break;
                   startValue++;
         private static int timesToGetToOne(int intForValue){
              int count = 0;
              while (intForValue!=1){
                   count ++;
                   if (intForValue % 2 == 0)
                        intForValue = intForValue/2;
                   else
                        intForValue = 3*intForValue +1;
              return count;
    }Problem 3 is diffucult, since the input is one date I assume that the current reading is for this date. I don't
    know the date of the previous reading so I cannot calculate if the consumption is between June through
    Ocober.
    your Main method shoud have 4 inputs date accountNumber currentReading previousReading
    Your main function would look like this:
         public static void main ( String[] input ){
              Calendar date=null;
              int accountNumber = 0;
              int currentReading = 0;
              try{
                   String[] s = input[0].split("/");
                   date = Calendar.getInstance();
                   date.set(Calendar.YEAR,new Integer(s[2]).intValue());
                   date.set(Calendar.MONTH,new Integer(s[0]).intValue()-1);
                   date.set(Calendar.DAY_OF_MONTH,new Integer(s[1]).intValue());
              }catch(Exception e){
                   System.out.println("cannot get date, please start this program the following way: ");
                   System.out.println("programName date(format mm/dd/yyyy) accountNumber currentReading previousReading");
              try{
                   accountNumber = new Integer(input[1]).intValue();
              }catch(Exception e){
                   System.out.println("cannot get account number, please start this program the following way: ");
                   System.out.println("programName date(format mm/dd/yyyy) accountNumber currentReading previousReading");
              try{
                   currentReading = new Integer(input[2]).intValue();
              }catch(Exception e){
                   System.out.println("cannot get current reading, please start this program the following way: ");
                   System.out.println("programName date(format mm/dd/yyyy) accountNumber currentReading previousReading");
              try{
                   previousReading = new Integer(input[3]).intValue();
              }catch(Exception e){
                   System.out.println("cannot get previous reading, please start this program the following way: ");
                   System.out.println("programName date(format mm/dd/yyyy) accountNumber currentReading previousReading");
    // check the date between june and oct:
    // (5>date.get(Calendar.MONTH))&&(9<date.get(Calendar.MONTH))

  • Please help to write a java code for generate Random numbers

    I need a program for generate Random integer numbers by using roulette wheel theory. I search several ares, but I'm unable to find out at lease a Pseudo code for implement this. If you know or have a code for this, Please send me a mail to [email protected] or post here.

    Gagana wrote:
    I need a program for generate Random integer numbers Have a look at the java.util.Random class:
    [http://java.sun.com/j2se/1.5.0/docs/api/java/util/Random.html]
    Or Google:
    [http://www.google.com/search?q=random+java]
    by using roulette wheel theory. What is that?
    ... Please send me a mail to [email protected]
    No, that defeats the purpose of a public forum. And no one is going to e-mail you (other than someone trying to sell V1AGRA).

Maybe you are looking for

  • Path palette: What's wrong with "path share" and "path exclude"?

    Hi everybody. First of all: Sorry for my english, but I hope someone can understanding me. Well, I want to work with Fireworks in the future because I think that this programm keep in some situation more efficience as Photoshop... So I was trying to

  • Arrow symbol in Pages

    I have recently switched from PC to Mac. One of the few things I cannot seem to figure out in Pages is how to add that little arrow-thingy. In newer versions of MS Office you have to punch "-" "-" ">" (i.e.: -->) and that is then transformed into a n

  • Why has my streaming slowed down

    I have had my mac for a few months now. Absolutely love it. We watched youtube and online tv constantly with no problems. Lately though streaming has slowed and the videos are constantly buffering. Is there something I could have downloaded that slow

  • Do they have a calendar for anniversary like birthdays that info gets picked up from address book?

    Do they have a calendar for anniversaries like birthdays that get info from Address Book?  I would be very effective.  I wold not like to have to enter all the info over again.

  • Capturing in HDV

    Hello all. Sorry if this is a silly question but... I just made the switch from DV to HDV. The capture process in DV allowed me to control the device and only record what I wanted. It seems, from reading the manual, that with HDV the only capture opt