Unit 6: Lesson 2 - Coding Activity 1 AP Computer science

Answers

Answer 1

The complete program is to define a boolean method that returns true if all elements of an array are negative, or return false, if otherwise

The method in java, where comments are used to explain each line is as follows:

//This defines the method

public static boolean chkNegative (double[] myArr) {

   //This initializes a boolean variable

   boolean isNeg = true;

   //This iterates through the array

   for (int i = 0; i < myArr.length; i++) {

     //If the array element is 0 or positive

     if (myArr[i] >= 0) {

         //Then the boolean variable is set to false

       isNeg = false;

       //And the loop is exited

       break;

     }

   }

   //This returns true or false

   return isNeg;

 }

Read more about boolean methods at:

https://brainly.com/question/18318709


Related Questions

Please help please help

Answers

Answer:

Explanation:

je pense que la reponse est la suivante a et b puis c

????????????helpppp please

Answers

Answer:

I lab u pre haha jok

ano ka gold

Write a program to print sum on first 10 natural numbers.
#include
int main()
{
int i, sum;
for(i=1;i<=10;++i);
{
sum =sum + i;
}
printf("The sum is = %d",sum);
}

Answers

A program that prints the sum on the first 10 natural numbers is:

int sum=0;int i=1;for(i=1; i <= 10 ; i++) // the value of i will be from 1 to 10{sum=sum+i; //each number will get added to the variable ‘sum’}System.out.println(sum); //

What is a program?

A computer program in a programming language is a set of instructions and commands written in a language that a computer can execute or understand. 

Using the For Loop program, the variables of the first 10 natural numbers can be written as:

int sum=0;int i=1;for(i=1; i <= 10 ; i++) // the value of i will be from 1 to 10{sum=sum+i; //each number will get added to the variable ‘sum’}System.out.println(sum); //

Learn more about writing a program here:

https://brainly.com/question/23275071

Janet is playing a game in which she interacts with an environment to solve a puzzle and to meet new characters. She really enjoys this game because there are no time constraints or pressure to perform with speed. What genre of game is Janet most likely playing?
A. simulation
B. action
C. adventure
D. sports

Answers

Answer:

C. adventure

Explanation:

what is control structure write it's types​ .

Answers

Answer

Defination-:

A control statement is a statement and a statement whose execution its control.

Types-:

Selection StatementIteration StatementUnconditional branching Statement

Describe the function of memory and
processing unit of Computer system​

Answers

Answer:

Computer memory is a temporary storage area. It holds the data and instructions that the Central Processing Unit (CPU) needs. ... This allows the CPU direct access to the computer program. Memory is needed in all computers.

Explanation:

hope it help

To remove a specified number of characters from anywhere within a string, you should use the ____ method.

Answers

Answer:

remove

Explanation:

in ____ orientation, a page is taller than it is wide.

Answers

Answer:

portrait

Explanation:

list ten features of word processing packages​

Answers

Answer:

Entering text.

Editing text.

Formatting paragraph.

Formatting page style.

Importing text, graphics and images.

Entering mathematical symbols.

Checking spelling and grammar.

Header and footer and other.

Write a program Election that computes the tally in a write-in election, and announces the winner. Since the votes are write-in, there is no pre-determined set of candidates. Whoever appears the most in the votes is the winner. The user enters the individual votes, one vote per line, and ends entering with typing -1 or an empty line. To compute the tally, the program uses two arrays, a String [ ] variable (names), and an int [ ] variable (count). Upon receiving a single vote, the program checks if the name on the vote appears in names, and if it does, the program adds 1 to the value of the element in count. If the name does not appear in names, the program extends both arrays by one element, stores the name in names at the last position and store 1 in count at the last position. In this manner, the two arrays will have the same lengths. The initial length is 0 for both arrays. Below is an example of how the program may runplease I need to demonstrate the code,I need some comments next to every single line

Answers

The election program illustrates the use of ArrayLists, loops and conditional statements.

ArrayLists are resizable arrays, while loops and conditional statements are used to perform repetitions and make decisions, respectively.

The election program written in Java, where comments are used to explain each line is as follows:

import java.util.*;

public class Main {

