Arama butonu
Bu konudaki kullanıcılar: 1 misafir
2
Cevap
491
Tıklama
0
Öne Çıkarma
Ingilizce Java bilenler cok ACIL
F
14 yıl
Teğmen
Konu Sahibi

zdsada





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

F
14 yıl
Teğmen
Konu Sahibi

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



U
14 yıl
Binbaşı

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...



DH Mobil uygulaması ile devam edin. Mobil tarayıcınız ile mümkün olanların yanı sıra, birçok yeni ve faydalı özelliğe erişin. Gizle ve güncelleme çıkana kadar tekrar gösterme.