Write a base class Computer that contains data members of wordsize (in bits), memory size in megabytes, and storage size in megabytes and speed in megahertz. Drive a Laptop class that is kind of computer but also specifies the object’s length width, height and weight. Member functions for both classes should include a default constructor, a constructor to initializes all components and a function to display data members.
Q: OEVO a. List all symbols and their probabilities b. Find the Huffman tree and codeword for each c. L...
A:
Q: Part 1 1. Write a permutation of 9 integers which is not in sorted order. Sort the integers using th...
A:
Q: Given num_rows and num_cols, print a list of all seats in a theater. Rows are numbered, columns lett...
A: Given :- Given num_rows and num_cols, print a list of all seats in a theater. Rows are numbered, col...
Q: QI Write program in fortran to find the maximum number of (x,y,z)?
A: PROGRAM INTRODUCTION: Take the three numbers from the user. Use the if condition to check if any nu...
Q: Question Completion Statu QUESTION 3
A: Notepads are useful in - drawing , writing pad , memo. So the correct options for the answer is- doc...
Q: Create a java program that generates elements (randomly from 10 – 75) of a 2-dimen (5x5) using the R...
A:
Q: After you have read the required chapters from the text for this unit, visit and read the following ...
A: After you have read the required chapters from the text for this unit, visit and read the following ...
Q: In recent years, even if the original data is truly analogue, most of the data storage and transfer ...
A: Digital Storage and signaling technology: Digital storage is those storage which is on different ser...
Q: programming Question to find the most probable speed from the velocitie ich are entered by the user....
A: Lets see the solution.
Q: Complete the below function in Java String method(String str, String x , int y ){ lladds the x strin...
A: Step-1: StartStep-2: Declare two string variable and a integer variableStep-3: Take input from user ...
Q: remediation plan to map vulnerabilities and risks found to appropriate remediation efforts. Provide ...
A: Lets see the solution.
Q: Complete the below function in Java String method(String str, String x, int y ){ lladds the x string...
A: There is partially method given and we have to add string x into str at position y Given:
Q: Create a list of sublists. Each sublist contains a rank (an integer from 1 to 13) and a suit ('Heart...
A: 1)THE CODE # import random class import random # declare the deck deck= [ ["A", "Spades"], ...
Q: Suppose we have the following functions: n log n, n² log n, logn Which order of the functions so tha...
A: - We need to have a correct choice for asymptomatic functions. - The functions :: n log n, n2 log n,...
Q: Suggest the most appropriate generic software process model that might be used as a basis for managi...
A: a) The Waterfall methodology is the best-suited general software process model for controlling anti...
Q: w an example of the Authorization action to review the Field and Also write s reate a new Authorizat...
A: The answer as follows
Q: 2. A singer voice is sampled for 4 second by an 8-bit ADC at a sampling frequency of 10 kHz. The sam...
A: The highest frequency range possible: Unesco Audio Mandate To promote recommended 48 kHz as with mos...
Q: Construct a subprogram that solves the differential equation set dy = g(y,t)dt %3D dt with the fourt...
A: In This Problem : The task is to find value of unknown function y at a given point x.The Runge-Kutta...
Q: As input, enter two non-negative number sequences in increasing order (the numbers entered are alway...
A: Algorithm/Approach: ask the user to input both lists then find the length of both list now using wh...
Q: Consider the following AND/OR graph to describe a simple automobile diagnostic system using IF-THEN ...
A:
Q: Plaso's psteal command (choose all that apply): Exports file content from a device, media...
A: Sort Answer: Filters, sorts and conducts analysis on the plaso database file. Displays infromation a...
Q: Prove that for any m ∈N, there exist an NFA with m states such that the equivalent DFA has at least ...
A: Proved the given statement
Q: lain (not less than 100 words) how Morgan in the article "Experiments versus Models: New Phenomena, ...
A: Given Explain (not less than 100 words) how Morgan in the article "Experiments versus Models: New Ph...
Q: QI Write program in fortran to find the maximum number of (x,y,z)?
A: Algorithm :- 1. Start program 2. Initialize the three number 3. If X>Y&X>Z 4. Print X is t...
Q: C++ programming Question. Try to find the most probable speed from the velocities of ten particles(i...
A: C++ Code: #include <iostream>using namespace std; void mostProbableSpeed(int nums[], int size)...
Q: In this Assignment you will use an abstract class to define, read, store, and print questions for a ...
A: The objective is to write the code of program and create a class to define, read, store, and print q...
Q: C++ Programming Exercise 2 #3
A: Name your C++ source code file: C++PE2-3.cpp (user’s age) Write the C++ code for a program allows t...
Q: Que 3.33. Write a program loop using a pointer and a counter to elear the contents of hex locations ...
A: Below is the complete solution for the given question in detail. The solution contains explanation w...
Q: Please covert the below output int python program
A: MATLAB CODE: function [nbrnod, nodes] = readNodes() nbrnod = input('Enter number of nodes: '); ...
Q: Design an ARM assembly subro
A:
Q: Write a program to sort an array of random elements using quicksort as follows: 1. Sort the arrays u...
A: the code is in c++ language
Q: Using C++, code the following problem: In this problem, we are given a knapsack of fixed capacity C...
A: the answer is given below:-
Q: Which of the follow (1) 3k, CER+ : (2) 3k,CE R+: (3) 3k, CE Z+ : f (4) 3k, C E Z+ : f
A: This is big O notation where f(x) <= O(g(x)) there exists two positive constants x and k . where...
Q: Why do we utilise MATLAB to solve difficulties in Computational Geometry?
A: Given :- Why do we utilise MATLAB to solve difficulties in Computational Geometry
Q: c) Instruction j Label is stored at 0x00400030, and Label is at instruction address 0x00400050. Enco...
A: MIPS assembly language includes two decision-making instructions, similar to an if statement with a ...
Q: Don atung ma age te nggeshat t n e w ng The moshes TM annet annethe The t at te ut ady te te gee man...
A: Ans:- option 1
Q: Define Harvard cache and explain its advantages.
A: Harvard cache Harvard Architecture is a computer architecture with separate instruction and data st...
Q: 3) Given the state table, draw the state diagram Present (t) in Next (t+1) out E A. B A B y 0. 0 0 0...
A:
Q: ethod that takes a 2-dim array as the maximum number of ele
A: class Main { public static void main(String[] args) { // test data int[][] arr1 = {{1...
Q: C++ programming Question. find the most probable speed from the velocities of ten particles(in m/s) ...
A: The answer as follows
Q: "Simon Says" is a memory game where "Simon" outputs a sequence of 10 characters (R, G, B, Y) and the...
A: As the above problem to code in python; Here I have two codes for this solution......
Q: 9. Construct a logic circuit that implements a 2-bit, 4-function ALU that has oper- ations ADD, AND,...
A: An arithmetic logic unit is a multi-operation, combinational logic function. It can perform a set of...
Q: 8. Consider the quantitative version of the risk formula A. What quantity (dollar value) of risk is ...
A: The answer is given below:-
Q: Using the Internet, research four different file hosting and sharing sites. Provide a brief descript...
A: Four different file hosting and sharing sites: Suagr sync Box Elephant Drive IDrive
Q: Using MIPS assembly language, please code the following: Please use if statements in the code -pri...
A: Here is the Code .data inputA: .asciiz "Input value of variable a\n" inputB: .ascii...
Q: Write a Java program that takes a string from user which have minimum capacity of 21 and till then u...
A: Answer: Code with Screenshot:
Q: The encoding of the 'Loop target' instruction has: K the full hcx addrcss of the label targct O nonc...
A: Loop Target : Loop target is used to define the location of the condition that is needed to be chec...
Q: Data may be exfiltrated by (choose all that apply): Printed documents. Peer-to-peer shar...
A: Defined data may be exfiltration
Q: 10.a. Ethernet networks are normally designed using a _______ topology. A. ring B. star C. linear D....
A: 10.a. Ethernet networks are normally designed using a _______ topology.A. ringB. starC. linearD. dir...
Q: What are the repercussions of humans introducing bias into machine learning? What human decisions af...
A: introduction: Artificial intelligence (AI), machine learning, and deep learning have become popular ...
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:
Write a base class Computer that contains data members of wordsize (in bits), memory size in megabytes, and storage size in megabytes and speed in megahertz. Drive a Laptop class that is kind of computer but also specifies the object’s length width, height and weight. Member functions for both classes should include a default constructor, a constructor to initializes all components and a function to display data members.
Step by step
Solved in 2 steps
- Assume the definition of class foodType as given in Exercise 6. Answer the following questions? (1, 2, 3, 5, 6) Write the definition of the member function set so that private members are set according to the parameters. The values of the int and double instance variables must be nonnegative. Write the definition of the member function print that prints the values of the data members. Write the definitions of the member functions getName, getcalories, getFat, getSugar, getCarbohydrate, getPotassium to return the values of the instance variable. Write the definition of the default constructor of the class foodType so that the private member variables are initialized to 0, 0. 0, 0, 0. 0, 0. 0, respectively. Write the definition of the constructor with parameters of the class foodType so that the private member variables are initialized according to the parameters. The values of the int and double instance variables must be nonnegative. Write a C + + statement that prints the value of the object fruit 2. Write a C++ statement that declares an object my Fruit of type foodType, and initializes the member variables of myFruit to Apple, 52, 0. 2, 10,13.8, and 148.0, respectively.Create a base class named Point consisting of x and y data members representing point coordinates. From this class, derive a class named Circle with another data member named radius. For this derived class, the x and y data members represent a circle’s center coordinates. The member functions of the Point class should consist of a constructor, an area() function that returns 0, and a distance() function that returns the distance between two points,(x1,y1) and (x2,y2), where Additionally, the derived class should have a constructor and an override function named area() (PI*pow(radius,2)) that returns a circle’s area. Task: 1-Include the classes constructed in a working C++ program. 2-Have your program call all the member functions in each class. 3- In addition, call the base class’s distance() function with two circle objects and explain the results this function returns.Write a base class Computer that contains data members of wordsize(in bits), memorysize (in megabytes), storagesize (in megabytes) and speed (in megahertz). Derive a Laptop class that is a kind of computer but also specifies the object’s length, width, height, and weight. Member functions for both classes should include a default constructor, a constructor to inialize all components and a function to display data members
- Write a class Distance which has two private data members (int feet,float inches). The class has three constructors which are having no parameter - values of both feet and inches are assigned zero. having two numbers as parameters - the two numbers are assigned as feet and inches respectively. having one number as parameter - both feet and inches are assigned that number. Provide getters and setters for data members. Now write a main class which demonstrate the functionality of above class by calling all constructors, setters & getters. Create 1 object using default constructor, and use setters to set values, then getters to print values. Create a second object using constructor having two parameters, provide values, then print values on screen. Create third object by using third constructor having one parameter, after that print values on screen.Model a room class, whose member data is three integers length, width and height. The classcontains two constructors to initialize the room class objects, first is no argumentconstructor, while the second in three arguments constructor. Class also contains threemember functions i.e., getdatat) to get the data from user and store in the memory of callingobject and showdata) to show the room data of calling object, int volume(int I, int w, int h)function should receive the length, width and height values from the objects one by one andreturn the volumes of the three objects respectively.Write a main program to declare the three object rl, 12, and 13 of room class. Two objectwill store the values through three argument constructor and third object will get the datafrom user by calling getdata function. Then all three objects should call the volumefunctions to calculate their volumes and store them in three variables of type integer. Finallythe system compare the three volumes values…Create a class Car, which contains • Three data members i.e. carName (of string type), ignition (of bool type), and currentSpeed (of integer type)• A no-argument constructor to initialize all data members with default values• A parameterized constructor to initialize all data members with user-defined values• Three setter functions to set values for all data members individually• Three getter function to get value of all data members individually• A member function setSpeed( ) // takes integer argument for setting speedDerive a class named Convertible that contains• A data member top (of Boolean type)• A no-argument constructor to assign default value as “false” to top• A four argument constructor to assign values to all data-members i.e. carName, ignition,currentSpeed and top.• A setter to set the top data member up• A function named show() that displays all data member values of invoking objectWrite a main() function that instantiates objects of Convertible class and test the…
- Create a class Car, which contains • Three data members i.e. carName (of string type), ignition (of bool type), and currentSpeed (of integer type) • A no-argument constructor to initialize all data members with default values • A parameterized constructor to initialize all data members with user-defined values• Three setter functions to set values for all data members individually• Three getter function to get value of all data members individually• A member function setSpeed( ) // takes integer argument for setting speedDerive a class named Convertible that contains • A data member top (of Boolean type) • A no-argument constructor to assign default value as “false” to top• A four argument constructor to assign values to all data-members i.e. carName, ignition, currentSpeed and top.• A setter to set the top data member up • A function named show() that displays all data member values of invoking objectWrite a main() function that instantiates objects of Convertible class and test the…write the definition of the class Rectangle containing: length: a private data member of type double width: a private data member of type double a default constructor that assigns the values 20 and 10 length and width, respctively. an overloading constructor that accepts two parameters of type double and assigns them to length and width. an overloading constructor that accepts one parameter of type double and assigns it to both length and width setLength: a member function that accepts a double parameter and assigns it to length if it is positive(gerater than zero). setWidth: a member function that accepts a double parameter and assigns it to width if it is positive(gerater than 0) getLength: a member function that accepts no parameter and returns the value of length getWidth: a meber function that accepts no parameters and returns the value of width getAre: a member function that accepts no parameters and returns the area of the rectangle.Create a Circle class with a centre (x,y) and radius r. Use parameterized constructor to initialize the radius and centre of a circle object. Write a copy constructor that copies the values of one circle object to another one. Use a member function to display the values x,y,r of a circle object. Allow a friend function to update the centre and radius of the circle. There should a static variable 'number_of_circles' and a static member function 'update_number_of_circles' which will update the 'number_of_circles' whenever an instance of a circle is created.
- Example 10-10 defined a class personType to store the name of a person. The member functions that we included merely print the name and set the name of a person. Redefine the class personType so that, in addition to what the existing class does, you can: Set the first name only. Set the last name only. Store and set the middle name. Check whether a given first name is the same as the first name of this person. Check whether a given last name is the same as the last name of this person.Design a class bookType that defines a book as a class. a. Each object of the class bookType will hold the following information about a book: title number of authors up to four authors publisher year published ISBN 13 (with dashes) price number of copies in stock (may be 0) b. Include the member functions to perform the various operations on objects of type bookType: Include individual get and set functions for all member variables. c. Add a member function to update the number of copies in stock. d. Add the appropriate constructors and a destructor (if one is needed). Ensure a default constructor is coded and the constructor initializes all data members. Remember, an array of classes uses a default constructor only. e. ALL member variables must be private and accessed through member functions. The main client program CANNOT access the variables directly. f. Ensure the class declaration and class implementation files are in separate header and code (.cpp) files. This assignment will…Given the following class declaration (with prototypes): class Carpet { private: double pricePerSqYd; public: Carpet(); void setPricePerYd(double p); void setDimensions(double l, double w); double getTotalPrice() const; }; Assume the class Carpet has been implemented. Assume the class Rectangle has been implemented. Rewrite the entire Carpet class declaration and add a member variable named size which is an instance of the Rectangle class.