1.9 When an object is instantiated from a class, it is then referred to as a(n): а. Inheritance of a class b. Instance of a class С. Polymorphism d. Overloading е. Abstraction of an object
Q: define a class CommissionEmployee that: a. has a firstName, lastName, socialSecurityNumber,…
A: Note: The solution of all three subparts of question 1 are shown below. Please repost the question…
Q: 6.3. Write a class LocalPhone that contains an attribute phone to store a local telephone number.…
A: Given: Write a class LocalPhone that contains an attribute phone to store a local telephone number.…
Q: 2. Create a class: Doctor, with private data members: id, name, specialization and salary with…
A: Given: Question is in the image plz send the solution ?
Q: Create a class to represent a Infant object that inherits from (extends) the Person class. Use the…
A: Unified Modelling Language ( UML) is a diagrmmatic approach to model any sytem by providing the…
Q: Q1 - Write ONE statement to create an Anonymous Inner Class (consider the class is empty!)? Ans:
A: As per our guidelines we are supposed to answer only one question. Kindly repost the remaining…
Q: 3.10.1: Basic derived class member override. Define a member method print_all() for class PetData.…
A: The answer is given below:-
Q: Build a class called BankAccount that manages checking and savings accounts. The class has three…
A: Use if condition to check whether the amount is positive or not
Q: P9.8 Implement a superclass Person. Make two classes, Student and Instructor, that inher from…
A: //Instructor.java public class Instructor extends Person { private double salary; public…
Q: 5. Consider the following inheritance hierarchy: Anma Hamma Answer the following questions with…
A: We need to write answers about questions on inheritance.
Q: If a class B is derived from A, identify which of the following terms can be used to describe A:
A: the answer is an ALL OF THE OPTIONS as given below : Ancestor class Base class Parent class…
Q: 1. A point in the x-y plane is représented by its x-coordinate and y- coordinate, Design the class…
A: First we are creating point in the x-y plane Code:- public class Point { protected…
Q: Suppose A is an abstract class, B is a concrete subclass of A, and both A and B have default…
A: 1. The correct answer is option (B) A a = new B(); Explanation : Here A is an Abstract class and you…
Q: Define a class
A:
Q: REFER TO IMAGE (JAVA) a. Write a Java statement that increments the value of count by 1. b. Write…
A: public static int incrementCount() { // Here we are incrementing count by one , return count++; }
Q: Question 9 Which XXX will avoid a memory leak? class MyClass { public: MyClass(); int value;…
A: Answer the above question are as follows
Q: 1. Write the class PolynomialNode that contains the fields coef and exp of type int and an attribute…
A: The PolynomialNode class contain 3 fields namely coef,exp of type integer and next of type…
Q: 4. If B is a subclass of class A. Given the following object: A a = new B0: Which of the following…
A: The correct answer option is provided below with explanation.
Q: #c++# Write a program that inputs a line of text, replaces all punctuation marks with spaces.
A: Note: - As per our guidelines we can only answer one question at a time. Please resubmit the other…
Q: ntences to describe the primary advantage of implementing an extended class. Your answer should use…
A: the solution is an given below :
Q: 2a) Write a simple code in Java to declare default & parameterized constructor of Student class and…
A: class Student{ String Name; double PhNo; //default constructor Student(){ }…
Q: 7. How you can make a class an immutable class?
A: How to make a class immutable class:-
Q: 4) Predict the output of the following code: abstract class Top { private String name; Top(String…
A: Abstract class is the class with the keyword of "abstract". This class is used to hide the…
Q: PROVIDE THE PYTHON SOURCE CODE FOR THE FOLLOWING Write a Circle class that represents the concept…
A: import math class Circle: def __init__(self, x, y, r): self.x = x self.y = y…
Q: Q 4. Imagine a tollbooth with a class called toll Booth. The two data items are a type unsigned int…
A: #include<iostream>using namespace std; class tollbooth{unsigned int car;double…
Q: .e., “cnic” of type integer and “name” of type String, and a setter and getter method of type void…
A: EXPLANATION Whenever an object is created of a class, memory is allocated to that object in heap.…
Q: Kindly store employee details using class with python program [2/25, 05:28] Vishal Singh Rawat:…
A: Python: Python is a general purpose programming language developed by Guido Van Rossum in 1989.…
Q: • Define a base class shapeClass , the class o Has two data members width and height , which are…
A: Since the Programming language is not mentioned in the question, we will answer this question in…
Q: Create a class Rectangle with length and breadth as private data members and also provide the…
A: GIVEN: Create a class Rectangle with length and breadth as private data members and also provide the…
Q: 1.2 The class Notebook has the following instance data: • Brand name – example: Acer, Dell, Lenovo…
A: class Notebook { //Variables of Notebook Class String brandname,itemcode; double…
Q: using java write a program Consider the following class definition that represents an AM radio:…
A: a)Answer Pointers: All answers to question B4 square measure given in C++, however Java and…
Q: 1. Write Java code to do the following with one or more Primitive Wrapper Classes: A. Declare a…
A: public class WrapperClasses { public static void main(String[] args) { // using wrapper classes…
Q: Test time left: 01:21:11 Write a java program to implement the concept of inheritance where the…
A: Code: interface Publication{ public void show_publication_detail();}class Department{ String…
Q: 5. a) Write a Class C which should extend Class B in the below example? class A { class B {
A: Note: There are multiple questions given in one question. According to the rule, you will get the…
Q: 8.2 Implement a class Quiz that implements the Measurable interface. A quiz has a score and a letter…
A: Solution :: You can run this code here and see.. https://www.onlinegdb.com/online_java_compiler…
Q: 22B. Create another class named Student that is publically inherited from Person • It has two…
A: According to the question we have to write the C++ code for following question:
Q: ample: Input Result after a train crashed, every single person died. who survived?all of the…
A: The program is written in Java. Please find the source code and output in the following steps.
Q: 1. Giving the following Java program representing the class student, complete the missing code. a.…
A: Here, I have to write a java program for the given class Student and complete the parts given.
Q: xample: Input Result after a train crashed, every single person died. who survived?all of the…
A: The program is written in Java. Please find the source code and output in the following steps.
Q: 9.19 LAB: BankAccount class (EO) Build a class called BankAccount that manages checking and…
A: Here I have created the class named BankAccount. In this class, I have created 3 private data…
Q: D-Show how to overload the constructor for the following class so that uninitialized objects can…
A: Constructor is just like other methods but this doesn't have any return type and the name of…
Q: Study the following class diagram and answer the questions: Teacher Main a. Develop class (Teacher)…
A: No programming language mentioned, So the program is written in C++. In step 2, you will get C++…
Q: [JAVA]Please create a zombie class with the following directions in the problem. The screenshot is…
A: Solution: Given,
Q: Consider a class "Fan" with two integer data members, "state" (0/1 i.e. on or off) and "speed". 1.…
A: UML class diagram of Fan class: Where state and speed are private data members of fan class. The…
Q: Study the following class diagram and answer the questions: Teacher Main a. Develop class (Teacher)…
A: public class Teacher { //declaring fields private int Id; private String Name; private…
Q: Class A is composed of objects of class B, class B is extended by C & D. There should be a copy…
A: Explanation: A is composed of objects of class B, so it does not need a copy constructor. B is…
Q: 2. Every circle has a center and a radius. - Given the radius, we can determine the circle's area…
A: Actually, Java is a general-purpose also class-based, object-oriented programming language designed…
Q: Create a separate class with these members a, b, c, x, y, z int a b c float x y z Demonstrate A.…
A: These questions are related to the Constructor in Java, All 4 are solved in each step.
Q: Create a class called Line with the followings: 1. Private members: p1 and p2 as pointer to Point…
A: Creating the LINE class according to given specifications. #include <iostream>…
Step by step
Solved in 2 steps
- highlight the correct answer and provide proper explanation 6. A class should take any number as an argument but no other data types. Which code does this? a. public class xyz <T> b. public class xyz <T extends Number> c. public class xyz <T implements Number> d. public class xyz <T extends Integer> 7. Log4j.properties is set to 'warn'. Which would show in the log file? a. Info b. Debug c. Trace d. Error 8. Which would lock an object so that it could only be used by a single thread? a. join() b. yield() c. synchronized() d. start() 9. Which of the following is an example of a dependency between 2 objects? a. Vehicle and car b. Person and employee c. Pilot and plane d. Generic database reader and Oracle database readerhighlight the correct answer 6. A class should take any number as an argument but no other data types. Which code does this? a. public class xyz <T> b. public class xyz <T extends Number> c. public class xyz <T implements Number> d. public class xyz <T extends Integer> 7. Log4j.properties is set to 'warn'. Which would show in the log file? a. Info b. Debug c. Trace d. Error 8. Which would lock an object so that it could only be used by a single thread? a. join() b. yield() c. synchronized() d. start() 9. Which of the following is an example of a dependency between 2 objects? a. Vehicle and car b. Person and employee c. Pilot and plane d. Generic database reader and Oracle database reader[12] Consider the following: class Point(): # A method defining how to create a point: def __init__(self,x,y): self.x=y self.y=y # ways to represent the objects as string def __str__(self): return f”({self.x},{self.y})” a_point=Point(2,3) print(a_point) The code above implements a class named 'Point' representing points on a cartesian plane. What is the purpose of the "self" keyword when defining an instance or calling instance methods? a. self refers to the instance whose method was called. b. self refers to the class that was inherited from to create the object using self. c. self means that no other arguments are required to be passed into the method. d. There is no real purpose for the self method; it's just historic computer science jargon that Python keeps to stay consistent with other programming languages.
- (Java) Q 1,2 ANSWER BOTH PART 1 AND 2!!! Explain the answer step-by-step and include verbal explanation. Thank you! PART 1: 1. Given the below Car class, write a child class of Car named Tesla. The Tesla class has an additional private boolean variable named autoPilotEnabled. It also has two constructors - a default constructor and a three argument constructor. Both constructors call the appropriate constructors of the parent class. Tesla also has a getter and setter for the autoPilotEnabled variable. Finally, it has a toString method that calls the toString of Car, as well as concatenating the autoPilotEnabled variable. public class Car { private String make;private String model;public Car() {make = "Make unknown";model = "Model unknown";}public Car(String make, String model) {this.make = make;this.model = model;} public String getMake() {return make;}public String getModel() {return model;}public void setMake(String make) {this.make = make;}public void setModel(String model)…Create a class called Line with the followings:1. Private members: p1 and p2 as pointer to Point objects (code provided below), slope and length as double variables2. Define setter and getter functions.3. Define a default constructor that allocate dynamic memory for points andset everything to 0.4. Overload a constructor that allocates memory for points, initilize themwith given arguments, and calculate the slope and length.5. Overload a destructor, a copy constructor and a copy assignment operator.6. Create a function called ”parallel” that return true when given lines areparallel and returns false otherwise7. Overload the less than (<) and greater than (>) and equality (==) oper-ators (compare the length)8. Write a functions that reads lines in the format provided in the lines.txtfrom the file and stores them in a vector named Lines.9. Sort the objects of Lines vector in descending order.10. Extend the functionality of cin and cout for this class11. Write a separate file to…1. a class Rodent has two subclasses Rat and Mouse. Rodent has the public method "squeak" and Rat has the public method "hiss." Which of the following statements will cause a compiler error? A. Rat rat = new Mouse(); B. new Rodent().hiss(); C. new Mouse().squeak(); D. A and B but not c will compiler errors E. A, B and C will cause compiler errors 2. The Java Graphics class is _______ with subclasses specified for _______ A. abstract; different font sets B. abstract; different hardware profiles C. non-abstract; different font sets D. non-abstract; different hardware profiles E. non-abstract; transparency and shadowing
- Implement a JAVA application that keeps track of package deliveries to consumers. Theapplication consists of the following classes:• Item: Create a class called Item. The class has two member variables oftype String named name and description and provides getter and settermethods for both.• Mail (abstract class): Implement an abstract class called Mail . The class hasa member variable of type String named address and a getter method for it.• Letter: Implement a class called Letter that inherits from Mail . The classhas one member variable of type String named contents.• Package: Implement a class called Package that inherits from Mail . Theclass has one member variable of type Item[] named items and a gettermethod for it.• DeliveryTruck: Implement a class called DeliveryTruck with a singlemember variable of type Mail[] of length 10. Add the following method:o void load(Mail mail): This method stores the given mail argumentat the next available spot in the member variable.a package ParentPackage, define a class Code Tantra with the instance variables-student name, registration number, a float array of length 7 (to store the marks scored in 7 questions in TermEnd exam), total marks and percentage. Define a constructor that receives the name, registration number and an array of 7 marks and adds the top 5 marks and stores the sum in total marks in the same package, define a class Percentageclass with a method to calculate the percentage Define a subpackage ChildPackage" with a class GradeClass that inherits the PercentageClass and includes a method to print the count of S. A. B, C D E and 'F' grades, based on the percentage obtained(Java Code)Java ...... Two files are required, a data class named Book and an executable class named TestBook. Class Book has instance data members (all private) String title, String author, int pages, double price. has a public static int variable named numBooks with an initial value of zero. has a parameterized constructor that will be used to make a Book object and assign values to its data members, and increment numBooks. has a no-arg constructor that increments numBooks. has getters and setters for all instance data members. has a toString() method that returns a string displaying the state of a Book instance. Use the numBooks variable to report the number of books instantiated. Class TestBook This class needs a main method and two more methods. In main: create an array capable of holding six Book objects. use the parameterized constructor to specify the data in the first four elements of this array use the no-arg constructor to create the two remaining books in the array.…
- REFER TO IMAGE (JAVA) a. Write a Java statement that increments the value of count by 1. b. Write a Java statement that outputs the value of count. c. Write the 6 definitions of the constructors and the methods of the class MyClass as described in its definition. d. Write a Java statement that declares myObject1 to be a MyClass object and initializes its instance variable x to 5. __________________________________________________________________ e. Write a Java statement that declares myObject2 to be a MyClass object and initializes its instance variable x to 7. __________________________________________________________________ f. Identify each of the following statements as either valid or invalid (tell why it is invalid). Assume that myObject1 and myObject2 are declared as in parts (d) and (e). myObject1.MyClass( ); ____________________________________ myObject2.setX(50); ____________________________________ MyClass.printCount( );…++1.+Write a class about a book which has following properties: • isbn • price • titleIn a Test class we are supposed to create objects as below: Book b1= new Book(); Book b2= new Book(544444, “Java”); Book b3= new Book(54444444, C++, 5.6); Book b4= new Book (“Python, 7.9, 8888899988); and we are supposed to print objects with the following statement: 5. System.out.println(b3); The the output should be:“Title of the book is C++, ISBN is 54444444”, price is 5.6 TL Now complete the Book class that enable to execute statements that mentioned in the Test class. Except the 5 items that mention above, please test: 6. Test the f(n) with 2 different numbers 7. Update the price of the b4 object.8. Test the Q3 method.m..5. Given the Java Point class (which contains two private variables x and y and constructors that allows creating a point object with known x and y values as well as other methods such as equals( ), toString( ) etc), (a). define a new class called Circle that contains private two variables: center which is a Point object from the Point class and radius which is of type double. The Circle class must have the following methods: (b). add a constructor which creates a circle object using a center point with x and y values and a radius as its parameters. (c). add a default constructor. ( (d). add an equals() method that can compare if any object is equal to a Circle object (two circle objects are equal if they have the same center point with the same radius). (e). add a toString() method that prints a Circle object with the center point and radius.