Answer:
Follows are the code to this question:
#include<iostream>//defining header file
#include<string>//defining header file
using namespace std;
const double Pi =3.141592653589793238463;//defining double constant variable
class Planet
{
private:
string planet_name;//defining string variable
double radius;//defining double variable
public:
Planet()//defining default constructor
{
this->planet_name="";//use this keyword to hold value
this->radius=0.0;//use this keyword to hold value
}
Planet(string name, double radius)//defining parameterized constructor
{
this->planet_name = name;//use this keyword to hold value
this->radius=radius;//use this keyword to hold value
}
string getName() const//defining getName method
{
return this->planet_name;//use return keyword for return string value
}
double getRadius() const//defining getRadius method
{
return this->radius;//use return keyword for return radius value
}
double getVolume() const //defining getVolume method
{
return 4*radius*radius*radius*Pi/3;////use return keyword for return volume value
}
};
int maxRadius(Planet* planets, int s)//defining a method maxRadius that accept two parameter
{
double maxRadius=0;//defining double variable
int index_of_max_radius=-1;//defining integer variable
for(int index=0; index<s; index++)//defining for loop for calculate index of radius
{
if(planets[index].getRadius()>maxRadius)//defining if block to check radius
{
maxRadius = planets[index].getRadius();//use maxRadius to hold value
index_of_max_radius=index;//hold index value
}
}
return index_of_max_radius;//return index value
}
int main()//defining main method
{
Planet planets[5];//defining array as class name
planets[0] = Planet("On A Cob Planet",1234);//use array to assign value
planets[1] = Planet("Bird World",4321);//use array to assign value
int idx = maxRadius(planets,2);//defining integer variable call method maxRadius
cout<<planets[idx].getName()<<endl;//print value by calling getName method
cout<<planets[idx].getRadius()<<endl;//print value by calling getRadius method
cout<<planets[idx].getVolume()<<endl;//print value by calling getVolume method
}
Output:
Bird World
4321
3.37941e+11
Explanation:
please find the complete question in the attached file:
In the above-program code, a double constant variable "Pi" is defined that holds a value, in the next step, a class "Planet" is defined, in the class a default and parameter constructor that is defined that hold values.
In the next step, a get method is used that return value, that is "planet_name, radius, and volume".
In the next step, a method "maxRadius" is defined that accepts two-parameter and calculate the index value, in the main method class type array is defined, and use an array to hold value and defined "idx" to call "maxRadius" method and use print method to call get method.
The state way of grading drivers is called what?
*
To create a public key signature, you would use the ______ key.
Answer:
To create a public key signature, you would use the _private_ key.
Explanation:
To create a public key signature, a private key is essential to enable authorization.
A private key uses one key to make data unreadable by intruders and for the data to be accessed the same key would be needed to do so.
The login details and some important credentials to access user data contains both the user's public key data and private key data. Both private key and public key are two keys that work together to accomplish security goals.
The public key uses different keys to make data readable and unreadable.
The public key is important to verify authorization to access encrypted data by making sure the access authorization came from someone who has the private key. In other words, it's a system put in place to cross-check the holder of the private key by providing the public key of the encrypted data that needed to be accessed. Though, it depends on the key used to encrypt the data as data encrypted with a public key would require a private key for the data to be readable.
Custom function definitions:________.
A. Must be written before they are called by another part of your program
B. Must declare a name for the function
C. Must include information regarding any arguments (if any) that will be passed to the function
D. all of the above
Answer:
D. all of the above
Explanation:
A option is correct and function definition must be written before they are called by another part of your program. But in languages such as C++ you can write the prototype of the function before it is called anywhere in the program and later write the complete function implementation. I will give an example in Python:
def addition(a,b): #this is the definition of function addition
c = a + b
return c
print(addition(1,3)) #this is where the function is called
B option is correct and function definition must declare a name for the function. If you see the above given function, its name is declared as addition
C option is correct and function definition must include information regarding any arguments (if any) that will be passed to the function. In the above given example the arguments are a and b. If we define the above function in C++ it becomes: int addition( int a, int b)
This gives information that the two variables a and b that are parameters of the function addition are of type int so they can hold integer values only.
Hence option D is the correct answer. All of the above options are correct.
Write a program that computes and display the n! for any n in the range1...100
Answer:
const BigNumber = require('bignumber.js');
var f = new BigNumber("1");
for (let i=1; i <= 100; i++) {
f = f.times(i);
console.log(`${i}! = ${f.toFixed()}`);
}
Explanation:
Above is a solution in javascript. You will need a bignumber library to display the numbers in full precision.
Write a method called min that takes three integers as parameters and returns the smallest of the three values, such that a call of min(3, -2, 7) would return -2, and a call of min(19, 27, 6) would return 6. Use Math.min to write your solution.
Answer:
public class Main
{
public static void main(String[] args) {
System.out.println(min(3, -2, 7));
}
public static int min(int n1, int n2, int n3){
int smallest = Math.min(Math.min(n1, n2), n3);
return smallest;
}
}
Explanation:
*The code is in Java.
Create a method named min that takes three parameters, n1, n2, and n3
Inside the method:
Call the method Math.min() to find the smallest among n1 and n2. Then, pass the result of this method to Math.min() again with n3 to find the min among three of them and return it. Note that Math.min() returns the smallest number among two parameters.
In the main:
Call the method with parameters given in the example and print the result
Methods are named program statements that are executed when called/invoked.
The method in Python, where comments are used to explain each line is as follows:
#This defines the method
def mmin(a,b,c):
#This calculates the smallest of the three values using math.min
minNum = min(a,b,c)
#This prints the smallest value
return minNum
Read more about methods at:
https://brainly.com/question/14284563