This is the instructions
Program converts American football plays into scoring points
Touchdown – 6
Extra point after touchdown – 1
Field goal – 3
Touchback – 2
Program reads play-name and uses “if-statement” to decide how many points to award
Program does calculations in a loop to allow more than one play
Score two teams, home and away
Ex: Please enter a play: touchdown
Which team scored: home
Display cumulative score for both teams after each play
Display winner and final score
import java.util.Scanner;
public class football
{
public static void main(String [] args)
{
Scanner kbd = new Scanner(System.in);
int score = 0;
String play = "start";
while(! play.equals("end"))
{
System.out.print("Please enter a play: ");
play = kbd.next();
if (play.equals("touchdown"))
{
score = score + 6;
}
if (play.equals("touchback"))
{
score = score + 2;
}
if (play.equals("extrapoint"))
{
score = score + 1;
}
if (play.equals("fieldgoal"))
{
score = score + 3;
}
}
System.out.println("Final score is " + score);
}
}