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
Create a class called Holiday to represent a holiday. An object of class Holiday represents a holiday during the year. This class has three instance variables:
name(String), which is representing the name of the holiday.
day(int), which is representing the day of the month of the holiday.
month(String), which is representing the month the holiday is in.
Write a constructor for the class Holiday, which takes a string representing the name, an int representing the day, and a string representing the name of the month as its arguments, and sets the class variables to these values.
2.Provide 3 get methods and 3 set methods for the class attribute.
3.Write a method called Display that prints the following message on the screen:
For example: The holiday is National Day and it is on December, 16
4.Write a method that compares between two objects H1 and H2 if the two holidays are in the same month or not. The method should return True if the two holidays are in the same month, otherwise, it returns False.
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 3 steps
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
- in the date classOverload the constructor method as the class diagram showsIn the main program, create three objects of class date, one from each of the constructors.In the main program, overload the showdate method to display the date in the following formatsThe date in dd/mm/yy formatThe date in dd/mm formatThe date in “d of month” formatIn the main program, make use of each of the showdate methods, one with each of the created objects.Send your two files, the date file and the main program where you use the date constructor overload and the showdate method overload.arrow_forwardThe non-static class level variables and non-static methods of a class are known as a. instance members b. object behaviors c. object attributes O d. object referencesarrow_forwardjavacoding please thank you!arrow_forward
- A Door Class A computer game usually has many different objects that can be seen and manipulated. One typical object is a door. Whether a player runs through a castle, attacks the forces of an evil empire, or places furniture in a room, a door often comes into play. Implement a Door class as described below as well as a TestDoor class that instantiates three Door objects labeled “Enter,” “Exit,” and “Treasure.” The “Enter” door should be left unlocked and opened. The “Exit” door should be left closed and locked. The “Treasure” door should be left open but locked. A Door class A Door object can • display an inscription, • be either open or closed, and • be either locked or unlocked. Here are some rules about how Door’s work. • Once the writing on a Door is set, it cannot be changed. • You may open a Door if and only if it is unlocked and closed. • You may close a Door if and only if it is open. • You may lock a Door if and only if it is unlocked, and unlock a Door if…arrow_forwardThe Essay class has a default constructor, a constructor with two parameters, and a constructor with three parameters. Declare the following objects: essay1 with no arguments essay2 with essayTitle and essayAuthor as arguments essay3 with essayTitle, essayAuthor, and essayYear as arguments Ex: If the input is Painting Cole 1919, then the output is: Essay: Undefined, Unspecified, 0 Essay: Painting, Cole, 0 Essay: Painting, Cole, 1919 Archive.java public class Archive { publicstaticvoidmain(String[] args) { Scannerscnr=newScanner(System.in); StringessayTitle; StringessayAuthor; intessayYear; essayTitle=scnr.next(); essayAuthor=scnr.next(); essayYear=scnr.nextInt(); /* Your code goes here */ essay1.print(); essay2.print(); essay3.print(); } } Essay.java public class Essay { private String title; private String author; private int year; public Essay() { // Default constructor title = "Undefined"; author = "Unspecified"; year = 0; }…arrow_forwardDefine the Artist class in Artist.py with a constructor to initialize an artist's information. The constructor should by default initialize the artist's name to "None" and the years of birth and death to 0. Define the Artwork class in Artwork.py with a constructor to initialize an artwork's information. The constructor should by default initialize the title to "None", the year created to 0, and the artist to use the Artist default constructor parameter values. Add an import statement to import the Artist class. Add import statements to main.py to import the Artist and Artwork classes. Ex: If the input is: Pablo Picasso 1881 1973 Three Musicians 1921 the output is: Artist: Pablo Picasso (1881-1973) Title: Three Musicians, 1921 If the input is: Brice Marden 1938 -1 Distant Muses 2000 the output is: Artist: Brice Marden, born 1938 Title: Distant Muses, 2000 Code: def __init__(self,aname = "None",abirth = 0,adeath = 0): self.aname = aname self.abirth_year = abirth self.adeath_year =…arrow_forward
- 1. Design a new Triangle class that extends the abstract GeometricObject class. Write a test program that prompts the user to enter three sides of the triangle, a color, and a Boolean value to indicate whether the triangle is filled. The program should create a Triangle object with these sides and set the color and filled properties using the input. The program should display the area, perimeter, color, and true or false to indicate whether it is filled or not.arrow_forwardDesign a class named octopus that holds attributes for an octopus named weight and color. Include methods to set and get each of these attributes. Create the class diagram and write the class pseudocode that defines the class. Create a small program that declares two octopus objects and set the octopus's name weight and color attributes the program must also output each octopus's name weight and color after they are set. Please write out the pseudocode. I have a hard time with this.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