Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
we are going to create a new subclass of the SimpleGeometricObject class, named
Triangle. Copy the source code of the SimpleGeometricObject class from the following link:
Triangle. Copy the source code of the SimpleGeometricObject class from the following link:
https://liveexample.pearsoncmg.com/html/SimpleGeometricObject.html
TASK 1: Create a Triangle class that extends the SimpleGeometricObject class in Eclipse, following
the below UML diagram.
the below UML diagram.
Use the following formula to calculate the area of a triangle:
A = 1/2 × base × height
TASK 2: Create a TestTriangle class in an individual .java file. In the main method,
(1) Create a Triangle object with default base and height values.
(2) Create a Triangle object with specified base = 3 and height =4.
(1) Create a Triangle object with default base and height values.
(2) Create a Triangle object with specified base = 3 and height =4.
TASK 3: Add a toString() method to the Triangle class. In this toString() method,
(1) Print the base, height, and area of a Triangle object.
(2) Call the toString() method of the superclass using the super key word.
Then, in the main method of the TestTriangle class, make the two Triangle objects that you
created in Task 2 call the toString() method of the Triangle class. Ensure it runs without errors.
show your console output.
(1) Print the base, height, and area of a Triangle object.
(2) Call the toString() method of the superclass using the super key word.
Then, in the main method of the TestTriangle class, make the two Triangle objects that you
created in Task 2 call the toString() method of the Triangle class. Ensure it runs without errors.
show your console output.
TASK 4: Let’s test the method overriding.
1. Add a void testOverriding() method to the SimpleGeometricObject class. Make it print
“This is the testOverriding() method of the SimpleGeometricObject class”.
2. In the main method of the TestTriangle class, make the two Triangle objects that you
created in Task 2 call the testOverriding () method.
Ensure it runs without errors. show your console output.
3. Override the testOverriding() method in the Triangle class. Make it print “This is the
overridden testOverriding() method”.
1. Add a void testOverriding() method to the SimpleGeometricObject class. Make it print
“This is the testOverriding() method of the SimpleGeometricObject class”.
2. In the main method of the TestTriangle class, make the two Triangle objects that you
created in Task 2 call the testOverriding () method.
Ensure it runs without errors. show your console output.
3. Override the testOverriding() method in the Triangle class. Make it print “This is the
overridden testOverriding() method”.
4. In the main method of the TestTriangle class, make the two Triangle objects that you
created in Task 2 call the testOverriding () method.
Ensure it runs without errors.
Ensure it runs without errors.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 3 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- One-page test plan Fill up the following template word document attached in the image, in order to make a one-page test plan for our parking management system. Use the class diagram as a reference. The template gives you an idea of what a test plan should contain.arrow_forwardCreate a new project named lab10. You will be implementing two classes: A SolarSystem class, and a Planet class. The SolarSystem contains Planet objects stored in a vector. A UML diagram for the Solar System and Planet classes The first part you should implement is the Planet class. Don't add the SolarSystem files to the project at the beginning, just work on the Planet class. Test the different overloaded operators as we did during lecture for your Planet class, and then move on to the SolarSystem class. The SolarSystem default constructor should resize the vector to zero. The default constructor values for Planet can be whatever you’d like, but make the mass a very small number, so later on when you're looking for the largest planet, it doesn't use the default Planet value. The addPlanets() method will take a number as an argument for the number of Planets that will be in your SolarSystem. So if you call addPlanets with 5 as an argument, there will be 5 Planets to add to the…arrow_forwardOverride the testOverriding() method in the Triangle class. Make it print “This is theoverridden testOverriding() method”. (add it to triangle class don't make a new code based on testOverriding in SimpleGeometricObject class.) (this was the step before this one) Add a void testOverriding() method to the SimpleGeometricObject class. Make it print“This is the testOverriding() method of the SimpleGeometricObject class”arrow_forward
- This is for the game brick breaker use Java to code what's posted down below.arrow_forwardThere needed to fix something in the above solution. Please repost the solution with these changes. Thank you!! Use Bootstrap classes to make a circular image with a border around the image only.arrow_forwardjava please dont take other website'answer. rthis is actually practice question ANIMALCLASS Create an Animal class. Each animal has a name, an x and y integer coordinate. The Animal class should have at minimum the following methodsbelowbut you may want to add more if necessary: Also note, everyanimal will need to have to have “z”passed to it so that it knows how big the map is. •A constructor that starts the animal at 0,0 with a name of "Unknown Animal"and only accepts a single int value (int mapSize). •A parameter constructor that allows the programmerto input all 4pieces of information.(x,y, name, mapSize)oCheck the parameters for valid input based on the constraints. Ifany of the input valuesis invalid, adjust it any way you deem necessary in order to make it valid. •getX()and getY() •getName() •toString(). o This should print out the name and coordinates of the animal. •touching(Animal x) This method should determine if the animal is on the same spot as a secondanimal(x). It…arrow_forward
- Class definitions for DateTimerPicker and MonthCalender are provided below.arrow_forwardUsing JavaFX with Eclipse or Netbeans, please explain using a main class, controller class, and a FXML... Devise a JavaFX GUI with an internal controller class to maintain an array of arbitrary size. Use a starting default of size 20 and populate it with random data (numbers) initialized into the array. The GUI should be such that users can select and perform the actions listed below. Write methods and select appropriate GUI mechanisms to do the following: 1. Display the contents of the array2. Add a, or a group of numbers to the array at any position.3. Delete a number from the array at any position.4. Sort the array and display the original and sorted forms.5. Display the size of the array.6. Search for a number and its occurrences in the array and flag that number’s position(s) by highlighting it in the display.arrow_forwardFix any error in this code import org.jfree.chart.ChartFactory;import org.jfree.chart.ChartPanel;import org.jfree.chart.JFreeChart;import org.jfree.data.category.DefaultCategoryDataset;import org.jfree.ui.ApplicationFrame;import org.jfree.ui.RefineryUtilities;public class BarChartExample extends ApplicationFrame {public BarChartExample(String title) {super(title);Object ChartFactory;JFreeChart barChart = ChartFactory.createBarChart("Referral Sources Count","Referral Source","Count",createDataset(),org.jfree.chart.plot.PlotOrientation.VERTICAL,true, true, false);ChartPanel chartPanel = new ChartPanel(barChart);chartPanel.setPreferredSize(new java.awt.Dimension(560, 367));setContentPane(chartPanel);}private DefaultCategoryDataset createDataset() {DefaultCategoryDataset dataset = new DefaultCategoryDataset();String series1 = "Referral Sources";dataset.addValue(250, series1, "Website");dataset.addValue(400, series1, "Word of Mouth");dataset.addValue(300, series1,…arrow_forward
- Assume the base package for an Eclipse project is edu.westga.cs1301.drinks and that you are writing tests for the dispense method of a DrinkMachine class. Use this information to answer the following questionWhat should you name your test class?arrow_forwardThis project utilizes three new classes: · Word - an immutable class representing a word · Words - a class representing a list of Word objects · WordTester - a class used to test the Word and Words classes. WordTester (the application) is complete and only requires uncommenting to test the Word and Words classes as they are completed. The needed imports, class headings, method headings, and block comments are provided for the remaining classes. Javadocs are also provided for the Word and Words classes. Word The Word class represents a single word. It is immutable. You have been provided a skeleton for this class. Complete the Word class using the block comments, Javadocs, and the following instructions. 1. Add a String instance variable named word which will contain the word. 2. Complete the one parameter constructor to initialize the word instance variable. 3. Complete the getLength method to return the number of characters in the…arrow_forwardCurrently, there are two draw rectangle methods in the DoodleController class. Since two different turtles need to draw a rectangle, create a draw rectangle method in the DoodleTurtle class that will take the width and height of the rectangle as parameters and draw a rectangle of the specified size. The size will be the number of steps by the turtle. With the new method introduced, the calls to drawRectangleWithLittleTurtle and drawRectangleWithBigTurtle can be replaced with a call to the turtle’s drawRectangle method passing in the desired size of the rectangle. Refactor the DoodleController accordingly. Note: When you are done with the refactoring the drawRectangleWithLittleTurtle and drawRectangleWithBigTurtle method in the DoodleController need to be deleted. After this refactoring, do not move on until you verify the program works as it did before.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- 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
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education