It should be returning the value of 70.28, but it returns 0.0. I don't understand why it does this. The equation is set up. I had it set in a method, but I took it out so I can keep those values and use them later on. It worked inside the method, but now that it's out of the method it doesn't work.
import java.util.Scanner;
import javax.swing.JOptionPane;
import java.text.DecimalFormat;
public class Assignment51
{
public static void main(String[] args)
{
/*
Four Categories are used as a basis for compiling a rating:
1. Percentage of completions
2. Average yards gained
3. Percentage of touchdown passes per attempt
4. Percentage of interceptions per attempt
*/
// DecimalFormat formatter = new DecimalFormat("#,##0.000");
String input; //get user input
String name; //player name
int completion; //number of completions in percentages
int yardsGained; //number of yards gained
int tdpasses; //number of touchdown passes
int interceptions; //number of interceptions
int attempts; //number of attempts
int yards; //number of yards
double score; //passer score
double totalScore; //total score
double totalPoints; //total award points
double total; //total sum
double awardPoints1 = 0.0; //awarded points +/- 2.375
double awardPoints2 = 0.0;
double awardPoints3 = 0.0;
double awardPoints4 = 0.0;
double percentComp;
double pointRatingComp;
int num1;
//get player name
name = JOptionPane.showInputDialog("Type in the player name");
//get number of attemps/passes
input = JOptionPane.showInputDialog("Type in the TOTAL number of passes");
attempts = Integer.parseInt(input);
//get number of completed passes
input = JOptionPane.showInputDialog("Type in the number of COMPLETED passes");
num1 = Integer.parseInt(input);
percentComp = ((num1 / attempts) * 100);
//DEBUG
System.out.println(percentComp);
//point rating
pointRatingComp = ((percentComp - 30) * .05);
//Creating Methods
double PctCompletion = PctCompletion(attempts, percentComp);
double AvgYardsGain = AvgYardsGain(attempts);
double PctTouchdown = PctTouchdown(attempts);
double PctInterceptions = PctInterceptions(attempts);