Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

how will i get the last part to print out correctly using printf and having the

ID: 640308 • Letter: H

Question

how will i get the last part to print out correctly using printf and having the information printed underneath it ("Min PTS FGM FGA FG% 3PM 3PA 3P% FTM FTA FT% OREB DREB REB AST STL BLK TOV PF GS"). And centered under each one. Here is the code i have completed. please help.

public static void main(String[] args) {
//main method body
  
Scanner keyboard = new Scanner(System.in);

System.out.println("Please enter the following information: ");
String output;

//enter the player name
String playName;
System.out.print("Player name: ");
playName = keyboard.nextLine();

//enter the team name
String teamName;
System.out.print("Team or School name: ");
teamName = keyboard.nextLine();

//enter in the opposing team school name
String oppTeam;
System.out.print("Enter the opponent's team or school name: ");
oppTeam = keyboard.nextLine();

//enter the date of the game
String date;
System.out.print("Enter the date the game was played: ");
date = keyboard.nextLine();

//enter the minutes the player was in the game for
int minutes;
System.out.print("Minutes played: ");
minutes = keyboard.nextInt();

//enter in the number of all field goals attempted
int fieldAttempt;
System.out.print("Field Goals attempted: ");
fieldAttempt = keyboard.nextInt();

//enter in the number of field goals made
int fieldMade;
System.out.print("Field Goals made: ");
fieldMade = keyboard.nextInt();

//enter in the number of three pointers shot
int threeAttempt;
System.out.print("Three point shots attempted: ");
threeAttempt = keyboard.nextInt();

//enter in the number of three pointers made
int threeMade;
System.out.print("Three point shots made: ");
threeMade = keyboard.nextInt();

//enter in the number of free throws shot
int freeAttempt;
System.out.print("Free throws attempted: ");
freeAttempt = keyboard.nextInt();

//enter in the number of free throws made
int freeMade;
System.out.print("Free throws made: ");
freeMade = keyboard.nextInt();

//enter in the number of offesive rebounds made
int offRebound;
System.out.print("Offensive rebounds made: ");
offRebound = keyboard.nextInt();

//enter the number of defensive rebounds made
int defRebound;
System.out.print("Defensive rebounds made: ");
defRebound = keyboard.nextInt();

//enter in the number of assists in the game
int assists;
System.out.print("Number of assists: ");
assists = keyboard.nextInt();

//enter the number of steals the player had
int steals;
System.out.print("Number of steals: ");
steals = keyboard.nextInt();

//enter in the number of blocks the player had in the game
int blocks;
System.out.print("Number of blocks: ");
blocks = keyboard.nextInt();

//enter the number of turnovers the player had
int turnovers;
System.out.print("Number of turnovers: ");
turnovers = keyboard.nextInt();

//enter the amount of fouls the player had
int perFouls;
System.out.print("Number of personal fouls: ");
perFouls = keyboard.nextInt();

System.out.println("");

final double FIELD_GOALS_MADE_COEFFICENT = .4;
final double FIELD_GOALS_ATTEMPTS_COEFFICIENT = .7;
int points;
double gameScore;
int freeMissed;
double fieldGoalPercent;
double threePointPercent;
double freeThrowPercent;
int rebounds;
int twoPointersMade;
int threePointersTotal;

//Calculations of the percentages and game score
twoPointersMade = (fieldMade - threeMade) * 2;
freeMissed = freeAttempt - freeMade;
threePointersTotal = threeMade * 3;
points = twoPointersMade + threePointersTotal + freeMade;
gameScore = points + (FIELD_GOALS_MADE_COEFFICENT * fieldMade) - (FIELD_GOALS_ATTEMPTS_COEFFICIENT * fieldAttempt) - (FIELD_GOALS_MADE_COEFFICENT * freeMissed)
+ (FIELD_GOALS_ATTEMPTS_COEFFICIENT * offRebound) + (0.3 * defRebound) + steals + (FIELD_GOALS_ATTEMPTS_COEFFICIENT * assists)
+ (FIELD_GOALS_ATTEMPTS_COEFFICIENT * blocks) - (FIELD_GOALS_MADE_COEFFICENT * perFouls) - turnovers;
fieldGoalPercent = (fieldMade * 100 / fieldAttempt);
threePointPercent = (threeMade * 100 / threeAttempt);
freeThrowPercent = (freeMade * 100 / freeAttempt);
rebounds = offRebound + defRebound;

//re-prints the information that was given above
System.out.printf("Player name: " + playName);
System.out.println("");
System.out.printf("Team: " + teamName);
System.out.println("");
System.out.printf("Opponent: " + oppTeam);
System.out.println("");
System.out.printf("Game Date: " + date);
System.out.println("");
System.out.printf("Min PTS FGM FGA FG% 3PM 3PA 3P% FTM FTA FT% OREB DREB REB AST STL BLK TOV PF GS" , minutes
, points, fieldMade, fieldAttempt, fieldGoalPercent, threeMade, threeAttempt, threePointPercent, freeMade, freeAttempt, freeThrowPercent
, offRebound, defRebound, rebounds, assists, steals, blocks, turnovers, perFouls, gameScore);

}//end of method main
  
}//end of program

Explanation / Answer

Or even better, use css to style it, for example :