title: How to add the values of two “Cards” in Java?
body: <p>I am working on a project to simulate the first deal in a game of blackjack. So far, the program creates two cards of random rank (such as 2 or 3) with a random suit. I am struggling with creating a <strong>switch table or if-else ladder</strong> to assign the added value of the two cards as the variable "score". The professor created a java .class where each card rank is assigned an integer value (Two is the 0th card so it has a value of 0, Three is the 1st card so it has a value of 1). My problem is to create a Score() method to calculate the <em>actual</em> added score of the two cards.</p>
  
  <pre><code>if (card1.rank() == 0){
          score = 2;            
      } else if (card1.rank() == 1){ //I need the program to examine both card1 and card2
          score = 3;
      } else if (card1.rank() == 2){
          score = 4;
  </code></pre>
  
  <p>I only know how to assign a new value to <em>one</em> of the cards, how can I alter this code so that it takes the values of <em>both</em> cards and returns the correct score instead of just one of the cards? Thanks so much for the help, I will do my best to quickly answer any questions to clarify.</p>