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
In which of the following situations may you pass on the right
Natasha2012 [34]
In driving your vehicle, it is best to pass on the right after you slow your vehicle down and check for the road whether there is an upcoming vehicle or not. When the road is clear, it is best and safe to pass on the right after making sure that the coast is clear.
3 0
3 years ago
Read 2 more answers
Should spreadsheets be used to keep an address list for holiday cards?<br> YES<br> ONO<br> Hurry pls
kodGreya [7K]

Answer:

No

because spreadsheet is used for calculation not for writing address

5 0
2 years ago
Myra just got the latest computer game and wants to play it on her desktop. When she plays the game, she notices that it is slug
diamong [38]

Answer:

Ram/cpu/gpu... Many many things she can do

Explanation:

It may be a issue of internet bandwith, if this new game requires a insane ammount of internet then it may run low FPS (frames per second) and make myra's game look slughish,but anouther issue may be the ram or cpu, like if this is a new game and you've always played like simple games, so your running on persay a core i3 or i4, it aint gonna cut it on a newer game, you gonna need a probably core i5 or i7, or be like any sane person and switch to amd, it may be a bit pricy but if you want nice clean gaming, then amd is the way to go

Also while you are at it get a ssd

I hope this helps "-"

8 0
2 years ago
Read 2 more answers
¿Cuál es la potencia de una lámpara de incandescencia que se conecta a la red de 220 V, sabiendo que tiene una resistencia de 50
Juliette [100K]

Answer:

  • <u>1,000W</u> (rounded to one significant figure)

Explanation:

I will answer in English.

The question is:

  • <em>What is the power of a filament lamp that connects to the 220 V network, knowing that it has a resistance of 50 ohms?</em>

<em />

<h2>Solution</h2>

<em />

<em>Power</em>, <em>voltage</em>, <em>resistance</em>, and current, are related by either of the following equations:

  • P = V × I
  • P = R × I²
  • P = V² / R

Where:

  • P is power in watts (W)
  • R is resistance in ohms (Ω)
  • V is voltage in volts (V), and
  • I is current in amperes (A)

Since you know the voltage (<em>220V</em>) and the resistance (<em>50Ω</em>), you can use the last equation:

  • P = V² / R
  • P = (220v)² / (50Ω)
  • P = 968 W

Since the magnitude 50Ω has one significant figure, your answer should be rounded to one significant figure. That is <u>1,000W.</u>

7 0
3 years ago
You received an email from someone who claims to be a representative from your school. The email asked you to click on a link to
Sergeeva-Olga [200]

Answer:

Phishing

Explanation:

Phishing = Link to a site, usually a fake replica of a legitimate site but with added implements that can be used to spy on you (how people become victims of identity theft

6 0
3 years ago
Other questions:
  • Which of the following formats can algorithms NOT be written in:
    13·1 answer
  • If you specify a user without specifying a hostname, mysql will
    13·1 answer
  • Create a list with 5 numbers and find the smallest and largest number in the list and also the sum and product of the numbers in
    9·1 answer
  • Maya is preparing a presentation for her science class on how solar panels produce energy. Why would a
    11·2 answers
  • La sentencia de ASIGNAR es una sentencia de entrada de datos, verdadero o falso ?
    8·1 answer
  • Please help ASAP!
    7·2 answers
  • I need help with the code practice 9.2 Edhesive.<br><br> Thank you
    12·2 answers
  • Olivia wants to change some settings in Outlook. What are the steps she will use to get to that function? open Outlook → File →
    7·2 answers
  • In which program structure does the processor verify the mentioned condition only after executing the dependent statements once?
    8·2 answers
  • Implement one array of the English alphabet (26 characters). a) Create a function, getLetters() to cast and generate the array.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!