Monday, March 30, 2020
Association in Java Definition and Examples
Association in Java Definition and Examples The association relationship indicates that a class knows about, and holds a reference to, another class. Associations can be described as a has-a relationship because the typical implementation in Java is through the use of an instance field. The relationship can be bi-directional with each class holding a reference to the other. Aggregation and composition are types of association relationships. Associations join one or more of one thing against one or more of another thing. A professor might be associated with a college course (a one-to-one relationship) but also with each student in her class (a one-to-many relationship). The students in one section might be associated with the students in another section of the same course (a many-to-many relationship) while all the sections of the course relate to a single course (a many-to-one relationship). Association Example Imagine a simple war game with an AntiAircraftGun class and a Bomber class. Both classes need to be aware of each other because they are designed to destroy each other: public class AntiAirCraftGun { Ã Ã private Bomber target; Ã Ã private int positionX; Ã Ã private int positionY; Ã Ã private int damage; Ã Ã public void setTarget(Bomber newTarget) Ã Ã { Ã Ã Ã Ã this.target newTarget; Ã Ã } Ã Ã //rest of AntiAircraftGun class } public class Bomber { Ã Ã private AntiAirCraftGun target; Ã Ã private int positionX; Ã Ã private int positionY; Ã Ã private int damage; Ã Ã public void setTarget(AntiAirCraftGun newTarget) Ã Ã { Ã Ã Ã Ã this.target newTarget; Ã Ã } Ã Ã //rest of Bomber class } The AntiAirCraftGun class has-a Bomber object and the Bomber class has-a AntiAirCraftGun object.
Saturday, March 7, 2020
Definition of Meteor Shower
Definition of Meteor Shower How does a meteor shower occur? The Solar system is made up of the Sun and the nine Planets which revolve around the Sun. The moon, asteroids, comets, dust and sun are other component of the Solar System. The sun attracts all the other objects towards it due to its high gravitational force. A meteor shower takes place when the earth collides with particles as it moves around the sun.Advertising We will write a custom essay sample on Definition of Meteor Shower specifically for you for only $16.05 $11/page Learn More These are dust and ice particles found in the solar system which remained from comets which occurred long time ago. The components of a comet include sand, ice and gravel particles. When a comet passes near the sun, its surface heats up. This leads to the release of some particles as well as evaporation of ice. A comet has two tails, one made of dust and the other one gas (Seeds and Backman 2). As the earth rotates around the sun, it comes into c ontact with these dirty particles. When the earth crosses the remains of a comet, there is usually a friction between the air and these particles which makes them to heat up and then a glow is observed. Normally, a meteor is observes as a bright stretch of light in the sky. A meteor can be observed during any night of the year. The duration of time taken by a meteor shower varies. A meteor shower can take a minute, day or even several days. The duration of time is determined by the width of the dust trail. Wide dust trails take more time than narrow ones. Sunlight and solar wind particles composed of hot ions which move at a high speed blow away dust particles from the orbit of the Comet. The distance depends on the size of the particle. Small particles are moved far away from the Comet Orbit. When the dust trail is broadened, it takes the earth along time before it can cross it (Seeds and Backman 12). Why are the times of a meteor shower predictable? The occurrence of a meteor show er is predictable. People are aware of the specific time around which they occur. The Earth takes the same path each year as it rotates around the sun. Since the sun follows the same path, it passes through the same trail of debris at a particular time of the year. Meteor showers take place during this particular time. This has made it easy for people to determine when a meteor shower is likely to happen and at what time of the day. Many meteor showers take place throughout the year (Seeds and Backman 22).Advertising Looking for essay on astronomy? Let's see if we can help you! Get your first paper with 15% OFF Learn More What is the probability of a meteor shower becoming a meteorite? When a meteor shower passes through the earthââ¬â¢s atmosphere and strikes the ground, it becomes a meteorite. It has been observed that most of the meteorites are rocks. Most of the meteor showers completely get burned on the atmosphere before reaching the surface of earth. This is because they are usually small particles which are consumed within a short period of time. Scientific research has indicated that there is no evidence of a meteor shower which has ever reached the surface of earth. This is evidence that comet dust is made up of very small particles. Based on the above information, it is true to say that a meteor shower is not a probable source of a meteorite. This is because rarely do meteor showers hit the ground (Seeds and Backman 32). Work Cited Seeds, Michael and Backman, Dana. Perspectives on Astronomy. New York: Cengage Learning, 2007.Print.
Subscribe to:
Posts (Atom)