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
Use the following partial class definitions to answer the question:
public class A1
{
public int x;
private int y;
protected int z;
}
public class A2 extends A1
{
protected int a;
private int b;
}
public class A3 extends A2
{
private int q;
}
Which of the following lists of instance data are accessible in A3?
Group of answer choices
x, y, z, a, b, q
a, b, q
a, q
x, z, a, q
x, a, q
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 2 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
- Partial Question 3 Consider: class A { } public void doA() { } class B extends A { } public void doB () { } Which of the following are allowed? B x = new B(); x.doB(); A x = new A(); x.doA(); A x = new A(); x.doB(); B x = new B(); x.doA();arrow_forward6. Given: class Pet { public: virtual void eat() { cout eat(); } What is the result of compiling and running the above program? m. The program compiles and crashes when it runs. i. The program compiles and runs, printing "Pet::eat" j. The program compiles and runs, printing "Cat::eat" The program compiles and runs to completion without printing anything. n. o. None of the above. k. The program fails to compile because the method eat is not marked virtual in Cat. I. The program fails to compile for some other reason.arrow_forwarduse the following partial class definitions:public class A1{public int x;private int y;public int z;…}public class A2 extends A1{public int a;private int b; …}public class A3 extends A2{private int q;…} 2) Which of the following lists of instance data are accessible in class A2?a) x, y, z, a, bb) x, y, z, ac) x, z, a, bd) z, a, be) a, barrow_forward
- Problem 4) Suppose the following Course class is given: public class Course { private String name;//such as CS, MATH, etc private int grades[];//list of the grades //default and initial valued constructor //all other methods public double average() { double sum=0; for(int i=0;i=90) System.out.printf("me is a student with A letter-grade\n");arrow_forwardInstructions-Java Assignment is to define a class named Address. The Address class will have three private instance variables: an int named street_number a String named street_name and a String named state. Write three constructors for the Address class: an empty constructor (no input parameters) that initializes the three instance variables with default values of your choice, a constructor that takes the street values as input but defaults the state to "Arizona", and a constructor that takes all three pieces of information as input Next create a driver class named Main.java. Put public static void main here and test out your class by creating three instances of Address, one using each of the constructors. You can choose the particular address values that are used. I recommend you make them up and do not use actual addresses. Run your code to make sure it works. Next add the following public methods to the Address class and test them from main as you go: Write getters and…arrow_forward13) 0101011111 010101010101 1101010101 01100 Read the following class definition and answer afterword: class Student { public: Student() {}; Student(int ID, string name, string university){ m_university = university; cam Student:ID = ID; Student::name = name; }; string getUniName() {return m_university;} string getStudentName() {return m_name;} void print() { cout << "Student ID is: "<arrow_forwardFix this code for any errorsarrow_forwardDesign a class named LinearEquation for a 2 × 2 system of linear equations: The class contains: ax + by = e cx + dy = f ■ Xx= ed - bf ad - bc y = af - ec ad – bc Private data fields a, b, c, d, e, and £. ▪ A constructor with the arguments for a, b, c, d, e, and f. ▪ Six getter methods for a, b, c, d, e, and f. ▪ A method named isSolvable () that returns true if ad – be is not 0. ▪ Methods getX() and getY() that return the solution for the equation. Draw the UML diagram for the class then implement the class. Write a test program that prompts the user to enter a, b, c, d, e, and f and displays the result. If ad - bc is 0, report that "The equation has no solution."arrow_forwardProvide the missing code segment in the portion with the TO DO remark in the following sample code. The Book class involved in the code is provided below: public class Book implements Comparable<Book> { protected int pages; public Book(){ pages = 1500; } public Book(int pages){ this.pages = pages; } public void setPages(int pages) { this.pages = pages; } public int getPages() { return pages; } public int compareTo(Book another) { // if same then return 0 if(this.pages == another.pages) return 0; //if current has more than return 1 else return -1 else if (this.pages > another.pages) return 1; else return -1; } }arrow_forwardB2arrow_forwardTressetteYou are given the types: type colore = Spade | Coppa | Bastoni | Denari ;; type valore = Ace | Two | Three | Four | Five | Six |Seven | Jack | Knight | King ;; type mazzo = Null | Carta of carta and carta ={ c : colore ; v: valore ; mutable tl : mazzo };; (see the picture with cards) a. Write a function points : mazzo -> int = that given a deck of cards calculates its point score. The scoring is as follows: Ace is worth 1 point; Two, Three, King, Knight, Jack are each worth 1 3 ; and the rest do not contribute the the point total. The total point score is equal to the sum of the individual points, rounded down at the end. b. Write a function max_cards : mazzo -> mazzo = that takes a deck of cards and filters out everything except the greatest cards by value (valore) of each color. The order of cards by value is as follows: Three > Two > Ace > King > Knight > Jack > Seven > Six > Five > Four. Due to the size of the output, lists like…arrow_forwardNumber 24arrow_forwardarrow_back_iosSEE MORE QUESTIONSarrow_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