Şimdi Ara

Ingilizce Java bilenler cok ACIL

Daha Fazla
Bu Konudaki Kullanıcılar: Daha Az
1 Misafir - 1 Masaüstü
5 sn
3
Cevap
0
Favori
420
Tıklama
Daha Fazla
İstatistik
  • Konu İstatistikleri Yükleniyor
0 oy
Öne Çıkar
Sayfa: 1
Giriş
Mesaj
  • zdsada



    < Bu mesaj bu kişi tarafından değiştirildi furjan -- 25 Ekim 2011; 17:06:13 >



  • Yapilmasi gereken o classla son parantez arasina monte etmek . bir turlu yapamadim. Get ve setlerle olmasi gerekyor
  • quote:

    Orijinalden alıntı: furjan

    Merhaba arkadaslar ben amerikada okuyorum ve bir yerde takildim yarina yetistirmem gereken bir odev var . programi yazdim ama sadece sunlar gerekiyor.Ingilizce olarak yaziyorum.Eger yardim ederseniz minnettar olurum cok tesekkur ederim . sabaha kadar gerekli 5 saat icerisinde

    Create 3 methods
    A method that validates input
    A method that loads and sorts the content of the array in ascending order
    A method that checks for a match and displays results
    Allow program to repeat by entering a ‘Y’ or ‘y”.

    programda bu ;


     
    package LabAssignments;

    import java.util.Random;
    import javax.swing.JOptionPane;

    /**
    *
    * @author jam
    * 10-24-11
    */
    public class LabAssign7 {

    /**
    * @param args the command line arguments
    */
    public static void main(String[] args) {
    Random rn = new Random();
    boolean repeat = false;
    boolean guess = false;

    int[] lotto = new int[5];
    String input;
    int intinput;
    //Comparing 2 arrays and come back to first array
    for (int a = 0; a < lotto.length; a++) {

    lotto[a] = rn.nextInt(39) + 1;
    for (int k = 0; k < a; k++) {
    if (lotto[a] == lotto[k]) {
    a--;
    break;//
    }
    }

    }
    do {
    input = JOptionPane.showInputDialog(null, "Guess a number from 1-39",
    "Are You Feeling Lucky?", JOptionPane.QUESTION_MESSAGE);
    intinput = Integer.parseInt(input);
    repeat = false;


    //checks the range of input if its not correct
    if (intinput > 39 || intinput < 1) {
    JOptionPane.showMessageDialog(null, "Sorry, your guess of " + input
    + " was out of range (1-39)", "Input Error", JOptionPane.ERROR_MESSAGE);
    repeat = true;
    }
    } while (repeat);


    for (int b = 0; b < lotto.length; b++) {
    if (intinput == lotto[b]) {
    guess = true;
    }
    }

    if (guess == true) {
    JOptionPane.showMessageDialog(null, "Congrats, your guess of " + intinput
    + " was one of the numbers were:" +"\n"+ lotto[0] + ", " + lotto[1] + ", " + lotto[2] + ", " + lotto[3] + ", " + lotto[4], "Lucky",
    JOptionPane.INFORMATION_MESSAGE);
    } else {
    JOptionPane.showMessageDialog(null, "Sorry, your guess of " + intinput
    + " was NOT one of the numbers were: "+"\n" + lotto[0] + ", " + lotto[1] + ", " + lotto[2] + ", " + lotto[3] + ", " + lotto[4], "No Luck", JOptionPane.WARNING_MESSAGE);
    }



    System.exit(0);




    }
    }



    Herkes bir el atsın :) kodu Gist'e yapıştırdım:https://gist.github.com/1311752
    loadAndSort için method yazdım inşallah compile eder :)
    Kolay gele...




  • 
Sayfa: 1
- x
Bildirim
mesajınız kopyalandı (ctrl+v) yapıştırmak istediğiniz yere yapıştırabilirsiniz.