我正在尝试做这个家庭作业问题,但我在设置它和理解如何开始和完成这些结果时遇到困难。
到目前为止,我已经声明了公式的变量,创建了扫描仪并尝试编写公式。这是我到目前为止所拥有的:
//declaring variables
float a_CompletionPercentage, b_YardsPerAttempt, c_TouchdownsPerAttempt, d_InterceptionsPerAttempt;
float PasserRating;
double Completion, Attempts, Touchdowns, Yards, Interceptions;
Scanner in = new Scanner(System.in); //create Scanner Object
//PlayerName input
System.out.print("Enter the full name of the quarterback: "); //prompt asks for player name
String PlayerName = in.nextLine(); //set string PlayerName as user's input
//attempts input
System.out.print("Enter the number of attempts: "); //prompt asks for # of attempts
Attempts = in.nextDouble(); //set variable Attempts as user's input for # of attempts
//completion input
System.out.print("Enter the number of completions: ");
Completion = in.nextDouble();
//yards input
System.out.print("Enter the number of yards: ");
Yards = in.nextDouble();
//touchdowns input
System.out.print("Enter the number of touchdowns: ");
Touchdowns = in.nextDouble();
//interceptions input
System.out.print("Enter the number of interceptions: ");
Interceptions = in.nextDouble();
我不确定我的变量是否已正确声明并且我的公式不起作用。
这些是我应该得到的一些示例输出:输出示例 1:
输入四分卫的全名:Jameis Winston
输入尝试次数:35
输入完成次数:22
输入码数:345
输入达阵次数:4
输入拦截次数:1
Jameis Winston 的传球者评分为 121.72619047619047
但我得到的是 664.58325 而不是 121.72619047619047。
胡说叔叔
汪汪一只猫
炎炎设计
相关分类