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 short program in Java which contains the below information:
- Has one abstract and two regular classes
- Has two interfaces (the two regular classes have to implement at least one interface
- At least one regular class must implement both interfaces
- The two classes have to extend the abstract class
- The abstract class must have a method
- At least one interface must have a method
- At least two fields in each class, this includes the superclass
- All fields are instantiated within the constructor
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 6 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
- 1. Design a Java JFood class for a food which implements both cloneable and comparable interfaces The class should have the following private member variables: mId: an integer that holds the food ID mName: a string that holds the food name mQuantity: an integer that holds quantity of servings of food mCalory: a double that holds calory of one serving of food mIngredients: an array of String that holds the names of all ingredients and its size is three and the class should have the following public member functions: default constructor: initializes the product to some default one constructor #2: accepts id, name, quantity, calory and ingredients as arguments. The method should set these values to the appropriate instance variables setFood: accepts quantity, calory and ingredients as arguments. The method should set the arguments to the appropriate instance variables. Please note ingredients need be set as deep copy. Five respective get functions to retrieve the five instance…arrow_forwardJAVA CODE Write a java set of classes that could be used to do simple calculations on geometricobjects. The set should include the following classes: a) Shapes ,containing abstract methods( a methods that is declared without animplementation) area and perimeter b) Rectangle, a subclass of Shape, containing a constructor (with parameters forlength and width) along with methods area and perimeter. c) Triangle, a subclass of Shape, containing a constructor (with parameters for the three sides of a triangle) along with methods area ( s = (a+b+c)/2, A = sqrt( s(s-a)(s-b)(s-c) ) ) and perimeter d) Square, a subclass of Rectangle, containing a constructor (with a parameter for thelength of a side) and methods that invoke the methods of the Rectangle class todetermine the perimeter and area of a square.arrow_forwardObject-Oriented Programming (Please do not use AI) Create a Java program that has the following: Inheritance - Create a superclass and one or more subclasses that inherit properties and methods from the superclass. Polymorphism - Show polymorphism by using method overriding and method overloading. Provide an example of runtime polymorphism by creating objects of the subclasses and calling overridden methods. Encapsulation - Demonstrate the concept of encapsulation by applying access modifiers (private, protected, public) appropriately in your program. Abstraction - Utilize abstract classes and methods in your program to illustrate abstraction. Show examples of the following words: super, this, static, finalarrow_forward
- Interfaces are used to define stronger is-a relationships because one class can inherit multiple interfaces. Ture or falsearrow_forwardQUESTION 5 All methods in an abstract class must also be declared abstract. True False QUESTION 6 All fields declared in an interface are treated as final and static have protected access must be initialized in the class implementing the interface have private accessarrow_forwardQUESTION 16 What must be true of a class with one abstract method? O The class must also implement the Iterable interface Any derived class must implement the method The abstract method must have the static modifier O The method cannot specify a return value QUESTION 17 Suppose we wanted to design a set of classes for a veterinarian's office. Our Customer class looks like this: public class Customer { Pet [] pets; } Select all the statements that are true Once the size of the pets array has been set, it cannot be changed Because we're using an array, all pets must be the same A customer must have at least one pet We also need to declare a Pet class QUESTION 18 What is the proper use of an enumeration? To define a set of ordered values To enforce the use of the Comparable interface O To define, or enumerate, the values returned by a Random object generator O To define the classes in an inheritance hierarchyarrow_forward
- Draw the following Class Structure as a (class digram): 1. NotificationSystem: This is the main class that manages the notification system. It has the following attributes and methods: - Attributes: - users: a list of User objects representing all the users registered in the system - tweets: a list of Tweet objects representing all the tweets posted in the system - Methods: - register_user(user): adds a new user to the system - post_tweet(user, message): posts a new tweet on behalf of a user - get_timeline(user): returns a list of tweets from all users that the specified user follows - get_mentions(user): returns a list of tweets that mention the specified user 2. User: This class represents a user in the system. It has the following attributes and methods: - Attributes: - username: a string representing the username of the user - followers: a list of User objects representing all users who follow this user - following: a list of User objects representing all…arrow_forwardWhen should one use an abstract class, when should one use an interface, and when should one use both?arrow_forwardWrite a java This class must implement the model in the following UML class diagram. Account -balance: double +Account(init_balance : double) +getBalance( ): double +deposit(amount : double) Diagram object’s description: balance holds the current balance of the bank account Account sets balance to init_balance get balance retrieves the current balance deposit adds the amount parameter to the current balance (Hint: “-“ indicates private and “+“ indicates public)arrow_forward
- Create a Java program demostrating the following aspects of OOP: You must create an UML. class diagram for all the classes and interfaces in the program. Use Java interface and method overriding appropriately. Inheritance/Interface and polymorphism. Your program the base class of interface should be used as the variable/parameter type to demostrate polymorphism. Overloading using either methods or constructors. Appropriate use of this keyword. Correct use of access modifiers (public, private) in an appropriate way. Correct use of static variable and instance variable. Passing object as parameter to a method. Caling method from another method of the same class. Creating user defined classes with Encapsulation principle consideration. You are free to pick any topic/system to accomodate the above points but please keep it simple. The application does not have to be real world application meaning you can use an imaginary system for the mentioned points. Neverthless, you should be aware…arrow_forwardQuestion: Mr. Hamza is working as an accountant in the Octal Company. He wants to calculate salary of his company employees. Develop a java program to calculate salary using the concept of abstract based on the following instructions. Save the project/file as AccountantYourID. A) Abstract Class name: YourFirstName_Octal Abstract Member Method: – to calculate and return salary salary() B) Class name: Employee extends YourFirstName_Octal Member variables: wage, noOfDays, bonus Member Method : – parameterized constructor to initialize member variables – to calculate and return salary salary = (wage3 * noOfDays) / 4 + bonus C) Controlling class : – To create an object of Employee – To print salary of the Employee – To print bonus of Employeearrow_forwardJava Programming Following the specifications given in the following detailed UML diagram, develop or modify all required classes: Design the Payroll interface, having the following two methods: calculateMonthlyGrossPay(): double displayPayInfo(): void - displays the information of the employee, followed by the information about the pay for a month Modify Person.java to show that it implements Payroll interface - you will not implement the interface methods here, which will change the type of class Person is; Modify Student, Employee, and Faculty to express the fact that they inherit behavior from Person that includes Payroll. You do not implement any of the methods from the Payroll interface in any of these classes. Design Graduate class as a subclass of Student. This class inherits the attributes and behavior of Student. The class has an additional attribute: department: String - the department student is registered in. Create the accessor and mutator methods for a new…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