Write an java graphics
Another example that combined composition and inheritance inside one program is the Choo-Choo Train program (picture attached of what it's supposed to look like)
This program starts with a Chassis, which is the base that supports a car, a truck or a railroad car, called RailCar for short. The RailCar in the drawing is very plain, but it shows that it has-a_Chassis. Add large doors to the rectangular Railcar and now you have a Freightcar, which _is-a_RailCar. You can also add a special roof, put in windows and a PassengerCar is created that _is-a RailCar. In the real world, a locomotive is very different from other railcars, but not in the toy-style Choo-Choo Train below. You can add a funnel and a scoop to the RailCar and you now have a LocomotiveCar, which is-a RailCar. Finally, at the end comes the CabooseCar, which requires some windows and a cupula and yes the CabooseCar also is-a RailCar.
This program requires at least two examples of inheritance and three examples of composition.
A good example is the Train class. This is a more advanced program, which does require parameter passing for both inheritance and composition.
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps
- what are the positives and negatives of the two designs attached. The Java code next to each design shows an example of how the constructors are implemented in the subclasses. Constructor code for the other two other subclasses is same as the Bipedal constructor in each design (except the number of legs value). designs attachedarrow_forwardMake C#(Sharp) with visual studio: Make a class and list of books with the following data: { ISBN="1234-45-34-3939", Title = "The Long Road", Publisher="New York", Price=25.00, Copyright=2016 }, { ISBN="988-65-34-9012", Title = "The Warrior", Publisher="McGraw", Price=55.00, Copyright=2013 }, { ISBN="8712-45-84-2539", Title = "Yesterday", Publisher="New York", Price=67.00, Copyright=2016 }, { ISBN="1234-78-99-3478", Title = "Programming Essentials", Publisher="Dalton", Price=35.00, Copyright=2015 }, { ISBN="8356-89-33-3251", Title = "Hello World", Publisher="Chicago Press", Price=115.00, Copyright=2016 }, Using LINQ Query or LINQ Method to perform and display results for the following: 1. Display ISBN, Title, Publisher for all books where Publisher is New York. 2. Display all fields for all books in descending order by Copyright 3. Display all fields for all books in descending order by Copyright Where Publisher is New York 4. Display ISBN, Title for all books with copyright greater…arrow_forwardWhat is the best way to go about this whole code with the given instructions?arrow_forward
- Why does the Number Class from this slide need to be abstract?arrow_forwardJAVA:arrow_forwardUse java programming properties to write all the necessary classes and/or interfaces for a solution to the problem. Focus on class structure and interaction. You may implement your solution however you wish, but you will be graded on the appropriateness of your solution to the requirements. Note the use of capitalization and parentheses for clarification. You may use whatever constructors or additional methods you wish. Define a structure that can represent Animals. Animals have two behaviors; they can speak() and they can move(). By default, when an animal moves, the text ”This animal moves forward” is displayed. By default, when an animal speaks, the text ”This animal speaks” is displayed. A general Animal should not be able to be instantiated. Define two classes, Goose and Lynx, that are Animals. Both Goose and Lynx behave such that where “Animals” is displayed in speak() or move(), “goose” or “lynx” is displayed by the appropriate classes. Finally, any instance of Goose can fly(),…arrow_forward
- Java programarrow_forwardjava programmingarrow_forwardImplement the following in the .NET Console App. Write the Bus class. A Bus has a length, a color, and a number of wheels. a. Implement data fields using auto-implemented Properies b. Include 3 constructors: default, the one that receives the Bus length, color and a number of wheels as input (utilize the Properties) and the Constructor that takes the Bus number (an integer) as input.arrow_forward
- Using the class diagram in the image below, write a small report (200- 300 words) on how to create customer, car, and parking lot classes for an object-oriented parking system using java.arrow_forwardIn the class diagram below we have a money class for an object-oriented parking system that is to be designed using java. Briefly explain any implementation decisions and the reasoning behind those without writing the complete code. N.B explain how the implementation will proceed instead of writing codearrow_forwardRo-Sham-Bo. Believe it or not, the classic game of Rock-PaperScissors has many other names. One of them is Ro-Sham-Bo. For this assignment, “Ro” will represent “Rock”, “Sham” will represent Paper, and “Bo” will represent Scissors. You will create a RoshamboPlayer class. It will have three attributes: PlayerName: String RoLimit: int ShamBoLimit: int It will also have an overloaded constructor that sets those three values. It will have two functions: playRound that takes in a string and returns a boolean value, and getName that takes in nothing and returns the PlayerName string. In your driver class for this assignment, you will create two RoshamboPlayer objects with the following values: p1: RoLimit == 30, ShamBoLimit == 60 p2: RoLimit = 40, ShamBoLimit = 85 You may name them whatever you like. You will prompt the user to choose one of these two to play against. Then you will create a loop that prompt the user to either play a round of Roshambo, or quit the game. If the user chooses…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education