5. Given the definitions of class x (Figure 3) and class Y (Figure 4) below, class x { private int d: public x(int c) { 7 public int f(){ 10 int a - d + 1; 11 return a; 12 Figure 3 class Y extends private int public Y(int s, t) { int super (s): g - t: 10 O public int h() { 11 int a: 12 a = g-1; 13 return a: 14 15 Figure 4 34
Q: Suppose that you have formatted your disk with a block size of 1024 bytes and assume that we have…
A: The Answer start from step-2.
Q: The management oł Gople plansto invest in new cquipment for the poadiction of teblet computens .…
A: Making an investment decision: Capital budgeting is the word used to describe investment choices. It…
Q: Computer science What is the menu's content? Explain how task-related menus are organised in…
A: Introduction: Menu Menus are useful for providing clues to the concept. It is nicely built around…
Q: What exactly do you mean by "OS for resource-constrained devices"? Briefly describe it.
A: Introduction: Using restricted processing and storage resources, resource constrained devices are…
Q: Describe what a database management system is and what characteristics it has.
A: Introduction: A database management system (DBMS) is another name for a database management system.
Q: Provide me with the MATLAB code to swap the first and last row of the matrix given below, mat = 1111…
A: Swap the first and last row of the matrix
Q: The question is, how do you keep class fields safe from unintentional modification?
A: Answer :
Q: 4. Recall the logic gates pvq png Inverter OR gate AND gate Given the following logic circuit
A: Propositional Logic: It is ways by which the statements can interact with the each other and it is…
Q: How and why is a data model employed in the creation of a database
A: Given: We have to discuss How and why is a data model employed in the creation of a database.
Q: The average running time of the worst case is determined using amortised analysis. True False
A: Introduction: Amortized-Analysis is used to describe algorithms in which one or more operations are…
Q: To class Tree, add the following method public int countOdds(){ return countOddNodes(root); } Write…
A: Solution Code: public int countNodes (Node<E> root) { / / Base cases. if (root…
Q: What is the value of JFK for the conversion below to be correct? (0100111JFK00)2 = (4FC)16 %3D
A: Converting Hex to binary 4 --> 0100 F --> 1111 C --> 1100
Q: A double is a data type in C language that stores high-precision floating-point data. Select one:…
A: True Explanation:- Double stores high precision floating point data in double we can store upto 64…
Q: Write a C program that prints the following output: AND COMMENT EVERY STEP PLEASE 6 7 8…
A: 1. declare the variable i and j for iterartion i is used for inner loop and j is used for outer…
Q: Design a Graphical application using Java FX that connects to Twitter API.
A: class API { // connect to API publicstaticvoidmain(String[] args) { // api url Stringurl =…
Q: Public Key cryptography was created to overcome two major concerns, one of which being key…
A: Introduction: Public Key cryptography was created to overcome two major concerns, one of which being…
Q: What is the function of a real-world parameter?
A: The actual parameter is the value that the caller passes into the method. They are frequently…
Q: Create table "STUDENT" with attributes "STUDENT_ID", "STUDENT_NAME", "STUDENT GPA". Use appropriate…
A: NOTE : There is a policy from bartleby to solve only first 3 subparts of a question.
Q: Use Rice's Theorem to prove that it is undecidable whether, for any positive integer constant k, a…
A: Let language L accept TM M I.e. <M> belongs to L if <M> accepts exactly k strings. So…
Q: Write a program that first gets a list of integers from input. The input begins with an integer…
A: def ints_less_than_or_equal_to_threshold(user_values, upper_threshold): new_array = [] for…
Q: Q2) Consider the regular expression: (ablac)* a. Use Thompson's construction to construct a NFA. b.…
A: The Answer start from step-2.
Q: For simplicity, let us assume that each instruction on a RISC processor is executed in 2…
A: Introduction: Interrupt handling in a RISC processor: Interrupts are a technique for preventing the…
Q: When it comes to computerized systems, what are the most significant functions that they should be…
A: Computerized Systems and Their Functions: Diverse performance-related aspects impact a computer…
Q: b. SELECT EmpName, Sal, Job FROM WORKERS WHERE EmpName LIKE ‘_a’ AND Sal > 10000; JUST ANSWER…
A: The underscore operator i.e. (_) along with sql LIKE operator represents one character in the…
Q: NOTE: (what your answer will contain) 1. Use C PROGRAMMING LANGUAGE ONLY 2. Use RECURSION type of…
A: Here I have defined a recursive function named division(). In this function, I have used a condition…
Q: When you invoke a method on an object instance, the version of the method that will be executed will…
A: True
Q: What are the many types of networking?
A: Introduction What are the many types of networking?
Q: What are the required technologies (hardware and software) that must be deployed in a customer…
A: Introduction: Processor: Processor: Processor: Processor: Processor: Processor: Processor: Processor…
Q: o what extent does an agile approach alter the regular lifecycle of a system?
A: Many organisations are using the agile approach for software development in the recent times.
Q: The term "LAN" stands for "local area network."
A: A local area network (LAN) is a connected environment covering one or more buildings – typically…
Q: What methods can be used to impsove information poivacy
A: The answer is as follows:
Q: What does privacy mean in the context of information security? Information technology
A: Introduction: The term "security" refers to the protection of data, whereas "privacy" refers to the…
Q: D020 0 70 44 2025 3012 60432 8O 24 r 3024 sairi lked la ked for 9.1ADS E 192.143hourN 0100
A: I have written the code below:
Q: What exactly are system development methods? Examine the significance of system development…
A: Introduction: The system development methods: these are the fundamental methods that are used to…
Q: let consider 5 different outputs in combinational circuit/ Digital Logic Design For example x=1 y=…
A: We need to design a single output schema which take the 5 different outputs into a single 5 bit…
Q: Discuss, with necessary diagrams and mathematical analysis, the electrostatic deflection as occur in…
A:
Q: What message authentication options are available? Information technology
A: Introduction: To establish communications, MACs, authenticated encryption, and digital signatures…
Q: In order for a software to make use of a file, it must perform three stages.
A: Files in a programming languageThe file permanently keeps data in a storage device or system's hard…
Q: what is the definition of an incident and what needs to have occured in order for a security event…
A: Question: what is the definition of an incident and what needs to have occurred in order for a…
Q: Consider the following graph and find the minimum cost of this problem by using Prim's algorithm and…
A:
Q: Explain the concept of a digital signature and how it is created.
A: Introduction: A digital signature, which is a sort of electronic signature, is a mathematical…
Q: The usage of social media as a communication tool is on the rise in today's culture. In terms of…
A: Social media is a term used to describe the collection of applications and websites which allow…
Q: What does SQL's Like operator do?
A: When a value is compared to other similar matters, the SQL LIKE clause employs wildcard operators to…
Q: Write the compound proposition (¬p) → (q v (r ^ ¬s)) a. Postfix notation b. Prefix notation C. Infix…
A: The solution for the above-given question is given below:
Q: ode in Prolog. Do not use in built libraries. Implement the following relation to get a vector…
A: Input : Two vectors. Output : Element wise product of two vectors.
Q: Complete a program in a class ToyCounter that computes the cost of toys sold in a shop. Five kinds…
A: Program for create toyCounter and compute the total cost
Q: What exactly is Open Database Connectivity (ODbc)?
A: Introduction: Open Database Connectivity (ODBC) is a database access interface that is defined by…
Q: What exactly is an open environment?
A: Introduction: An open environment is a system that provides for the free flow of information and…
Q: Identify 5 current security architecture and design risks. Then: a) Describe each danger.
A: Malware: In order to steal or exchange information from you, a cybercriminal might pose as a…
Q: There are three types of page layouts in CSS, and you can describe them.
A: We'll review some of the CSS layout aspects discussed in earlier units, such as various display…
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
Step by step
Solved in 2 steps
- Question 15 1(8).png public class numClass { private int a; private static int y = 10; public numClass(int newx) {a-newx; } public void set(int newx) {a=newx; y+=a;} public void setY(int newY) {y-newY; } public static int getY() { return y; } // end of class Blank 1 Blank 1 Add your answer public class output[ public static void main(String[] args) { numclass one new numClass(10); numclass two new numClass (2); try{ one.sety(30); two.set(4); if(one.getY()-30) throw new Exception ("30"); one. sety (40); } catch(Exception e) { two.setY(50); } System.out.println(two.getY()); // end of main } // end of class ***Q 1: Access class members from the same package Note: ClassA and ClassB in this question are in the same package. public class ClassB { public int x = 1; int y = 2; private int z =3; } public class ClassA { public static void main(String[] args) { ClassB cb = new ClassB(); // System.out.print(cb.x); /* 1 */ // System.out.print(cb.y); /* 2 */ // System.out.print(cb.z); /* 3 */ } } 1.1- Which statement(s) are true? Choose all that apply. a. If statement 1 is uncommented, the code prints "1" to the output. b. If statement 2 is uncommented, the code prints "2" to the output. c. If statement 3 is uncommented, the code prints "3" to the output. .d. This code does not compile 1.2- Try to do the following: • Declare a character type variable myChar in the class ClassB, the variable myChar shouldn't be accessible through the object cb. Add a statement to the classA to test whether myChar is accessible.Activity - Abstract Class An English teacher wants to find assessment mark of all the students in his course. Write a java program to find assessment mark of the students using following instructions. Save the project/file as StudentAbstract. A) Abstract Class name: Assessment Abstract Member Method: - to calculate and return total score totalScore() B) Class name: English extends Assessment Member variables: QuizMark, PracticeTest, ListeningMark Member Method : - Constructor to initialize member variables - to calculate and return total score totalScore QuizMark + PracticeTest*0.25 + %3D ListeningMark/2 C) Controlling class : StudentAbstract - To create an object of English class - To print totalScore of the English
- 2. Consider the following class definitions: public class BClass } private int x; public void set(int a) } X a; { public void print() } System.out.print(x); { { public class DClass extends BClass } private int y; public void set(int a, int b) } //Postcondition: x =a; y=Db; { public void print( ) {.…} a. Write the definition of the print method of DClass that overrides it. b. Write the definition of the method set of the class DClass.15. Suppose the class Employee is declared as follows: public class Employee { private String name; private double baseSalary: public void setName(String newName) {...} public void setBasSalary(double newSalary){...} public String getName() {...} public double getSalary({...} } a)Declare a class Manager that inherits from the class Employee and adds an instance variable bonus for storing a salary bonus. Omit constructors and methods. ANS: b) Which instance variables does the Manager class have? c) In the manager class, provide the method overrides the getSalary method from the class Employee so that it returns the sum of the salary and the bonus d) Based on the above question, which methods does the manager class inherit? e) In the manager class, override the getName method so that managers have a before their name (such as *John Smith).Programming Language = Python 1. Employee and ProductionWorker Classes Write an Employee class that keeps data attributes for the following pieces of information: • Employee name • Employee number Next, write a class named ProductionWorker that is a subclass of the Employee class. The ProductionWorker class should keep data attributes for the following information: • Shift number (an integer, such as 1, 2, or 3) • Hourly pay rate The workday is divided into two shifts: day and night. The shift attribute will hold an integer value representing the shift that the employee works. The day shift is shift 1 and the night shift is shift 2. Write the appropriate accessor and mutator methods for each class. Once you have written the classes, write a program that creates an object of the ProductionWorker class and prompts the user to enter data for each of the object’s data attributes. Store the data in the object and then use the object’s accessor methods to retrieve it and display it on the…
- class first { public: void setX(); void print() const; protected: int y; void setY(int a); private: int x; }; Suppose that class second is derived from class first using the statement: class second: private first Determine which members of class first are private, protected, and public in class second.class first { public: void setX(); void print() const; protected: int y; void setY(int a); private: int x; }; Suppose that class second is derived from class first using the statement: class second: private first which members of class first are private, protected, and public in class second?Assignment 1 (D): 1- According to the Class Diagram below write a program using constructers with setters and getters, it has to be dynamic, JOptionPane or Scanner must be used, the user must be allowed to enter as many numbers as they want and then type in the operator. Class Calculator: Has the following attributes Numbers: Operator: addNums: subNums: divNums: multiNums: Print: +
- 1) Draw a class diagram depicting the below code. class Doctor { void Doctor Details () { System.out.println("Doctor Details..."); } class Surgeon extends Doctor { void Surgeon_Details () { System.out.println("Surgen Detail..."); } } public class Hospital { public static void main(String args[]) { Surgeon s = new Surgeon (); } } } 2) Establish an association between Person class and Book Class given below. public class Person { } s. Doctor Details (); s. Surgeon Details (); } private String name; private int age; public Person (String initialName) { this.name = initialName; this.age = 0; } public void printPerson() { } public String getName() { return this.name; } System.out.println(this.name + age public class Book { private String name; private String publisher; private ArrayList authors; // constructor public ArrayList getAuthors() { return this.authors; } public void addAuthor (Person author) { this.authors.add(author); } + this.age + 11 years");2) Consider the following class class Department { private: string name; const long locationNo; const longdeptId; intNumOfEmployees; static intnextDeptNo; static intnextLocationNo; public: Department( ); Department(string theName, totalEmps) void Print ( ) const; } Initialize both the values of nextDeptNo and nextLocationNo to 10000 Implement the default constructor to set the name to “Unknown”, locationNo to the current value of nextLocationNo, deptId to the current value of nextDeptNo and NumOfEmployees to zero. It should also increment the value of all static attributes by 1. Implement the other constructor to set the name and NumOfEmployees to the values that are passed to the contractor. The values of the locationNo and deptId should be assigned to the current values of nextLocationNo and nextDeptNo, respectively. This constructor should also increment the values of all static attributes by 1. The print function should print all values of all attributes (regular,…c++ please The Critter class is a base class with some basic functionality for running simulations of different kinds of critters. Critters can move, act, and remember their history. A typical simulation contains a number of critters of different types. In each step of the simulation, the act member function will be called on each critter. Define a class Sloth derived from Critter that simulates a sloth. Sloths alternate between eating and sleeping. Add the word "eat" or "sleep" to the history each time the act function is called. The implementation of the Critter class is not shown. Complete the following file: sloth_Tester.cpp #include <iostream>using namespace std; #include "critter.h" /**A sloth eats and sleeps.*/class Sloth : public Critter{public:Sloth();. . .private:. . .}; Sloth::Sloth(){. . .} void Sloth::act(){if (...){add_history("eat");...}else{add_history("sleep");...}} int main(){Sloth sloth;sloth.act();cout << sloth.get_history() << endl;cout <<…