— Scott McNealy, Sun Microsystems Chairman, President and ceo



Download 40,57 Mb.
Pdf ko'rish
bet109/555
Sana26.05.2022
Hajmi40,57 Mb.
#609235
1   ...   105   106   107   108   109   110   111   112   ...   555
Bog'liq
Head First Java (Kathy Sierra, Bert Bates) (z-lib.org)

0
 
1
 
2
 
3
 
4
 
5
 
6
1
Game starts, and creates ONE DotCom 
and gives it a location on three cells in 
the single row of seven cells. 
Instead of “A2”, “C4”, and so on, the 
locations are just integers (for example: 
1,2,3 are the cell locations in this 
picture: 
2
Game play begins. Prompt user for 
a guess, then check to see if it hit 
any of the DotCom’s three cells. 
If a hit, increment the numOfHits 
variable.
3
Game fi nishes when all three cells have 
been hit (the numOfHits variable val-
ue is 3), and tells the user how many 
guesses it took to sink the DotCom.
File Edit Window Help Destroy
%java SimpleDotComGame
enter a number 2
hit
enter a number 3
hit
enter a number 4
miss
enter a number 1
kill
You took 4 guesses

simpler version 
of the game


you are here
4
writing 

program
99
A complete game interaction
Developing a Class
As a programmer, you probably have a methodology/
process/approach to writing code. Well, so do we. Our 
sequence is designed to help you see (and learn) what 
we’re thinking as we work through coding a class. It 
isn’t necessarily the way we (or you) write code in the 
Real World. In the Real World, of course, you’ll follow 
the approach your personal preferences, project, or 
employer dictate. We, however, can do pretty much 
whatever we want. And when we create a Java class as a 
“learning experience”, we usually do it like this:
o

Download 40,57 Mb.

Do'stlaringiz bilan baham:
1   ...   105   106   107   108   109   110   111   112   ...   555




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish