import java.util.*;
import java.lang.*;
public class poker extends Object {
public poker() {
}
static java.util.Random r=new java.util.Random();
public static int pickcard(){
return r.nextInt(13)+1;
}
public static int picksuit(){
return r.nextInt(4)+1;
}
public static String cardname(int card, int suit){
String cardname="";
if (card>1&&card<11){System.out.print(card);}
if (card==1){cardname="Ace";}
if (card==11){cardname="Jack";}
if (card==12){cardname="Queen";}
if (card==13){cardname="King";}
if (suit==1){cardname=cardname + " of diamonds. ";}
if (suit==2){cardname=cardname + " of hearts. ";}
if (suit==3){cardname=cardname + " of spades. ";}
if (suit==4){cardname=cardname + " of clubs. ";}
return cardname;
}
public static void main (String args[]) {
int card,suit,card1=0,suit1=0,card2=0,suit2=0,card3=0,suit3=0,card4=0,suit4=0,card5=0,suit5=0;
int ran=0;
while (ran<5)
{
card = pickcard();
suit = picksuit();
if (ran!=0){
while ((card==card1 && suit==suit1)||(card==card2 && suit==suit2)|| (card==card3 && suit==suit3)|| (card==card4 && suit==suit4))
{
card = pickcard();
suit = picksuit();
}
}
if (ran==0){
card1=card;
suit1=suit;}
if (ran==1){
card2=card;
suit2=suit;}
if (ran==2){
card3=card;
suit3=suit;}
if (ran==3){
card4=card;
suit4=suit;}
if (ran==4){
card5=card;
suit5=suit;}
String cardname=cardname(card, suit);
System.out.print(cardname);
Bueza, I wouldnt really call these errors. I have worked in industry and its purely the developers decision whether he/she uses block openers on new lines.
Originally posted by buntine Bueza, I wouldnt really call these errors. I have worked in industry and its purely the developers decision whether he/she uses block openers on new lines.
Whitespace wont effect the syntax.
Hmm, my lab instructor (who has worked for Symantec) said there was an standard of coding for each company, and for Symantec, they have a style-checker program that's something close to the restrictions of Checkstyle off of Sourceforge.
That's why when we code in Java in University right now, we lose marks for not conforming to the style guidelines. :P
But, yeah, it totally depends on the developers. In this case, for Symantec, there are a lot of developers, so they need to follow a specific style guide.
Symantec has been a good SE company with good practices. In a rigorous shop there'll be coding standards that are inforced by tools like Checkstyle or Jalopy and part of the process of checking code into the CMS will be to first run the company's configuration of a pretty printer on the source. There are two big benefits there. First, the code all looks the same so it's easier for teams to work on it and understand it. Second, the diffs between versions of a piece of code will really be functional changes, not just formatting changes. There are a lot of pretty printers out there but there aren't a lot of really good ones.
Bookmarks