import java.awt.*;
import javax.swing.*;

/**
 * Calculates and displays the score for the Java Trivia game. 
 * 
 * @author Chase Conner
 * @version JDK 8
 * @course 1130-01
 * @date 11-22-15
 */
public class Scoreboard
{ 
    protected int score = 0;
    protected int pointsEarned;
    protected int xCoord, yCoord;
    
    public Scoreboard(int xCoord,int yCoord)
    {
        
    }
 
    /*
     * Method that determines how many points the user earns
     * depending on the JButton they pressed and if they answered 
     * correctly.
     */
     public int getPoints(String input)//added parameter
    {
        //switches the number of points the user earns upon answering a question correctly 
        
        switch (input){
            case "class": case "x and y coordinates": case "an inline comment": 
         
            pointsEarned = 10; break;
       
            
            case "creates a new color": case "Boolean": case "Sets the level of access to classes, variables, and methods by other classes.":
         
            pointsEarned = 20; break;
     
            
            case "8": case "Instance variables are declared outside of methods.": case "for": 
            
            pointsEarned = 30;  break;
   
  
            case "Yes, they do": case "No, they can't": case "employeeInfo(name, title, salary);":
          
            pointsEarned = 40; break;
           
            
            case "null": case "break;": case "A method that sets the value of a field.":
           
            pointsEarned = 50; break;
           

            default: pointsEarned = 0; break;
      
        }
        
        return pointsEarned;

    }
    
    public int calculateScore()
    {
        //calculates the total score 
        score = score + pointsEarned;
        return score;
    }
    
    public void display(Graphics g)
    {
        g.setFont(new Font("Courier New", Font.BOLD, 30)); //changes font, typee, and zize
        
        g.setColor(Color.gray);
        g.fillRect(100, 250, 200, 100); //draws the board
        g.setColor(Color.green); //sets the font color as green
        g.drawString("SCORE", 155, 290); //draws the score string 
        g.drawString(""+score, 186, 328); //draws the score
        
    }
    
}

