answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Ivahew [28]
2 years ago
9

Assume that a program uses the named constant PI to represent the value 3.14. The program uses the named constant in several sta

tements. What is the advantage of using the named constant instead of the actual value 3.14 in each statement?
Computers and Technology
1 answer:
mihalych1998 [28]2 years ago
7 0

Answer:

The advantage for the above condition is as follows:-

Explanation:

  • If a user creates a defined constant variable and assigns a value on its and then uses that variable instead of the value, then it will a great advantage.
  • It is because when there is a needs to change the value of that variable, then it can be done when the user changes the value in one place. There is no needs to change the vale in multiple places.
  • But if there is a value in multiple places instead of a variable and there is no constant variable, then the user needs to change the value in multiple places.
You might be interested in
Write a statement that uses a conditional expression that determines if the credits variable is less than 0. If the condition is
gtnhenbr [62]

Answer:

The statement and the expression is "credits = credits<0?0 : credits;" for the above question.

Explanation:

  • The conditional expression is an expression that is used to determine the true and the false case. It works like the if and the else statement.
  • It has three parts which are shown above, in which the first part is to check the condition, the second part is excuted if the condition is true and the third part is executed if the condition is false. The variable is used to assign the value.
  • If any user provides the credit value and writes the above statement then the credit variable holds 0 for negative value and it holds the original value for any positive or zero value.
8 0
1 year ago
When you register to take classes, the registrar office pulls up a file full of information about you, including your contact in
FinnZ [79.3K]
What are your choices? My first answer would be a database but...
7 0
1 year ago
Using basic programming (for loops, while loops, and if statements), write two MATLAB functions, both taking as input:
borishaifa [10]

Answer:

For n = 100

  • (AB)x: 10100
  • A(Bx): 200

For n = 200

  • (AB)x: 40200
  • A(Bx): 400

For n = 400

  • (AB)x: 160400
  • A(Bx): 800

For n = 800

  • (AB)x: 640800
  • A(Bx): 1600

The faster approach is A(Bx)

Explanation step by step functions:

A(Bx) is faster because requires fewer interactions to find a result: for (AB)x you have (n*n)+n interactions while for A(Bx) you have n+n, to understand why please see the step by step:

a) Function for (AB)x:

function loopcount1 = FirstAB(A,B,x)  

 n = size(A)(1);

 AB = zeros(n,n);

 ABx = zeros(n,1);

 loopcount1 = 0;  

 for i = 1:n

   for j = 1:n

     AB(i,j) = A(i,:)*B(:,j);

     loopcount1 += 1;

   end

 end

 for k = 1:n

   ABx(k) = AB(k,:)*x;

   loopcount1 += 1;

 end

end

b) Function for A(Bx):

function loopcount2 = FirstBx(A,B,x)

 n = size(A)(1);

 Bx = zeros(n,1);

 ABx = zeros(n,1);

 loopcount2 = 0;  

 for i = 1:n

   Bx(i) = B(i,:)*x;

   loopcount2 += 1;

 end

 for j = 1:n

   ABx(j) = A(j,:)*Bx;

   loopcount2 += 1;

 end

end

5 0
2 years ago
Users report that the network access is slow. After questioning the employees, the network administrator learned that one employ
grigory [225]

Keeping the fact in mind that network access has been found to be slow and after questioning the employees, the network administrator learns that an employee downloaded a third-party application which turns out to be a scanning program for the printer.

<u>Explanation:</u>

The employee must have been unaware of the fact that the application was accompanied by a worm or a computer worm.

A computer worm is a type of malware that has a property to replicate itself and after infecting a particular computer increases its range and gets in the other computers working on the same network which is the main reason for reduced processing speed.

3 0
2 years ago
python (Business: check ISBN-10) An ISBN-10 (International Standard Book Number) consists of 10 digits: d1d2d3d4d5d6d7d8d9d10. T
iogann1982 [59]

Answer:

<em>The programming language is not stated;</em>

<em>However, I'll answer this question using C++ programming language</em>

<em>The program uses few comments; See explanation section for more detail</em>

<em>Also, the program assumes that all input will always be an integer</em>

#include<iostream>

#include<sstream>

#include<string>

using namespace std;

int main()

{

string input;

cout<<"Enter the first 9 digits of an ISBN as a string: ";

cin>>input;

//Check length

if(input.length() != 9)

{

 cout<<"Invalid input\nLength must be exact 9";

}

else

{

 int num = 0;

//Calculate sum of products

for(int i=0;i<9;i++)

{

 num += (input[i]-'0') * (i+1);    

}

//Determine checksum

if(num%11==10)

{

 input += "X";

 cout<<"The ISBN-10 number is "<<input;

}

else

{

 ostringstream ss;

 ss<<num%11;

 string dig = ss.str();

 cout<<"The ISBN-10 number is "<<input+dig;

}

}  

 return 0;

}

Explanation:

string input;  -> This line declares user input as string

cout<<"Enter the first 9 digits of an ISBN as a string: ";  -> This line prompts the user for input

cin>>input;  -> The user input is stored here

if(input.length() != 9)  { cout<<"Invalid input\nLength must be exact 9";  }  -> Here, the length of input string is checked; If it's not equal to then, a message will be displayed to the screen

If otherwise, the following code segment is executed

else  {

int num = 0; -> The sum of products  of individual digit is initialized to 0

The sum of products  of individual digit is calculated as follows

for(int i=0;i<9;i++)

{

num += (input[i]-'0') * (i+1);

}

The next lines of code checks if the remainder of the above calculations divided by 11 is 10;

If Yes, X is added as a suffix to the user input

Otherwise, the remainder number is added as a suffix to the user input

if(num%11==10)  {  input += "X";  cout<<"The ISBN-10 number is "<<input; }

else

{

ostringstream ss;

ss<<num%11;

string dig = ss.str();

cout<<"The ISBN-10 number is "<<input+dig;

}

}  

5 0
2 years ago
Other questions:
  • Why are digital calendars considered to be a convenient way to maintain a study schedule?
    10·2 answers
  • Social networking sites like Office Online, PayPal, and Dropbox are used to develop social and business contacts.
    6·2 answers
  • Compare the encryption algorithms found in s-tools: idea, mdc, des, and 3des.
    5·1 answer
  • Fill in the blank; "As well as their traditional role of computing data, computers are also extensively used for..."
    14·1 answer
  • The UML models operations by listing the operation name preceded by an access modifier. A(n) ________ indicates a public operati
    7·2 answers
  • What is the distance rn between the point of application of n⃗ and the axis of rotation? what is the distance rw between the poi
    15·1 answer
  • A program is divided into 3 blocks that are being compiled on 3 parallel computers. Each block takes an Exponential amount of ti
    6·1 answer
  • In below freezing conditions, keep your fuel level at least _________ full to keep moisture from freezing in your gas line.
    13·1 answer
  • What missing condition will give you the output shown?
    8·2 answers
  • The given SQL creates a Movie table with an auto-incrementing ID column. Write a single INSERT statement immediately after the C
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!