 public static void main(String[] args) {

     //This creates a Scanner object

   Scanner input = new Scanner(System.in);

   //This creates a string ArrayList for the names of the candidates

   ArrayList<String> names = new ArrayList<String>();

   //This creates an Integer ArrayList for the vote count of the candidates

   ArrayList<Integer> votes = new ArrayList<Integer>();

   //This declares name as string

   String name;

   //This gets input for the name of the candidates

   name = input.nextLine();

   //This is repeated until the user enters "-1"

   while (!"-1".equals(name)){

       //If name is in the list,

       if(names.contains(name)){

             //This gets the index of the name  

             int pos =names.indexOf(name);

             //This calculates the number of votes

             Integer value = votes.get(pos)+1;  

             //This adds the vote to the vote ArrayList

             votes.set(pos, value);

       }

       //If otherwise

       else{

           //This adds the candidate name to the name ArrayList

           names.add(name);

           //This adds 1 as the vote of the candidate to the vote ArrayList

           votes.add(1);

       }

       //This gets input for the name of another candidates

       name = input.nextLine();

   }

   //This prints the name of the election winner

   System.out.println("Winner : " +names.get(votes.indexOf(Collections.max(votes))));

 }

}

Read more about ArrayLists, loops and conditional statements at:

https://brainly.com/question/19504703

Very few games have any sort of narrative, not even a simple one that involves setting the mood through color, sound, environment, and game mechanics.

A.
True
B.
False

Answers

Answer:

B. False

Explanation:

Numerous amount of games have narrative, there is an entire genres built around narratives. Any RPG game has a narrative and even bog standard FPS games have some sort of backstory and effects setting a mood.

In 1981, Ian Murphy broke into the AT&T online computer system and changed their clocks, allowing people to make calls during the day at a discounted rate. Based on the list of defining factors for computer crimes, what best describes Murphy's crime?

A.
intentionally disrupting, degrading, or destroying information or services on a computer

B.
disclosing any data or information obtained through illegal online activity

C.
knowingly receiving or holding onto any data or information obtained through illegal online activity

D.
intentionally or recklessly tampering with, taking, transferring, concealing, altering, or damaging physical computer equipment

Answers

a. intentionally or recklessly disrupt, degrade, or destroy information or services on the computer

how many pages is 1500 words double spaced 12pt font?

Answers

Answer:

6 pages

Explanation:

Which of the following described a global network connecting billions of computers and other
devices?
A) WiFi
B
ISP
C
World Wide Web
D
Internet

Answers

pretty sure its wifi
A that pretty much it! Lol

what are quantum computers and it uses​

Answers

Answer: Quantum computers are machines that use the properties of quantum physics to store data and perform computations

Jacob is preparing a presentation on the health and social advantages of taking up a sport at an early age. Most of the slides in his PowerPoint presentation provide information using colorful graphics and charts. He plans to give notes to his audience to help them follow along.

Jacob is preparing a presentation on the health and social advantages of taking up a sport at an early age. Most of the slides in his PowerPoint presentation provide information using colorful graphics and charts. He plans to give notes to his audience to help them follow along.

How should Jacob format the Notes Master so it will be most helpful to his audience?

Do not include a slide image, leaving the maximum room to take notes.
Do not include a notes pane because graphics do not need to be annotated.
*Make the slide image large so the charts can be seen clearly.
Make the text pane large so the audience can draw their own charts.

Answers

Answer:

C. Make the slide image large so the charts can be seen clearly.

Explanation: Edg

Computers were originally developed to accomplish various tasks in relative isolation, very different from the collaboration and communication we see today.

A.
True

B.
False

Answers

The answer is A, they were built for work.

Alex needs to create a function capable of counting item reference numbers that he is inserting into a spread sheet. The purpose of this function will be to keep track of inventory. How would Alex go about finding a function to do this? Click the Home tab and use the Find.

Answers

Alex can find a function to do this by entering the item reference numbers into the worksheet, and click the Sort button to count the items.

A spreadsheet can be defined as a document or file which comprises cells in a tabulated format (rows and columns), that are typically used for formatting, arranging, analyzing, storing, calculating, counting, and sorting data on computer systems through the use of a spreadsheet application such as Microsoft Excel.

In this scenario, Alex wants to keep track of inventory by creating a function that is capable of counting item reference numbers as he is inserting into a spread sheet. Thus, he should enter the reference numbers of each item into the worksheet, and click the Sort button to count the items.

Read more: https://brainly.com/question/14299634

Answer:

It’s C

Explanation:

edge

