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
thumb_up100%
The following is a true statement about classes in object-oriented program design:
"If a class C1 has an instance variable whose type is another class, C2. This means C1 has-a C2."
Please explain or provide an example (preferred language is Java) of why this is right. Does it mean something like:
public class BankArray{private BankAccount; } then BankArray has-a BankAccount?
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 3 steps with 2 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
- What is the best reason to make a method be a static method? A. When the method does not make use of any of the class variables. B. When it includes a reference to a static variable. C. When we want to guarantee that it is a public method. D. Static methods should not be used in object oriented languages.arrow_forwardDesign and implement an object-oriented program for displaying a deck of cards. Each card will have a value ranging in order from 1 for an ace, 2 for a two, and so on up to and including 11 for a jack, 12 for a queen, and 13 for the king. The focus of the exercise is to create three classes that represent a card, deck, and hand using composition.arrow_forwardPlease help with the following: Consider the following Python code:class MyClass: attr = 10a. "altr" is MyClass's instance attribute.b."attr" is MyClass's static attribute.c."attr" is a non-local variable.d."attr" is a local variable.arrow_forward
- Complete the partial declaration of Class Car: public class Car { // declare three private instance variables: color, speed, model // define a constructor with two parameters: c , m which will assign values to color and model. //define set and get method for all instance variables //define a method named calspeed( ) with int return type, the method will increase the speed by 50 mile per hour. } Complete the application below. public class CarApp { public static void main() { string color = blue; string model = C2021;i int speed = 80; // declare necessary object matching to the constructor definition // display the color and model on the screen // call the calspeed( ) method and display the new speed after calculation. } }arrow_forwardJava program: The class diagram with four classes Mammal, Human, Student and Doctor is given. The Mammal class is given as well. Write down the remaining classes as described in the class diagram. The fields and methods for each class is given in the attachment. //in Mammel.java Public interface Mammal{ public double hairColor(): } 1. Class Human: Fields: age(int), weight(double), height(double) Methods: getAge, getWeight, getHeight 2. Class Student: Fields: major (String), gpa (double), creditHours (int) methods: getMajor: returns major, getGpa: returns gpa, getYear: returns freshman, sophmore, junior, senior as determined by earned credit hours Freshman : less than 32 credit hours sophmore: at least 32 but less than 64 credit hours junior: at least 64 credit hours but less than 96 credit hours senior: at least 96 credit hours 3.Class Doctor: Fields: years(int), Speciality (String) methods: getYears: returns years, getSpeciality: returns speciality, getSalary: calculates…arrow_forwardNote: Question of Object-oriented programmingarrow_forward
- If the programmer doesn't declare any constructors for an extended class, what constructors will be inherited from the superclass? How does this inherited constructor initialize new instance variables that are not part of the superclass? Suppose that Vehicle is a class and Car is a new class that extends Vehicle. Write a description of which kind of assignments are permitted between Car and Vehicle variables. Suppose you write a new constructor for an extended class. Describe two different ways that the superclass's instance variables could be initialized within the constructor for the extended class.arrow_forwardIf class A is a subclass of class B, then A has access to all of B's instance variables, including private ones. True Falsearrow_forwardComplete the following class diagram with the correct associations to make our object-oriented parking system complete.arrow_forward
- Please answer question. This is pertaining to Java programming language 2-10arrow_forwardHelp, I making a elevator simulator. I have to use polymorphism and object oriented programming to write this code. Can someone please help me improve this code I have. The remaining code is in the pictures. Any help is appreciated. Thank You! The simulation should have 4 types of Passengers: Standard: This is the most common type of passenger and has a request percentage of 70%. Standard passengers have no special requirements. VIP: This type of passenger has a request percentage of 10%. VIP passengers are given priority and are more likely to be picked up by express elevators. Freight: This type of passenger has a request percentage of 15%. Freight passengers have large items that need to be transported and are more likely to be picked up by freight elevators. Glass: This type of passenger has a request percentage of 5%. Glass passengers have fragile items that need to be transported and are more likely to be picked up by glass elevators. The simulation should also have 4 types…arrow_forwardJAVA: Briefly describe (1-2 sentences) each of the following object-oriented programming concepts: Attributes Methods Primitive Data Types vs. Objects Static methods/variables vs. non-staticarrow_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