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
Question
(The Triangle class) Design a class named Triangle that extends GeomericObject. The class contains:
- Three double data fields named side1, side2, and side with default values 1.0 to denote three sides of the triangle.
- A no-arg constructor that creates a default triangle.
- A constructor that creates a triangle with the specific side1, side2, and side3.
- The accessor method for the three data fields.
- A method named getArea() that returns the area of this triangle.
- A method named getPerimeter() that returns the perimeter of this triangle.
- A method named toString() that returns a string description for the triangle.
Note:- Please write a java code and also need an output for this program. (Also, let me know with what name file should be saved to get output)
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 6 steps with 4 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
- 1) Through BlueJ, the class must define a method called isSpace that allows the book club staff to determine whether there is enough capacity for a group to attend. This method must take a single integer parameter representing the size of the group, and return a boolean result. The method must work as follows: If the value of the parameter is less-than or equal-to 0 then the method must return false. This case has priority over those following. If the value of the parameter is less-than or equal-to the space left in the book club (use the capacity and occupancy values in the to work this out) then the method must return true. Otherwise (i.e., if there is not space in the book club for the whole group) then the method must return false. 2) This method must not change the state of the BookClub object. In other words, both the current number of occupants and the capacity of the club must be exactly the same after it is called as it was before (Note that the return type of this method…arrow_forwardState whether it is true or false and why .arrow_forwardRewrite the calculator program using a class called calculator. Your program will keep asking the user if they want to perform more calculations or quit and will have a function displayMenu to display the different functions e.g .(1 - addition, 2- subtraction, 3- multiplication, 4- division) Your program must have appropriate constructors and member functions to initialize, access, and manipulate the data members as well as : A member function to perform the addition and return the result A member function to perform the subtraction and return the result A member function to perform the multiplication and return the result A member function to perform the division and return the resultarrow_forward
- Question: Submit document with methods for your automobile class, and pseudo code indicating functionality of each method. Example: public String RemoveVehicle(String autoMake, String autoModel, String autoColor, int autoYear) If values entered match values stored in private variables remove vehicle information else return message indicating mismatch Assignment details/background Create an automobile class that will be used by a dealership as a vehicle inventory program. The following attributes should be present in your automobile class: private string makeprivate string modelprivate string colorprivate int yearprivate int mileage Your program should have appropriate methods such as: default constructorparameterized constructoradd a new vehicle methodlist vehicle information (return string array)remove a vehicle methodupdate vehicle attributes method. All methods should include try..catch constructs. Except as noted all methods should return a…arrow_forwardQ3: Define a class named Car that has the following specifications:Two attributes:plateNumber: to keep car’s plate number as String value. speed: to keep car’s current speed as integer value.Seven methods:Car( String pn , int s), a constructor method used to initialize the instantiated objects. setPlateNumber( String pn), act as a set method for the attribute plateNumber. setSpeed( int s), act as the set method for the attribute speed.getPlateNumber(), act as the get method for the attribute plateNumber.getSpeed(), act as the get method for the attribute speed.fines (), returns the amount of traffic fine (500 SR) if car’s speed exceeds 120 k/h, otherwise 0. main(...), act as the main method for the program, and it should do the following:1. Instantiate three objects, namely car1, car2, and car3, using the populated constructor.2. Change the speed value of the first car (car1) to 130.3. Change the plate number of the second car (car2) to “Java123”.4. Print the following statement,The…arrow_forwardIn python and include doctring: First, write a class named Movie that has four data members: title, genre, director, and year. It should have: an init method that takes as arguments the title, genre, director, and year (in that order) and assigns them to the data members. The year is an integer and the others are strings. get methods for each of the data members (get_title, get_genre, get_director, and get_year). Next write a class named StreamingService that has two data members: name and catalog. the catalog is a dictionary of Movies, with the titles as the keys and the Movie objects as the corresponding values (you can assume there aren't any Movies with the same title). The StreamingService class should have: an init method that takes the name as an argument, and assigns it to the name data member. The catalog data member should be initialized to an empty dictionary. get methods for each of the data members (get_name and get_catalog). a method named add_movie that takes a Movie…arrow_forward
- !! E! 4 2 You are in process of writing a class definition for the class Book. It has three data attributes: book title, book author, and book publisher. The data attributes should be private. In Python, write an initializer method that will be part of your class definition. The attributes will be initialized with parameters that are passed to the method from the main program. Note: You do not need to write the entire class definition, only the initializer method lili lilıarrow_forwardanswer the following: all questions 1, 2 and 3 attached below;arrow_forward1) Do you think it is possible to create another constructor with the same set of parameters? For example, adding the following constructor to Volunteer. Place a check (✓) beside your answer.Volunteer(): name_("Default"), branch_("CSU Long Beach") { } Yes, because you can overload constructors much like how you overload member functions. No, because the program will not know which constructor to use. No, because the body of the constructor is empty. 2) Much like constructors, member functions can also be overloaded. Write the name of Volunteer's overloaded member function. Take note that member function overloads need to have the same return type. 3) How do you think the compiler knows which member function overload it should call? Place a check (✓) beside your answer. It checks the name of the member function that was called. It compares the number of arguments and their data types with the member function's parameters. It always calls the overload with the least number of…arrow_forward
arrow_back_ios
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