Consider the following function: def squareArea(sideLength) : return sideLength ** 2 What is the value of squareArea(3)? _____ a.2 b.3 c.6 d.9
Q: Q2: Complete the main programs and writing its functions, classes and find the Area for each shape:…
A: The following steps need to be taken for the given program: Create a Triangle class with a…
Q: Consider this Date type. Write a factory function to ereate a date. Throw invalid_argument…
A: C++ function is given below
Q: Create a Rectangle class to hold length and width in double variables. Write following functions to…
A: code: #include<bits/stdc++.h>using namespace std; //Class Rectangleclass Rectangle{ public:…
Q: 2) You must implement the pieces of the below classes on the following pages. You only should…
A: Given: class Point {public:Point();Point(double, double);double getX() const;double getY()…
Q: Write a student class that will keep track of the grades of students and generates a final mark.…
A: #include<stdio.h> #include<conio.h> void main () { float m1,m2,m3; float per,avg;…
Q: The television seller wants to control the television inventory in his television store through a…
A: I have tried to explain all the steps in the code with various comments.
Q: A void returning function with no parameters that prints "hello how are you?"
A: As per the answering guidelines solving the first question completely. Also since programming…
Q: 2) You must implement the pieces of the below classes on the following pages. You only should…
A: To Complete the given application i have implemented all the methods of the Point and Rectangle…
Q: Demonstrate your class works with a main() function that instantiates an array of three Rectangle…
A: #include <iostream>using namespace std;class Rectangle{private: double width; double…
Q: This question involves the implementation of the MultipleGenerator class which generates a random…
A: I give the code in java along with code screenshot and output screenshot
Q: Which keyword is used to define friendship relationship between a function and a class? Select one:…
A: Answer: c. friend
Q: Q2: Complete the main programs and writing its functions, classes and find the Area for each shape:…
A: Java programming is the object oriented programming languages. It is used to create the web…
Q: Write a function called my_circle that requires two Point instances as parameters. There are two…
A: Note: As no programming language is mentioned, therefore answering in python. Input : Input two…
Q: Write a program that reads Restaurant’s detail. It should also find and print the total number of…
A: syntax of struct in c struct <struct-name> { //attributes list with data type };
Q: IT provides best solutions for manual work that makes life easier .Suppose a university war manage…
A: The C program is given by #include<stdio.h> struct Student { char* Name; int RegId; char*…
Q: Write a function that inserts a white space between every instance of a lower character followed…
A: Step-1: Start Step-2: function insertWhitespace(string) Step-2.1 Declare variable newStr = "", temp…
Q: 1. Write a function definition for a Constructor to initialize all data members. 2. Write a function…
A: Constructor is a function which is having same name as class and this is the first function that…
Q: Write a programthat contain Constructors, get data, print data and 3 more functions (C++ coding)
A: #include <iostream>#include <string> using namespace std; class Car { // The…
Q: What am I doing wrong? I am supposed to do a class of Student, enter the functions and display all…
A: Task : C++ Code. The task is to debug the code and correct the errors.
Q: Computer Science Write in Javascript please and use high order functions liek map or filter or…
A: Introduction: The function is a collection of instructions to perform a particular task. Syntax:…
Q: main() function is given below. Based on this function, your task is to write complete code required…
A: A main() function is given below. Based on this function, your task is to write complete code…
Q: Love Get an input from a user with the question: Who is your favorite professor? If the input is…
A: Note :- You have not mention the language of the program so, i'm answering your question in C++…
Q: We have noticed that the system floating point number will some times lose information. For this…
A: Actually c++ is a powerful general purpose language.
Q: With the coding below ,Complete the part labelled ‘//2 a) i’, write the constructor function that…
A: The question is writing C++ code for 2a)i and 2a)ii.
Q: You must implement the pieces of the below classes on the following pages. You only should implement…
A: The methods that needs to be implemented are: Rectangle(const Point &ll, const Point &ur);…
Q: te a java program that contains variables to hold employee data like; employeeCode, employeeName and…
A: Q: Code the given problem in Java
Q: This project Object Oriented Programming. We need to C++ code in multiple Files: Question: In…
A: Answer is given below .
Q: IN SCALA COULD YOU COMPLETE THE FOLLOWING FUNCTIONS: // Regular Expressions abstract class Rexp…
A: def nullable (r: Rexp) : Boolean = r match { case NULL => false case EMPTY => true case…
Q: Create a class Huge Int to provide "big number operations" for the following main function: int…
A: program: #include <iostream>#include<string>#include <bits/stdc++.h> using…
Q: Code Example 4-2 def get_volume (width, height, length=2): volume = width * height * length def main…
A: The correct solution is given below with an explanation
Q: Write a program that reads Restaurant.’s detail. It should also find and print the total number of…
A: #include<iostream>#include<string.h>using namespace std; struct CusType{ private:…
Q: Write a complete C# console application in which you will have to store data of Employee in 1…
A: Program approach:- Create an employee array. Function to input employee details. Method to display…
Q: USING C++ Using the class declaration below, implement the functions: class Rectangle {…
A: According to the information given:- We have to create and find the area of the rectangular space…
Q: Write a complete C# console application in which you will have to store data of Employee in 1…
A: Program plan:- Create an employee array. Call functions. Function to input employee details. Method…
Q: Assume rectangle class has a friend function called "getArea(rectangle)". void main() rectangle…
A: Given:
Q: QUESTION 15 Python supports the creation of anonymous functions at runtime, using a construct called…
A: Python supports the creation of anonymous functions which means that functions that are not bound to…
Q: e (.h file) of a class Counter containing: A data member counter of type int. A data member named…
A: We need to define a Counter class in counter.cpp and main.cpp we need to write the code to execute…
Q: Write a program to help a university system to store records for its employee. You have to perform…
A: Code: #include <string>#include <iostream>#ifndef EMPLOYEE_H#define EMPLOYEE_H using…
Q: Write a function that inserts a white space between every instance of a lower character followed…
A: function insertWhitespace(s) { var output = "" s.split('').forEach((chr,i) => { if (i > 0…
Q: Write a program which have a class named as “Student”, while the data members of the class are,…
A: Note:- we are allowed to answer only one question according to policy. char name[10], int age;…
Q: (Java) Write a program that takes two double command line arguments representing the sides of a…
A: Step-1: Start Step-2: Declare two variables side1 and side2 Step-3: Take two inputs from user for…
Q: (b). Implement a C++ dass named Time. The class should contain: Three int type data fields named…
A: Below is the required code in C++ and sample output:
Q: This question involves the implementation of the MultipleGenerator class which generates a random…
A: Since the question doesn't mention the programming language use to code the problem so I am using…
Q: Write a console application with several functions that deal with a two-dimensional array of…
A: #include<iostream>#include<time.h>#include<stdlib.h>using namespace std; bool…
Q: Write a program in java a class Box having three private data members (width, depth, height) The…
A: File name: “Box.java” public class Box { private double width; private double depth;…
Q: rlined and followed by a "TODO: implement" comment. An example main function is provided to help you…
A: Below the program I have complete the task according to given discrimination.
Q: In an earlier lesson, you wrote the "accessor" functions getHours and getMinutes which return the…
A: #ifndef TIME_H #define TIME_H #include <iostream> #include <iomanip> struct Time {…
Q: Consider the function definition: void GetNums(int howMany, float& alpha, float& beta)…
A: When GetNums function is calledWhen the GetNums function is called, then at first the run time…
Consider the following function:
def squareArea(sideLength) :
return sideLength ** 2
What is the value of squareArea(3)? _____
a.2
b.3
c.6
d.9
Trending now
This is a popular solution!
Step by step
Solved in 5 steps with 2 images
- Implement the Rectangle class as discussed this week. Use the class declaration below. Your job is to implement the functions. Implement the missing functions yourself. class Rectangle{ private: double width; double length; char *name; void initName(char *); public://constructorsRectangle();Rectangle(double, double, char*);//destructor ~Rectangle(); void setWidth(double); void setLength(double); void setWidth(char *); void setLength(char *); void setName(char *); double getWidth() const; double getLength() const; void printName() const { cout << name; }}; A few notes on the functions: initName(char *): this is a private member function. It should be the only function which dynamically allocates a char array to hold the name. setName(char *): this is a public member function which changes the name of the rectangle to a new name. It does not dynamically allocate memory, it only changes name. Demonstrate your class works…Write a program in java a class Box having three private data members (width, depth, height) The class has three constructors which are having no parameter – for setting values to zero or null. having three parameters for assigning values to height, width, depth respectively. Overload the above constructor and use this keyword to set the values of width, height & depth. Provide getters/setters for data members. Write a function calculateVolume() which calculates the volume of the box. Write test Application that demonstrates the Box class by calling all the three constructors and method, creating a Create Box object, and then displaying the Box’s width , height, length and volumeA main() function is given below. Based on this function, your task is to write complete code required to run the main() function successfully. Class Rectangle{Private:int len;int width;static int objectCount;public:All functions that are needed. };int main(){int len;int width;cin>>len;cin>>width;Rectangle r1(len,width);Rectangle r2(4,6);Rectangle r3();Rectangle r4();Rectangle r5();r3 = r1 + r2;r4 = r1 - r2;r5 = r1 * r2;if(r3 == r4){cout<<"Both are equals"<<endl;}else if(r3 > r4){cout<<"r3 is greater than r4"<<endl;}else if(r3 < r4){cout<<"r4 is greater than r3"<<endl;} return 0;}
- def parrot(voltage, state="a stiff", action="voom", p_type="Norwegian Blue"): print("-- This parrot wouldn't", action, end=" ") print("if you put", voltage, "volts through it.") print("-- Lovely plumage, the", p_type) print("-- It's", state, "!") parrot(100, action="vroom") #6 Q4.1 Default Values Which of the parameters use their default values in the function call on line 6. parrot(100, action="vroom") #6 Choice 1 of 4:state Choice 2 of 4:voltage Choice 3 of 4:p_type Choice 4 of 4:action Select all of the ways that the parameter action can be assigned a value. Choice 1 of 3:positional argument Choice 2 of 3:keyword argument Choice 3 of 3:default value Q4.3 Call the Function Call the function such that voltage is a positional argument, state is a keyword argument, p_type is a keyword argument, and action is a default argument. (voltage, state="a stiff", action="voom", p_type="Norwegian Blue")Give solution in C ++ Language with secreenshoot of source code. Part 01In this task, you need to do the following:• Write a function named displayMessage() that takes user name as input in character array and then shows greetings• Now take the name input in main() and pass the name as an argument to displayMessage() function• Change the displayMessage() method such that it returns the number of characters after displaying the greetings part 02Write a function power that takes two parameters a and b. And it returns the power as ab.With the coding below ,Complete the part labelled ‘//2 a) i’, write the constructor function that outputs “~~Building Created~~” and labelled //2 a) ii’, write the codes to define function findLargest(…). This function will receive an array of 5 Room objects and display the area width x length) of each object. The largest room area will be determined and displayed accordingly. #include <iostream> using namespace std; class Room { int width, length; public: // 2 a)to complete void setData (int L, int T) { width = L; length = T; } friend class Building; } ; class Building { string name; public: Building() { name = "Building"; cout<<"----Buiding name : "<<name<<"-------"<<endl; } // 2 a)to complete }; int main() { Building B1; Room r[5]; int i = 0, x, y; while( i < 5 ) { cout<<"Enter the tables' width and length :\n"; cin>>x>>y; r[i]. setData(x,y); i++; } B1.findLargest(r); return 0; }
- Q2) Write a C# class Factors having function static int CountOddFactors(int n) that would return count of odd factors of parameter n. For instance, odd factors of 20 are: 1 and 5, and odd factors of 30 are 1, 3, 5 and 15. Call this static function in main function that is in another class. SUBJECT:CSHARP(VISUAL PROGRAMMING)Moving Between Rooms - Navigation In this assignment, you will be working with a given "rooms" dictionary and associated constants to create a simple text-based game. Your main task is to develop a function that allows the player to navigate through the rooms based on the given specifications. You need to implement the function found in the starter code to the right The function should take into account the following conditions: If the direction leads to an exit, set the next room to the exit and the message to "Goodbye". If the direction is invalid, set the next room to the current room and the message to "No such direction". If the direction is valid, but you cannot go that way, set the next room to the current room and the message to "You bumped into a wall". If the direction is valid and you can go that way, set the next room to the room in that direction and the message to "Empty". To help you understand how the function will be integrated into the gameplay loop, the following…Implement the following function which takes the radius of a circle as one of its parameters and stores the circumference and area using the other two parameters.void calcCircleInfo(int radius, int *circumference, int *area)
- Write a C++ console application to find out a number is prime or non-prime. According to mathematics: “A prime number is a natural number greater than 1 that is not a product of two smaller natural numbers. A natural number greater than 1 that is not prime is called a composite number. For example, 5 is prime because the only ways of writing it as a product, 1 × 5 or 5 × 1, involve 5 itself”. You should define a function which takes an integer as a parameter and returns it as a prime or not. Sample input: 13 Output: Prime 27 Output: Non- primeYou must implement the pieces of the below classes on the following pages. You only should implement the functions that are underlined and followed by a "TODO: implement" comment. An example main function is provided to help you test your solution. You may assume the other functions have been implemented correctly, and you may use them. class Point { public: Point(); Point(double, double); double getX() const; double getY() const; void setX(double); void setY(double); void move(double, double); private: double xCoord; double yCoord; public: // output format: (x,y) void display() const; }; class Rectangle { public: Rectangle(); Rectangle(const Point &ll, double w, double h); Rectangle(const Point &ll, const Point &ur); // TODO: implement // Output format - LL:(x,y) W:width H:height…You must implement the pieces of the below classes on the following pages. You only should implement the functions that are underlined and followed by a "TODO: implement" comment. An example main function is provided to help you test your solution. You may assume the other functions have been implemented correctly, and you may use them. class Point { public: Point(); Point(double, double); double getX() const; double getY() const; void setX(double); void setY(double); void move(double, double); private: double xCoord; double yCoord; public: // output format: (x,y) void display() const; }; class Rectangle { public: Rectangle(); Rectangle(const Point &ll, double w, double h); Rectangle(const Point &ll, const Point &ur); // TODO: implement // Output format - LL:(x,y) W:width H:height void…