Can you help me to write a code with functions,arrays,and pointers in c++?
It can be a basic game or an interesting program.
But a little bit complicated :)
Please I need help :(((​​

Answers

Answer:

Your search for complete and error-free projects in C and C++ ends here! Here, we’ve enlisted all the mini-projects, projects, games, software and applications built using C and C++ programming language — these are the projects published in our site or available with us at the moment. You can download all these projects (with source code) for free; make sure to check their individual post description as well.

First thing, most students learn C and C++ as their first programming language. They quickly become able to write programs that include functions, arrays and pointers, file handling and data structure, etc. But, when it comes to building a mini-game, an application, or a small project, incorporating all these features in one compact program becomes difficult.

In such case, reference projects always come in handy. The C and C++ projects published in our site will teach you how to get started, give you ideas and topics regarding your project, and sharpen your programming skills in C and C++. Here, you’ll find short and simple as well as long and complicated projects.

What's the technique of drawing a 3D object with one vanishing point?​

Answers

I don’t no it brother n I was searching for this answer can u plz tell me
A one-point perspective drawing means that the drawing has a single vanishing point, usually (though not necessarily) directly opposite the viewer's eye and usually (though not necessarily) on the horizon line. All lines parallel with the viewer's line of sight recede to the horizon towards this vanishing point.

One Point Perspective is a type of linear perspective that uses a single vanishing point to create the illusion of depth in a work of art.
Parallel – Parallel lines are lines that never touch… even if they are extended indefinitely.
Horizontal Lines – Lines drawn from side to side level with the horizon.

A healthcare crisis where millions of patient medication records were tampered with is an example of what type of breach?

A.
integrity breachc.

B.
codependency breach

C.
authentication breach

D.
AIC Triad breach

Answers

A healthcare crisis where millions of patient medication records were tampered with is an example of; A: Integrity Breach.

To answer this question, let us access each of the options;

A) Integrity breach; This is a breach that occurs when where there is an unauthorised or accidental alteration of the personal data of individuals or a group.

B) Codependency breach; This is not really a breach in this context as it happens when there is an imbalanced relationship between two or more people.

C) Authentication breach; This is a type of breach that is more common with a breach of passwords and login details.

D) AIC Triad breach; AIC is Availability, Integrity and confidentiality. So it combines Availabilty breach, integrity breach and confidentiality breach.

In this question, the patient medication records were tampered with which means that they were altered and from our definitions above, this is an example of integrity breach.

Read more about security breach at; https://brainly.com/question/15957125

What is the default folder for text file

Answers

documents or download

It depends where you install it to

Answer:

numbers are stored as characters

Explanation:

currently saved in if another folder

This program is an example of:

def factorial(x):

if x == 1:

return x

else:

return x * factorial(x-1)

Group of answer choices

a do while loop.

recursion.

a for loop.

a while loop.

Answers

The program is an example of recursion

In computer programming, recursion is a process in which a function calls itself.

In a recursive program, there is a

base case and a recursive case.

When the condition of recursion is met, the base case is returned, else, the recursive case is continued.

In the function given above,

the base case is 'return x' under the condition 'if x == 1'. The recursive case is 'return x * factorial(x - 1)'.

So, the function runs until the base case it met and then it stops.

So, the program is an example of recursion.

Learn more about recursion here:

https://brainly.com/question/25797503

Which string method returns true if the character is a numeric character?
letter = input("Enter a letter: ")

A. isDigit(letter)
B. isdigit(letter)
C. letter.isDigit()
D. letter.isdigit()

Answers

Answer:

It is D. letter.isdigit()

Explanation:

reason being is that there is only very few scenarions that require a capital letter in them and most of those that have scenarions are to input a operation into the program.

In the given options, the method that will return true when an input charater is a numeric is optionC. letter.isDigit()

Methods In Programming

Basically what this function does it to check whether the input variable letter is a numeric character, if true then the function returns true.

Hence, the functions input parameter is a string and it returns and boolean

it should be noted that there is a sligth difference between and method and a function in programming.

Learn more about programming here:

https://brainly.com/question/1538272

PLEASE ANSWER (CODING IN PYTHON)


Ask what kind of pet the user has. If they enter cat, print “Too bad...”, if they enter

dog, print “Lucky you!" (You can change the messages if you like). Once this works,

add other pets. (Iguana, Pig, Rabbit...)

Answers

Answer:

Explanation:

a = input("what kind of pet the user has")

if a == 'cat':

  print("Too bad")

