battle programmers alliance

battle programminga forum for elite programmerswith extreme will powerto sharpen theire skills
 
HomeCalendarFAQSearchMemberlistUsergroupsRegisterLog in
Search
 
 

Display results as :
 
Rechercher Advanced Search
Latest topics
» auto programming dev
Fri Jan 19, 2018 6:42 pm by Admin

» java eclipse oxygen grimoire
Tue Jan 09, 2018 7:19 pm by Admin

» vb.net megazord string outputter
Tue Jan 09, 2018 7:11 pm by Admin

» win10 shortcut keys
Sun Jan 07, 2018 10:16 pm by Admin

» web site grimoire with html css and JS
Sun Dec 31, 2017 5:37 pm by Admin

» vb.net convert array to xy coodinates
Fri Dec 08, 2017 2:18 pm by Admin

» JS javascript convert number to words
Wed Dec 06, 2017 1:23 pm by Moti Barski

» JS pascal triangle question
Mon Dec 04, 2017 9:54 am by Admin

» youtube emojis
Mon Dec 04, 2017 12:14 am by Admin

January 2018
SunMonTueWedThuFriSat
 123456
78910111213
14151617181920
21222324252627
28293031   
CalendarCalendar
Social bookmarking
Social bookmarking digg  Social bookmarking delicious  Social bookmarking reddit  Social bookmarking stumbleupon  Social bookmarking slashdot  Social bookmarking yahoo  Social bookmarking google  Social bookmarking blogmarks  Social bookmarking live      

Bookmark and share the address of battle programmers alliance on your social bookmarking website
Share | 
 

 auto programming dev

View previous topic View next topic Go down 
AuthorMessage
Admin
Admin
avatar

Posts : 78
Join date : 2011-08-01

PostSubject: auto programming dev   Tue Jan 09, 2018 5:03 pm


_________________
kurayami no kagi  _____    
Back to top Go down
View user profile https://yotamarker.justforum.net
Admin
Admin
avatar

Posts : 78
Join date : 2011-08-01

PostSubject: deck build Auto program puzzle   Fri Jan 19, 2018 6:42 pm

card class :
Code:

package gambit;

public class Card {
 String type, color;
 int level;
 public void printCard() {
 
 switch (level) {
 case 1:System.out.println("Ace of " + type);break;
 case 11:System.out.println("prince of " + type);break;
 case 12:System.out.println("queen of " + type);break;
 case 13:System.out.println("king of " + type);break;
 default:System.out.println(color + " " + type + " level " + level);break;
 }
 }
}
deck class :

Code:

package gambit;

public class Deck {
 Card[] cards = new Card[52];
 public void initDeck() {
 for (int i = 0; i < 13; i++) {
 cards[i] = new Card();
 cards[i].type = "clubs";
 cards[i].color = "black";
 cards[i].level = i+1;
 }
 for (int i = 13; i < 26; i++) {
 cards[i] = new Card();
 cards[i].type = "hearts";
 cards[i].color = "red";
 cards[i].level = i-12;
 }
 for (int i = 26; i < 39; i++) {
 cards[i] = new Card();
 cards[i].type = "spades";
 cards[i].color = "black";
 cards[i].level = i-25;
 }
 for (int i = 39; i < 52; i++) {
 cards[i] = new Card();
 cards[i].type = "diamonds";
 cards[i].color = "red";
 cards[i].level = i-38;
 }
 }
 public void printDeck() {
 for (int i = 0; i < 52; i++) {
 cards[i].printCard();
 }
 
 }
}
Main class : (set as public static void main)
Code:

package gambit;

public class Main {

 public static void main(String[] args) {
 // TODO Auto-generated method stub
 Deck d1 = new Deck();
 d1.initDeck();
 d1.printDeck();
 }

}


_________________
kurayami no kagi  _____    
Back to top Go down
View user profile https://yotamarker.justforum.net
 
auto programming dev
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» How to add auto-resize
» Command for auto populated text verification.
» Cedar Nyx's Auto Mug Formatter (For FEXP/FEXNA/FEDE)
» Auto Add to Cart
» Does Firefox Webdriver support Auto-complete feature?

Permissions in this forum:You cannot reply to topics in this forum
battle programmers alliance :: battle programming alliance :: chit chat-
Jump to: