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
timofeeve [1]
2 years ago
11

Assignment 4 evens and odds

Computers and Technology
1 answer:
Viefleur [7K]2 years ago
4 0

I've added my own code in a picture below. I didnt really notice any error, which would cause problems in your code. The main issues I had with your code is purely readability. You should start using the format function along with the curly brackets to concatenate variables into strings. You should also start doing even += 1 instead of even = even + 1. I also tweaked your range function. Simply putting n makes it much easier to read and understand.

You might be interested in
How many days till earth ends
expeople1 [14]
Several Billion years
5 0
3 years ago
You can upgrade a cpu by adding registers and cache memory to it. <br> a. True <br> b. False
sesenic [268]
False, to upgrade a CPU, you need to replace the CPU with a better CPU.
8 0
3 years ago
Write a class named Averager containing: An instance variable named sum of type integer, initialized to 0. An instance variable
vladimir1956 [14]

Answer:

The answer to this question can be given as:

Class definition:  

public class Averager  //define class Average.

{

private int sum = 0;

 //define variable sum.

private int count = 0;

 //define variable count.  

public int getSum() //define function getSum().

{

return sum;  //return value.

}

public void add(int x)

//define function add().

{

sum = sum + x;   //calculate sum

count=count+1; //increase value of count.

}

public int add(int x)

 //define function add().

{

return count;  //return value.

}

public double getAverage()  //define function getAverage().

{

return (double)sum/count;  //return value

}

}

Explanation:

The above class definition can be described as:

  • In the above class definition first we define a class that is " Averager". In this class we define two integer variable  that is "sum and count"  and assign a value that is 0. Then we define a functions :
  • First we define getSum() function in this function we does not pass any value and the return type of this function is int that will return an integer value.
  • Then we define add() function we use this function two times but both functions have different from each other.  
  • In first time implementation, we define this function and the return type of this function is void which means it does not return any value. In this function, we calculate the sum value and increase the value of the count variable by 1.  
  • In second time implementation, we define this function and the return type of this function is int which means it will return a value. In this function, we will return the count variable value.
  • At the last, we define a getAverage() that calculates the average of the added values in the sum variable and returns its value.
3 0
3 years ago
Short notes on primary key​
Thepotemich [5.8K]

Answer:

A primary key is a special relational database table column (or combination of columns) designated to uniquely identify each table record. A primary key is used as a unique identifier to quickly parse data within the table. A table cannot have more than one primary key.

Primary Key.

Candidate Key.

Alternate Key.

Super Key.

Composite Key.

Foreign Key.

Unique Key.

In the relational model of databases, a primary key is a specific choice of a minimal set of attributes that uniquely specify a tuple in a relation. Informally, a primary key is "which attributes identify a record," and in simple cases constitute a single attribute: a unique ID.

Explanation:

5 0
2 years ago
4. What is a pentaprism? What job does it do in the camera?
Nadya [2.5K]
Pentaprism is a five sided prism with two silvered surfaces giving a non-stop deviation of all rays of light through 90 degress. Used in viewfinders of single-lens reflex cameras 
6 0
3 years ago
Read 2 more answers
Other questions:
  • In an oblique drawing, which lines can be measured accurately, if there is no foreshortening?
    10·1 answer
  • Explain motherboard in detail
    14·2 answers
  • What software maintain and increase the efficiency of a computer system?
    12·1 answer
  • The executive ________ is the person ultimately responsible to their company for the project's success.
    13·1 answer
  • True or false: The objective of an Enterprise Resource Planning (ERP) system is to create a customized software program that int
    10·1 answer
  • Two technicians are discussing Newton's first law of motion. Technician A says that a lightweight vehicle requires as
    8·1 answer
  • Explain ,how the computer network reduces cost of operation? (don't copy from any website)​
    14·1 answer
  • How did transistors revolutionize the world of computers?
    15·1 answer
  • Stephen is looking through some design diagrams created for a specific application. He spots a diagram which uses a parallelogra
    14·1 answer
  • A ____ is someone who develops programs and apps or writes the instructions that direct the computer or mobile device to process
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!