elif a == 'dog':

   print("Lucky you!")

The program based on the information is given below.

What's the program about?

def main():

   pet = input("What kind of pet do you have? ").lower()

   if pet == "cat":

       print("Too bad...")

   elif pet == "dog":

       print("Lucky you!")

   elif pet == "iguana":

       print("That's interesting!")

   elif pet == "pig":

       print("Oink oink!")

   elif pet == "rabbit":

       print("Hop hop!")

   else:

       print("I'm not familiar with that pet.")

if __name__ == "__main__":

   main()

Learn more about program

https://brainly.com/question/26642771

#SPJ2

what types of activities are ideal for a robot to perform?

Answers

The type of activities that are ideal for a robot to perform are; Repetitive tasks

Robots are machines that are programmable by a computer which have the capacity of automatically carrying out a complex series of actions.

Now, robots are used in a wide array of industries which include manufacturing, assembly and packaging, transport, earth and space exploration, e.t.c.

The most common use are found primarily in the automobile industry where they are used to carry out repetitive tasks and those that are difficult or hazardous for humans.

Read more about robots at; https://brainly.com/question/9145476

in addition to good design sense, what else do web designers need to be proficient in?

Answers

Web designers need to be proficient in Front-end coding languages in addition to good design sense.

Web designers build or redesign websites. They understand what it takes to make a website functional and easy to use, but also understand what is needed to make it aesthetically appealing to the user.

Web designers need to be proficient in Front-end coding languages in addition to good design sense.

Find out more on web design at: https://brainly.com/question/8391970

How can I master networking my home/business computer(s) - Tv's - iot devices and make the whole system as secure as possible?

Answers

Answer:

you can take guide from

hope this will help you....!

Which of the following is Tynker an example of?
Group of answer choices

database

flowchart

Integrated Development Environment

binary code

Answers

Answer:\

Integrated Development Environment

hope it help

Answer:

C

Explanation:

i did the test

Select all that apply
photoshop question

Form is gives the object this look?

a. Flat

b. Textured

c. Dark

D. 3d

Answers

It should be D and B
Other Questions
I need desperate help. A landscaping company charges customers for lawn care based on the area of their yards. Mr. Jones was charged $52 for his yard, which is 40 feet by 65 feet.If a neighbors yard is 50 feet by 80 feet, what would the neighbor be charged based on how much Mr. Jones was charged?A $60B $80C $100D $120 help me please please Choose a way to solve.Write or draw to explain.2. Greg has Il shirts.3 have long sleeves.The rest have short sleeves.How many short-sleeveshirts does Greg have?Help please! Thank you in advance!! Jean is x years old and jonathan is y years old how many years older is jean then jonathan. How old was jean 5 years ago 1. In a scale of 1-10, how would you rate the skill of Lin Dan? Why? 3. Which question has correct accents and punctuation?A. Como te llamas?B. Como te llamasC. ?Cmo te llamas?D. Cmo ests? 3y=6 Find the slope of the line described by each equation what is map legends??? Which line in daliahs campaign speech best supports her claims that reading is beneficial to learning?. Solve: 2sec(x) 5 = 9 Which equation is equivalent to the given equation?. What is the slope of the line Let simplify :- 2 1 2 Identify and describe two technological advancements that made exploration possible An article when sold at a profit of 5% yields Rs 50 more than when sold at a loss of 5%. What was the cost price of the article? 3. The jar with a plant floating on it was placed on top of the table. What do you think is the plant inside the jar? A lotus B. lemon grass C. onion D. orchidPLEASE I REALLY NEED THE CORRECT ANSWER RIGHT NOW!!! Solve the proportion where necessary, round to the nearest hundredth 12/13 = X/13 Select the correct answer from each drop-down menu. They decided to leave the cabin in the mountains because there was not enough there to get them through the winter. The appearance of his home contrasted with his easygoing personality. The alchemist tried to the iron into gold. The town was so that no one had heard of it. OMG HELP RN I GIVE BRAINLIST Which of the following correctly describes the solutions to the inequality? A. There are 5 solutions. The solutions are the numbers between 4 and 8. B. There are an infinite number of solutions. The solutions are all numbers less than 3. C. There are 6 solutions. The solutions are the numbers between -2 and 3. D. There are an infinite number of solutions. The solutions are all numbers greater than 3. when a driver receives a text while driving, what can 2022 versas hands-free text messaging assistant do?