1answer.
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
AfilCa [17]
3 years ago
6

Which component of a computer is its input device and what role does it play in a document?

Computers and Technology
1 answer:
hichkok12 [17]3 years ago
3 0

a keyboard is a imput device that helps in writing in a document.

You might be interested in
Assume you are given a boolean variable named isNegative and a 2-dimensional array of ints that has been created and assigned to
Anon25 [30]

Answer:

#include <iostream>

using namespace std;

int main(){

   int rows, cols;

   bool isNegatives;

   cout<<"Rows: ";

   cin>>rows;

   cout<<"Columns: ";

   cin>>cols;

   int a2d[rows][cols];

   for(int i =0;i<rows;i++){

   for(int j =0;j<cols;j++){

       cin>>a2d[i][j];}    }

   int negatives, others = 0;

   for(int i =0;i<rows;i++){

   for(int j =0;j<cols;j++){

       if(a2d[i][j]<0){

           negatives++;}

       else{

           others++;}}    }

   if(negatives>others){

       isNegatives = true;}

   else{

       isNegatives = false;}

   cout<<isNegatives;  

   return 0;

}

Explanation:

For clarity and better understanding of the question, I answered the question from the scratch.

This line declares number of rows and columns

   int rows, cols;

This line declares the Boolean variable

   bool isNegatives;

This line prompts user for rows

   cout<<"Rows: ";

This line gets the number of rows

   cin>>rows;

This line prompts user for columns

   cout<<"Columns: ";

This line gets the number of columns

   cin>>cols;

This line declares the array

   int a2d[rows][cols];

This line gets user input for the array

<em>    for(int i =0;i<rows;i++){</em>

<em>    for(int j =0;j<cols;j++){</em>

<em>        cin>>a2d[i][j];}    }</em>

This line declares and initializes number of negative and others to 0

   int negatives, others = 0;

The following iteration counts the number of negatives and also count the number of non negative (i.e. others)

<em>    for(int i =0;i<rows;i++){</em>

<em>    for(int j =0;j<cols;j++){</em>

<em>        if(a2d[i][j]<0){</em>

<em>            negatives++;}</em>

<em>        else{</em>

<em>            others++;}}    }</em>

This checks of number of negatives is greater than others

   if(negatives>others){

If yes, it assigns true to isNegatives

       isNegatives = true;}

   else{

If otherwise, it assigns false to isNegatives

       isNegatives = false;}

This prints the value of isNegatives

   cout<<isNegatives;  

<em>See attachment</em>

Download cpp
5 0
3 years ago
When you are writing, which of the following can you do to help your
natka813 [3]

Answer:

use transition words

Explanation:

that's the best answer of all the choices

5 0
2 years ago
Which of the following is correct implementation code for the compareTo method in the ExpertPlayer class?
pochemuha

Complete Question:

The complete question is shown in uploaded image one and two.

Answer:

Answer is E

Explanation:

In order to gain understanding of this answer let look at  each code line by line

Considering Method one :

public int compareTo(Object obj)

{

This is the deceleration of the method.

ExpertPlayer rhs = (ExpertPlayer) obj;

On this line of code above an object (obj) that is passed into the method ( compareTo)is converted to type ExpertPlayer and is being assigned to a variable(rhs) of type ExpertPlayer

if(myRating ==  rhs.myRating) return 0;

else if(myRating < rhs.myRating) return 1;

else return 1;

}

This if conditional statement above will comparing the private variable myRating defined on ExpertPlayer with the private variable on the instance of the ExpertPlayer(i.e rhs.myRating)

some might ask why is compareTo method  accessing myRating which is private variable without getters or setters method. This is because the method (compareTo )and the variable(myRating) are defined in the  same class.

Looking at  this conditional statement we see that

if myRating == rhs.Rating it will return 0

if myRating < rhs.Rating it will return -1 a negative value

if myRating > rhs.Rating it will return 1 a positive value

Considering Method two

public int compareTo(Object obj)

{

As usual this code above is the deceleration of the method.

ExpertPLayer rhs = (ExpertPlayer) obj;

On this line of code above an object (obj) that is passed into the method ( compareTo)is converted to type ExpertPlayer and is being assigned to a variable(rhs) of type ExpertPlayer

return myRating – rhs.myRating;

}

