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: Consider the following class and answer questions after this class #include using…
A: Note: The answers of the first three subparts are shown below. Please repost the remaining subpart…
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: 2) You must implement the pieces of the below classes on the following pages. You only should…
A: //constructor #1Rectangle::Rectangle(){ll = Point();w = 0;h = 0;}
Q: Given the declaration const int SIZE = 10; float x[SIZE]; write the declaration for a void…
A: First we need to understand what is X[size] means. Suppose size = 10; ==> float x[10] will be a…
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: 2. Write a function that draws a similar grid with four rows and four columns. Solution:…
A: To perform a specific task some set of grammatical rules and vocabulary used for give instruction to…
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: Assume pointer P points to object of class1 and pointer Q points to object of class2, one of the…
A: Assume pointer P points to object of class1 and pointer Q points to object of class2 one of the…
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: 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: The program has to be in c++ Can someone help with this program? Create a Student class with…
A: A Class is a user defined data-type which has data members and member functions. Member functions…
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: 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: 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: Q3: Write a program in C++ using OOP to create a class (A), that contain integer number (x), contain…
A: #include <iostream> using namespace std; //creating class A class A{ public:…
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: * Which among the following is not true ?for polymorphism Ease in readability of program O It is…
A: Which among the following is not true for polymorphism? Increases overhead of function definition…
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 {…
12) 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 2 steps
- Exercise 9-6: Pass by Reference and Pass by Address In this exercise, you use what you have learned about passing arguments by reference and by address to functions to answer Questions 1-2. 1. Given the following variable and function declarations, write the function call and the function's header a. double price 22.95, increase .10; void changePrice(doubl e&, double); b. double price 22.95, increase .10; void changePrice (double*, double); c. int age = 23; void changeAge(int&); d. int age 23; void changeAge (int*); 2. Given the following function headers and variable declarations, write a function call: a. custNames [] = {"Perez", "Smith", "Patel", "Shaw"}; balances [] = {34.00, 21.00, 45.50, 67.00); void cust (string name [], double bal []) b. int values [] = {1, 77, 89, 321, -2, 34}: void printSum (int nums [])6...Consider the definition of the function main. int main() { double rate, hours, amount; . . . } Each of the functions described must have the appropriate parameters to access these variables. Write the following definitions: a. Write the definition of the function getHoursRate that prompts the user to input the hours worked and rate per hour to initialize the variables hours and rate of the function main. b. Write the definition of the value-returning function payCheck that calculates and returns the amount to be paid to an employee based on the hours worked and rate per hour. The hours worked and rate per hour are stored in the variables hours and rate, respectively, of the function main. The formula for calculating the amount to be paid is as follows: For the first 40 hours, the rate is the given rate; for hours over 40, the rate is 1.5 times the given rate. c. Write the definition of the function printCheck that prints the hours worked, rate per hour, and the salary. d. Write the…Q. Please solve this C++ program and show all the steps. (kindly do not use any advanced coding or coding info from any other program. Don't copy from other sources too) a) Add a new function convMonth to the class Date that returns the month in letters (e.g., January, February, etc.). b)Add a function that prints the date using the following format: Month dd, yyyy . Example, January 21, 2023 c) Test the new functions of the class Date by creating dynamically (i.e., using pointers) two objects of the class Date and invoking the new member functions on both objects. Deliverables: date.h, date.cpp, testdate.cpp. (any description or thought process of this coding problem will be really useful, particularly in part c) please let me know if there's any way I could contact you for further assistance,( please!) Thank you !
- 11.2.1: Driving cost - functions. Write a function DrivingCost with parameters drivenMiles, milesPerGallon, and dollarsPerGallon, that returns the dollar cost to drive those miles. All items are of type float. Ex: If the function is called with 50 20.0 3.1599, the function returns 7.89975. Define that function in a program whose inputs are the car's miles/gallon and the gas dollars/gallon (both floats). Output the gas cost for 10 miles, 50 miles, and 400 miles, by calling your DrivingCost function three times. Ex: If the input is 20.0 3.1599, the output is: 1.57995 7.89975 63.198 Note: Small expression differences can yield small floating-point output differences due to computer rounding. Ex: (a + b)/3.0 is the same as a/3.0 + b/3.0 but output may differ slightly. Because our system tests programs by comparing output, please obey the following when writing your expression for this problem. In the DrivingCost function, use the variables in the following order to calculate the cost:…5.11 LAB: User-Defined Functions: Max and min numbers Coral language only please Define a function named LargestNumber that takes three integers as parameters and returns the largest integer. Define a second function named SmallestNumber that takes three integers as parameters and returns the smallest integer. Then, write a main program that reads three integers as inputs, calls functions LargestNumber() and SmallestNumber() with the inputs as arguments, and outputs the largest and the smallest of the three input values. Ex: If the input is: 7 15 3 the output is: largest: 15 smallest: 3 Your program should define and call two functions:Function LargestNumber(integer num1, integer num2, integer num3) returns integer largestNumFunction SmallestNumber(integer num1, integer num2, integer num3) returns integer smallestNumConsider the function definition: void GetNums(int howMany, float& alpha, float& beta) { int i; beta = 0; for (i = 0; i < howMany; i++) { beta = alpha + beta; } } Describe what happens in MEMORY when the GetNums function is called.
- Instructions: 1. Submission deadline6/1/20232. If you copy from others zero will be given. 3. Assignment should be written with neat handwriting on proper A4 papers. 4. Upload the handwritten assignment in the blackboard, and submit the written Assignment physically. Q1) Consider the following code: intn=10, m:m=2⋅(n+m)What is the values ofmandn? Answer: Q2) Determine the error and rewrite the correct code for the following function declaration; char Total(intx,y, intz) \{ ints=x+y+z; returns; Answer: Q3) Exercise: Write a function that take your name and print a message say: Welcome, your name. Answer: Q4) Consider the following statements: struct studentName string first; string last; i; int main0 studentName st1, st2; Mark the following statements as valid or invalid. If a statement is invalid, explain why. a. st1.first="William"; b. st 1.last="Smith"; c. cin≫>st2; d. coutC++code to store the first component of products as follows: partName :printer, price : 150 c. Write…36- Consider the following function call: min(x, y) What is the function name and what is the first argument? a. The function name is min and the first argument is x b. Functions in Python don't have names (they're anonymous functions), but the first argument is x. c. The function name is min, but you need to see the function definition to determine the arguments. d. Functions in Python don't have names (they're anonymous functions) and you need to see the function definition to determine the argumentsvoid getChar(char& c, istream& infile, int& i){ infile.get(c); if (c == '\n') i++;} COULD YOU REWRITTE THE FUNCTION ABOVE. AND BY REWRITE. I MEAN CHANGE THE FUNCTION NAME, PARAMETERS, AND ITS IMPLEMENTATION. HOWEVER, THE FUNCTION MUST STILL ACHEIVE THE SAME GOAL.
- Consider the function definition: void Demo (int intVal, float& floatVal ) { intVal = intVal * 2; floatVal = float(intVal) + 3.5; } a. Suppose that the caller has variables int myInt and float myFloat whose values are 20 and 4.8, respectively. What are the values of myInt and myFloat after return from the following function call? Demo(myInt, myFloat); myInt: myFloat: b. Also, describe what happens in MEMORY when the Demo function is called. Think about the by reference and by value parameters.Assume that the declarations for two functions look as follows: int Function1(double x); 2.void Function2(double x); Give some sample code that would show how each function could be used.C++ 1. Given this function:int functionThree(int& v){ v = v * 2; cout << "Var val = " << v << endl; return (v + 1);} What is the output from this code? (Assume it is in main) int v = 5; cout << "Var v = " << v-- << endl; cout << functionThree(v) << endl; cout << "Var v = " << v << endl; _______________________________________________________________________ 2. Given this function: void functionTwo(int val){ cout << "Var val = " << val << endl; val--; cout << "Var val = " << val << endl;}What is the output from this code? (Assume it is in main) int v = 5; cout << "Var v = " << v << endl; functionTwo(v); cout << "Var v = " << v << endl; __________________________________________________________________ 3. Given this function: void functionOne(int v){ v = 10; cout << "Var v = "…