Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

import java.io.*; import java.util.Scanner; public class AFLPlayer extends AFLTeamMember { private int number; // number declared for the AFLPlayer private boolean isCaptain; // isCaptain declared

import java.io.*;
import java.util.Scanner;
public class AFLPlayer extends AFLTeamMember
{
private int number; // number declared for the AFLPlayer
private boolean isCaptain; // isCaptain declared for the AFLPlayer
public AFLPlayer (String name, String position, int number, boolean isCaptain) // AFLPlayer can extend the name and its position for the isCaptain
{
super (name, position); // super keyword used for the setting the name and its position for the AFLPlayer
setNumber (number); // set the number for the AFLPlayer
setCaptain(isCaptain); // isCaptain for extension for the AFLPlayer
}
public int getNumber () // getting the number
{
return number; // returning the number
}
public void setNumber (int number) //setting the number which is type of int for the AFLPlayer
{
try // try
{
if (number>0)
this.number = number;
else
throw new
Exception ("Invaid player number!"); // invalid player number
}
catch (Exception e) // catch the exception
{
System.out.println(e); // print out the exception
}
}
public boolean isCaptain () // isCaptain for the exceptional isCaptain
{
return isCaptain; // returning the isCaptain
}
public void setCaptain (boolean isCaptain); //setCaptain for the exceptional isCaptain
public String toString()
{
if(isCaptain)
return " [" +number+"]"
"+super.toString()+" (c);
return "["+number+"]
"+super.toString(); //returning the number
}
}
}
*******CAN ANYONE FIX THE ERRORS IN IT AMD TYPE THE RIGHT CODE FOR THIS*******
image text in transcribed
Execute Mode, Version, inputs 8 Arguments: CommandLine Arauments Result CPU Time: sec(s), Memory: kilobyte(s) /AFLP1ayer.java: 42; error; not a statement "+super, tostring ( ) + " (c)"; /AFLP1ayer,javas 42, error; "', expected "tsuper, toString ()+n(c)"; /AFLPlayer, java:42: error: not a statenent "+super, toString()+" (c)"; /AFLPlayer. javai42; error: ';' expected "+super, tostring()+" (c)"; /AFLP1ayer.java:421 errort unclosed string literal "+super, tostring()+" (c)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Web Database Development Step By Step

Authors: Jim Buyens

1st Edition

0735609667, 978-0735609662

More Books

Students also viewed these Databases questions

Question

Describe the three main budgeting techniques.

Answered: 1 week ago

Question

=+country competitive advantages? Why? Support your point of view.

Answered: 1 week ago