On this line of code above a variable of an instance of ExpertPlayer class (i.e rhs.myRating) is subtracted from a private variable ( myrating) in ExpertPlayer class

Now looking at this code we see that if they are equal(i.e if myrating is equal to rhs.myRating) 0 will be returned

if myRating is less than rhs.myRating a negative value is returned

and if myRating is greater than rhs.myRating a positive value is return

comparing this with the first method we see that they are the same.

Considering Method Three

public int compareTo(Object obj)

{

As usual this code above is the deceleration of the method.

ExpertPLayer rhs = (ExpertPlayer) obj;

On this line of code above an object (obj) that is passed into the method ( compareTo)is converted to type ExpertPlayer and is being assigned to a variable(rhs) of type ExpertPlayer

if (getName().equals(rhs.getName()))

       return 0;

   else if (getName().compareTo(rhs.getName()) < 0)

       return -1;

   else

       return 1;

}

On the above snippet of code  myName a private variable gotten using getName() method from the HumanPlayer class which extended by ExpertPlayer class is compared with the myName variable of the instance of ExpertPlayer (i.e rhs) gotten using rhs.getName()

looking at this code above we see that it produces the same result as method one and two in that if the two compared items are the same it will return 0, if  getName() is less than rhs.getName() it will return -1 ,which is a negative value, and

if getName() is greater than rhs.getName() it will return 1 which is a positive value.

8 0
3 years ago
Write an expression that whose value is the fifth character of the string name.
Anuta_ua [19.1K]
Int j;
j="name"[4];
//   you   could  do
j=0;   //  since name   has four letters  the fifth  character is the terminating 0
now  if the string  name is  name
you   could do
j=name[4];  // or even    4[name] 

5 0
3 years ago
Computers represent color by combining the sub-colors red, green, and blue (rgb). Each sub-color's value can range from 0 to 255
Effectus [21]

Answer:

<em>The programming language is not stated; However, I'll answer the question using C++ programming language, </em>

<em>This program uses comments for explanations  </em>

<em>Program starts here</em>

#include<iostream>

using namespace std;

int main()

{

//Declare Array

int colorcode[3],graycode[3];

//Prompt user for color code

cout<<"Enter Color Code (One on a line)"<<endl<<"Inout Range is 0 to 255"<<endl;

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

{

 ccode:  

 cout<<"Enter Color Code "<<i+1<<": ";

 cin>>colorcode[i];

 if(colorcode[i]<0 || colorcode[i]>255)

 {

  cout<<"Input Range is 0 to 255"<<'\n';

  goto ccode;

 }

}

//Initialize smallest to colorcode[0]

int smallest = colorcode[0];

//Determine smallest

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

{

 if(colorcode[i]<smallest)

 {

  smallest = colorcode[i];

 }

}

//Determine Graycode

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

{

 graycode[i] = colorcode[i] - smallest;

}

//Display Result:

cout<<"Color Code: "<<"(";

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

{

 if(i!=2)

 {

 cout<<colorcode[i]<<",";  

 }

 else

 {

  cout<<colorcode[i]<<")"<<endl;  

 }  

}

cout<<"Gray Code: "<<"(";

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

{

 if(i!=2)

 {

 cout<<graycode[i]<<",";  

 }

 else

 {

  cout<<graycode[i]<<")"<<endl;  

 }  

}

return 0;

}

8 0
3 years ago
Other questions:
  • If the wrong server edition is installed, what command can be used to change to a different edition?​
    5·1 answer
  • Using C++, Write a full class definition for a class named Acc1, containing no constructors, functions, or data members (i.e., a
    12·2 answers
  • Chris wants to guarantee that the instructions within the loop are executed one time regardless of thestatus of a condition. Whi
    9·1 answer
  • When you see a yield sign what do you do?
    8·1 answer
  • What version of android did nexus one run?
    14·1 answer
  • Which of the following is not a compilation error? Group of answer choices a. Placing a semicolon at the end of the first line o
    13·1 answer
  • Assignment 1: silly sentences edhesive
    7·1 answer
  • Carmina works at a fast-food restaurant. During the slow afternoon hours, Carmina always find projects to keep her busy, like wa
    6·1 answer
  • Color.
    9·1 answer
  • The formula in cell C9 is B9*F10. On copying this formula to cell Z9, what will be the formula​
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!