QUESTION 4 einclude ciostrea using nanespace std class Quad private double height double base 10 11 12 publie void read()) veid print() 13 14 15 16 int nain) 17 18 Quad rec,par int choices 19 Which line(s) assigned memory to the above class? Line-5 to line-14 OK All the answers are wrong Line-7 to Line-13 Ow. Line-19 따
Q: Q2: write a program to create the following classes and then find: 1-to initialize a new data called…
A: Answer : class Car { static int count=0;String name;float price;String color;int seats;Car(String…
Q: Question 1 Suppose we have the following definitions: class Frabjous { private: char fab[20];…
A: ANSWER:-
Q: 5. Given: class Base { protected: void protectedMethod () { } }; class Derived : public Base {…
A: A protected member can not be accessed by an object of a class. Only member functions can access…
Q: mplement the copy constructor and copy assignment operator of the derived class Runner in a way that…
A: A copy constructor is a member function that initializes an object using another object of the same…
Q: Part II: Operator Overloading Given the following class: class WholeNumber { public: WholeNumber():…
A: THe answer is given below for the above given question:
Q: Create a class “MyMatrix" with the following members Pointer to Pointer to an integer (For 2-D…
A: It is defined as a powerful general-purpose programming language. It can be used to develop…
Q: highlight the correct answer and provide proper explanation 6. A class should take any…
A: 6. d. public class xyz <T extends Integer> 7. d error
Q: te { private int day; // from 1 to 31 private int month; // from 1 to 12 private int year; //…
A: PROGRAM CODING: class illegilDite313Exception extends Exception { public…
Q: 7.32 Book class Make a public class called Book. Do not put this class in any package. Put code for…
A: To Do: To write the java code.
Q: O 88 h Money h Money ) No Selection 1 #ifndef MONEY_H 2 #define MONEY_H 3 #include 4 using…
A: Object oriented programming contains various features like class and objects, inheritance,…
Q: 6. Consider the following classes and discuss/evaluate them in terms of Coupling, Cohesion…
A: Bоосh рrороses five metriсs tо meаsure the quаlity оf сlаsses:…
Q: Task – 10 Implement the design of the CSE and EEE classes that are derived from the Department class…
A: Here I have created 2 child classes that extend the Department class. In these child classes, I…
Q: Q6/write program using classes (private, public, main) to find the a varage for 3 students by…
A: Since no programming language is mentioned, I am using java. Code: import java.util.*;class Students…
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: /Please Fix this probem. #include #include Class Soccer { Int g_no, no_assist, no_goal;…
A: /* all c in cout and cin was in capital, so, changed C to small c. */#include <iostream>…
Q: indly Give me (OOP) C++ codes for the following question. Question: Consider the following class…
A: PROGRAM CODING: #include<iostream.h>using namespace std;int main(){for(int a=0; a<=1;…
Q: QUESTION 28 Consider the following code: 1. public class Circle { private int radius; private int x;…
A: Given:
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: Consider the following class definition: (8) class base { public: void setXYZ(int a, int b, int c) ;…
A: a) Member functions which are protected is :- setZ() void secret() and also one variable z is in…
Q: Consider the following class definition class father { protected : int age; public; father (int x)…
A: Given: Consider the following class definition class father { protected : int age; public; father…
Q: Write a Program to define a Mobile class, with member variables o String brand; o double price o…
A: import java.util.Scanner;import java.io.*; class Mobile{ private String brand; private final…
Q: Write a program to write for detail of n doctors by allocating the memory at run time only.
A: Program: // C++ Version 14#include <iostream>using namespace std;// Class definitionclass…
Q: highlight the correct answer 6. A class should take any number as an argument but no other…
A: The question is to choose correct options for the given questions.
Q: Date class to use: #ifndef DATE_H_ #define DATE_H_ #include #include using namespace std;…
A: Write a program that randomly generates 100 dates and store them into a vector. Use the Date class…
Q: Create a class Term. This class represents a term of a polynomial such as 2x4 where 2 is coefficient…
A: Explanation Classes Used Use of ArrayList-> Dynamic array are used for storing the elements…
Q: include using namespace std; class Vehicle // superclass { private: int x = 7; //…
A: Program Approach: 1- As mentioned in the assignment, updated the code as per the description. 2-…
Q: *12.5 (I11legalTriangleException) Programming Exercise 11.1 defined the Triangle class with three…
A: import java.util.Scanner; public class TriangleWithException { public static void main(String[]…
Q: ven the following class definition: class employee { public: employee(); employee(string,…
A: The code has given below
Q: Analysis the following class definition and answer the following question. class Student{…
A: class Student{ private int id, age; protected float mark;…
Q: *12.5 (11legalTriangleException) Programming Exercise 11.1 defined the Triangle class with three…
A: the Triangle class to throw an IllegalTriangleException object if a triangle is created with…
Q: Consider the code given below. #include using namespace std; class myclass { private: int x; public:…
A: The problem is based on finding the statement containing the error.
Q: Design Naruto class and MyHeroAcademia class which inherit from Anime class so that the following…
A: Coded using Python 3.
Q: 18. You are given the following class definition: public abstract class Array { protected int[]…
A: The code for the above-given question is given below:
Q: Create a class: Doctor, with private data members: id, name, specialization and salarywith public…
A: In C++ a class is a user-defined data structure that is declared by keyword class that comprises of…
Q: #include using namespace std; 4. class Quad 6日{ private: double height; double base; 8 9. 10…
A: #include <iostream> using namespace std; class Quad private: double height; double base;…
Q: Q3. Given the following definitions of classes AA and BB. What is the output of the Test program?…
A: PROGRAM: //Defining class AA class AA{ //Defining a private member function private void…
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: 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: 0k try t0 $0LV3 In Pyt60n #3 class you should D3sign should Madrid cl@ss and Barca cl@ss which…
A: Here I have created the function addTrophy and showClubPoint in the class Club. In addTrophy()…
Q: 7.21 LAB: Triangle area comparison (classes) Given class Triangle (in files Triangle.h and…
A: //Triangle.h#ifndef TRI_H #define TRI_H //Triangle class declarationclass Triangle{private://private…
Q: *12.5 (11legalITriangleException) Programming Exercise 11.1 defined the Triangle class with three…
A: //Traingle classclass Triangle{ public Triangle(double side1, double side2, double side3) throws…
Q: Create a class named Line: (a) Define private data members p1 and p2 as pointer to Point objects…
A: Dear student, You are not mentioned any Language. I'm Providing you the Code in C++ Language. I hope…
Q: Given uhe following code /A class to represent secretaries, public class Secrétary extends Employee…
A: Secretary inherits toString from Object
Q: Subject: Object-Oriented Programming
A: Solution: Given,
Q: 1. What is the output of the following program? 2. Also, explain the functionality and output of the…
A: EXPLANATION: In the main function, the object is declared for the type M which is not declared in…
Q: Q 1. Consider the following class definition class father { protected : int age; public; father (int…
A: Given:
Q: use Java. Given main(), define the Product class (in file Product.java) that will manage product…
A: Write the Product Class in Product.java File, write the required constructor, getter and setter…
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 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 readerC++ quetion! ASAP please!! It doesn't have to be long answer. Given the following class with dynamic resources: 1. class Stone{2. char* colour; // dynamic resources3. int weight;4. public:... Copy Constructor goes here ...5. }; Write a copy constructor for it. Your answer need only include the copy constructor's definition and you can assume any standard libraries are already included.Question: 3Implement the design of the Student_Tutor class that inherit from Student class so that the following code generates the output below:Hint: Each room has a capacity of 2 Student tutors.class Student: def __init__(self,name,student_id): self.name = name self.student_id = student_id self.semester = "Spring 2022" def details(self): print("Name:",self.name) print("Student_ID:",self.student_id) print("Current Semester:",self.semester)# Write your code here:STs = []S1 = Student("Reem", 18101235)S1.details()print("1.======================================")ST1 = Student_Tutor("Moynul", 16107892, 35, "CSE110", "CSE111")ST2 = Student_Tutor("Priyo", 16107792, 25,"CSE320")ST3 = Student_Tutor("Ronok", 18207892, 36, "CSE110", "CSE111", "CSE221", "CSE220")ST4 = Student_Tutor("Zeba", 19307892, 48, "CSE110")STs.extend([ST1, ST2, ST3, ST4])print("2.======================================")for i in range(len(STs)): STs[i].details()…
- Write a class to satisfy the following main using constructor, destructor, copy constructor, operator =, and move constructor in c++ Please do not edit mainclass Chunk {private:int* p;public:};Chunk f(int n) {return Chunk(3, n); //use move constructor}int main() {Chunk a(100, 5); // allocates array of 100 elements, each = 5const Chunk b(a); // b is a copy of aconst Chunk c = a; // c is a copy of aChunk d = f();c = d; // operator =, wipes out c, replaces with d return 0;}EXPLAIN EACH OF THE FOLLOWING LINE. import java.awt.*; import java.awt.geom.*;3 .import java.awt.font.*;4. import javax.swing.*; public class Main extends JPanel{ 6. static int angdeg=0; 7. @Override 8. public void paint(Graphics g){ 9. Graphics2D g2d = (Graphics2D) g; 10.g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.V ALUE_ANTIALIAS_ON); 11. g2d.setColor(Color.white); 12. g2d.fillRect(0,0,getWidth(),getHeight()); 13. Font font = new Font("serif",Font.BOLD,50); 14. g2d.setFont(font); 15.FontRenderContext frc = g2d.getFontRenderContext(); 16.TextLayout layout = new TextLayout("JAVA", font, frc); 17. double sw = layout.getBounds().getWidth(); 18. double sh = layout.getBounds().getHeight(); 19. AffineTransform saveTransform=g2d.getTransform(); 20. g2d.setColor(Color.black); 21. Rectangle rect = this.getBounds(); 22.…Assume ContractEmployee, HourlyEmployee, CommissionEmployee, FixSalaryEmployee are sub-classes of Employee class. Define the body of below method suchthat it shall print how many employees of each type the ArrayList object passed as parametercontains? Static void countAndPrintAllTypesOfEmployee (ArrayList employees) { }
- create a uml class diagram on this code: class grey(object): def __init__(self, name): self.name = name def getName(self): return self.name class Rank(grey): def __init__(self, name, rank): grey.__init__(self, name) self.rank = rank def getRank(self): return self.rank class Specialty(Rank): def __init__(self, name, rank, specialty): Rank.__init__(self, name, rank) self.specialty = specialty def getSpecialty(self): return self.specialty s = Specialty("Derek","Attending","Neurosurgery")print(s.getName(),s.getRank(),s.getSpecialty())1. Construct a class Assessment with the following attributes a. Id (int) b. Topic(String) c. MaxMarks(double) d. Date of conduct (doc) (GregorianCalendar) e. attempts ArrayList <Attempt> //an array list that will contain the Attempts objects 2. In order to complete the above class you will have to write a class Attempt with the following attributes. This class represents the attempts that students have made against this assessment. a. studentId(int) b. studentName(String) c. marksObtained(double) 3. Provide constructor in Attempt class with values for all attributes 4. Provide getters and setters for each 5. Provide a toString method that produces the following string Student = --id-- : name Marks Obtained : --marks— 6. Now complete the Assessment class through Following steps a. Provide a parameterized constructor with arguments for all except the array list i. Instantiate the arraylist in the constructor along with other variables b. Provide getters for all except the…Draw a class diagram for the parking office class below. Diagram shoukd not be hand drawn. N.B Parking office class has relations and dependencies with car, customer, parkinglot and parking charge classes. public class ParkingOffice {String name;String address;String phone;List<Customer> customers;List<Car> cars;List<ParkingLot> lots;List<ParkingCharge> charges; public ParkingOffice(){customers = new ArrayList<>();cars = new ArrayList<>();lots = new ArrayList<>();charges = new ArrayList<>();}public Customer register() {Customer cust = new Customer(name,address,phone);customers.add(cust);return cust;}public Car register(Customer c,String licence, CarType t) {Car car = new Car(c,licence,t);cars.add(car);return car;}public Customer getCustomer(String name) {for(Customer cust : customers)if(cust.getName().equals(name))return cust;return null;}public double addCharge(ParkingCharge p) {charges.add(p);return p.amount;}public String[]…
- Q1: Write a class named as Bus that contains the attributes which are mentioned below: The name of Bus. The direction of Bus (North (N), South(S), East(E), West (W)) The position of Bus (from imaginary zero point)The class has the following member functions: A constructor to initialize the attributes Turn function to change the direction of bus to one step right side (e.g if the direction isto East, it should be changed to South and so on) Overload the Turn function to change the direction to any side directly. It should take thedirection as an argument. Move function to change the position of the Bus away from imaginary zero point. Itshould accept the distance as an argument.Task 2: General AbstractsFor this task you will be asked to create the Java classes described in the UMLdiagram in Task 1.Instructions1. The class Person has the following implementations in addition to thosespecified above:• the dateOfBirth attribute is of type java.util.Date• public getter methods for the attributes• a public constructor Person with the following method signature:public Person(String idNumber, String name, Date dateOfBirth)• declare an abstract compareTo method in Person with the followingsignature:public int compareTo(Person p);2. The class called VaccineRecord has the following extra details:• the enum called VaccineType has the following possible values:JJ,AZ,MD,PF• the public constructor for the VaccineRecord has the following signa-ture:public VaccineRecord(VaccineType type, String batchCode);• the date attribute is of type java.util.Date3. The class called Patient that extends the Person class has the followingadditional attributes and behaviours:• the public…23.2 LAB: Calculator class (Use Python) In the file main.py write a class called Calculator that emulates basic functions of a calculator: add, subtract, multiply, divide, and clear. The class has one attribute called value for the calculator's current value. Implement the following methods as listed below: Default constructor method to set the attribute to 0.0 add(self, val) - add the parameter to the attribute subtract(self, val)- subtract the parameter from the attribute multiply(self, val) - multiply the attribute by the parameter divide(self, val)- divide the attribute by the parameter clear(self) - set the attribute to 0.0 get_value(self) - return the attribute Given two float input values num1 and num2, the program outputs the following values: The initial value of the instance attribute, value The value after adding num1 The value after multiplying by 3 The value after subtracting num2 The value after dividing by 2 The value after calling the clear() method Ex: If…