1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Kisachek [45]
3 years ago
6

a) Write out an abstract class to represent a ball. Include data fields to store the weight of the ball as a double value and th

e color of the ball as a String. Include a no-arg constructor as well as a two-arg constructor to set these two fields. Declare an abstract method, howToPlay(), which is to describe how the ball is used by printing this description to the command line.
Computers and Technology
2 answers:
guapka [62]3 years ago
7 0

Answer:

Check the explanation

Explanation:

//Ball.java

public abstract class Ball {

   double value;

   String color;

   public Ball() {

   }

   public Ball(double value, String color) {

       this.value = value;

       this.color = color;

   }

   public abstract void howToPlay();

}

////////////////////////////////////////////

//SoccerBall.java

public class SoccerBall extends Ball {

   public void howToPlay() {

       System.out.println("Description to how to play soccer ball");

   }

}

Lyrx [107]3 years ago
3 0

Answer:

See explaination

Explanation:

Code

abstract class Ball

{

double weight;

String color;

Ball()

{

this.weight=0;

this.color=" ";

System.out.println("Abstract class constructor");

}

Ball(double weight,String color)

{

this.weight=weight;

this.color=color;

System.out.println("Parameterized constructor of Abstract class with weight = "+weight+" color = "+color);

}

public abstract void howToPlay();

}

public class Baseball extends Ball {

int no;

String name;

int bat,hi ts;

Baseball() {

super(20,"red");

System.out.println("BaseBall class Constructor");

}

Baseball(int no,String name,int bat,int hi ts)

{

this.no=no;

this.name=name;

this.bat=bat;

this.hi ts=hi ts;

}

public void howToPlay()

{

System.out.println("How to play method weight = "+weight+ " color = "+color);

}

public void display()

{

System.out.println("Player no: "+no+" name = "+name+" numberAtbat = "+bat+" hi ts = "+hit s);

}

public static void main(String[] args) {

Baseball ob j = new Baseball();

Baseball ob j1 = new Baseball(1,"abc",1,3);

ob j.howToPlay();

ob j1.display();

}

}

You might be interested in
What changes has Sue made so far? Check all that apply.
Alexus [3.1K]

Answer:

Its C, E, and F

Explanation:

On edg

8 0
2 years ago
Read 2 more answers
Are engineers who help to develop products and projects by creating technical drawings
Alinara [238K]

Answer:

This is true but an Engineer is much more than that. They are the professionals of engineering, who do the invention, analyze, design and test complex systems, machines, structures, machines for fulfilling the functional objectives gadgets as well as the requirements while taking into consideration the limitations that come up due to practicality, safety, regulations, and cost.

Explanation:

Please check the answer section.

8 0
3 years ago
What are impacts of ict in every day your life?describe if prifely​
telo118 [61]

Answer:

ICT is a broad subject and a concept of evolving.It covers any product that will store, retrieve, manipulate, transmit, or receive information electronically in a digital form.

Explanation:

HOW WE USE ICT IN OUR DAILY LIFE

COMMUNICATION

JOB OPPORTUNITIES

EDUCATION

SOCIALIZING

POSITIVE IMPACT OF ICT IN OUR DAILY LIFE

1.Easy to access information:

I use ICT to access more information that I need for everyday schooling.Because Internet has more faster than searching to a school library. Even the deadline of my research is coming, I can make it fast with the help of ICT

2. Education: distance learning and on-line tutorials. New ways of learning, e.g. interactive multi-media and virtual reality.

3.Free access of sharing like photo,video,and message

5 0
2 years ago
What protocol suite below is the most commonly used protocol for local area network (lan) communication?
grandymaker [24]
Answer TCP/IP is the most common protocol in Local Area Networks.
3 0
3 years ago
What is the proper way to name the range of cells located in colum A row 3 through colum C row 7?
LenKa [72]

Answer:

it is C

Explanation:

6 0
3 years ago
Read 2 more answers
Other questions:
  • Please help i really need to turn this in already
    6·1 answer
  • The version of Windows that first provided networking capabilities was _____.
    12·2 answers
  • The purchase of one cup of coffee a day what's going to do
    15·2 answers
  • ​User documentation _____. Group of answer choices ​allows users to prepare overall documentation, such as process descriptions
    9·1 answer
  • Which term describes an event where a person who does not have the required clearance or access caveats comes into possession of
    15·2 answers
  • You can't get close enough to the facility interior to launch an evil twin attack against its wireless clients; in fact, you hav
    11·1 answer
  • Which line of code will eliminate the element “calculator” from an array of supplies?
    13·1 answer
  • Write a Python3 program to check if 3 user entered points on the coordinate plane creates a triangle or not. Your program needs
    12·1 answer
  • [If you were the queen of the world .... What would you change ?]
    14·1 answer
  • Can a dod activity enter into a service contract for a military flight simulator without getting a waiver from the secretary of
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!