Write a program that figures out how many prime numbers exist within an arbitrary, random range of numbers.

Answers

Answer 1

The Python program defines a function, `is_prime()`, that checks if a number is a prime by iterating up to the square root of the number.

Here's an example program in Python that calculates the number of prime numbers within an arbitrary range of numbers:

```python

def is_prime(num):

   if num < 2:

       return False

   for i in range(2, int(num**0.5) + 1):

       if num % i == 0:

           return False

   return True

def count_primes(start, end):

   count = 0

   for num in range(start, end + 1):

       if is_prime(num):

           count += 1

   return count

start_range = int(input("Enter the starting number of the range: "))

end_range = int(input("Enter the ending number of the range: "))

prime_count = count_primes(start_range, end_range)

print("The number of prime numbers within the range", start_range, "to", end_range, "is:", prime_count)

```

In this program, the `is_prime()` function checks if a number is prime by iterating from 2 to the square root of the number and checking for any factors. The `count_primes()` function counts the prime numbers within the given range by iterating through each number in the range and incrementing the count if the number is prime.

The program prompts the user to input the starting and ending numbers of the range. It then calls the `count_primes()` function with the specified range and stores the result in `prime_count`. Finally, it prints the count of prime numbers within the range.

You can run this program and provide any arbitrary range of numbers to determine the count of prime numbers within that range.

Learn more about Python:

https://brainly.com/question/26497128

#SPJ11


Related Questions

From a data modeling point of view, _____ data refer to data whose values change over time and for which one must keep a history of the data changes.

Answers

Answer:

From a data modeling point of view, time-variant data refer to data whose values change over time and for which one must keep a history of the data changes.

Range is an example of a ______________.
PLZ help!!!

Answers

Answer:

Function

Explanation:

In python, they use this word a lot.

The function in Python is an example of just one. Whenever called, the reach function accepts one argument. This range function accepts up to 3 arguments, but at least one must be specified when this is invoked.

It provides a process called range(). It returns a series of numbers that starts at zero and increments by one by default, stopping before the defined set.This function is most commonly used to iterate sequence types (Python range () list, string, and so on) using for and while loops.In the for loop, one of the most common uses of the range () method is to iterate through a series of variables.

Therefore, the final answer is "Function".

Learn more:

brainly.com/question/22291227

How do I make the text and heading different colors?

How do I make the text and heading different colors?

Answers

Answer: do u have word if you do go to font and u can change ur font

Explanation:

Write the removeevens() function, which receives a vector of integers as a parameter and returns a new vector of integers containing only the odd numbers from the original vector. the main program outputs values of the returned vector. hint: if the original vector has even numbers, then the new vector will be smaller in length than the original vector and should have no blank element. ex: if the vector passed to the removeevens() function is [1, 2, 3, 4, 5, 6, 7, 8, 9], then the function returns and the program output is: [1, 3, 5, 7, 9] ex: if the vector passed to the removeevens() function is [1, 9, 3], then the function returns and the program output is: [1, 9, 3]
main.py 1 def remove evens(nums): 2 # Type your code here. 3 4 if __name__ ==' ___main___':
5 nums = [1, 2, 3, 4, 5, 6, 7, 8, 9] 6 result = remove_evens(nums) 7 8 print(result)

Answers

Answer:

def remove_evens(nums):

# Create an empty list to hold the odd numbers

odds = []

# Loop through the input list and check if each number is odd

for num in nums:

if num % 2 != 0:

odds.append(num)

# Return the list of odd numbers

return odds

if __name__ == '__main__':

nums = [1, 2, 3, 4, 5, 6, 7, 8, 9]

result = remove_evens(nums)

print(result)

Explanation:

In this implementation, we first create an empty list called odds to hold the odd numbers. We then loop through the input list nums, checking if each number is odd using the modulus operator (%). If the number is odd, we append it to the odds list.

Finally, we return the odds list, which contains only the odd numbers from the input list. In the main program, we pass the input list [1, 2, 3, 4, 5, 6, 7, 8, 9] to the remove_evens() function, and print the resulting list [1, 3, 5, 7, 9].

Can someone tell me how to hit on a link on Brainly to see the answer

Answers

no, please do not hit on links. they're viruses i'm pretty sure.
Make sure to report the answer just in case

Can someone please help me answer this question.
1. Select the correct answer. What is a digital portfolio?
A. a summary of your portfolio.
B. a presentation of your portfolio
C. a representation of your work
D. a preview of your most important work

2. Hadoop is a popular framework used for storing and processing big data. Which programming language was used while building this framework?
Hadoop is a popular_____ based framework used for storing and processing big data.​

Answers

Answer:

1. C. or D.

2. Hadoop is a popular Java-based framework used for storing and processing big data.​

Explanation:

For number 1 I think it's C because:

A digital portfolio is an online collection of work that represents your abilities and skills as a professional in your field. I could be D aswell!

Hope you do well!

Telnet protocol packets usually go to TCP port ____.
A) 7
B) 8
C) 14
D) 23

Answers

The correct answer is D) 23.

Telnet is a protocol used for remote terminal connections and allows a user to access a remote computer or device over a network. The Telnet protocol packets are sent over TCP (Transmission Control Protocol) connections, and they usually use TCP port number 23. TCP is one of the core protocols of the Internet Protocol (IP) suite, and it provides reliable, ordered, and error-checked delivery of data between applications. Port numbers are used to identify different applications running on a networked device, and they help to ensure that data is delivered to the correct application. TCP port 23 is commonly associated with Telnet, but it can also be used by other applications and protocols.


To learn more about TCP (Transmission Control Protocol) click here: brainly.com/question/30668345


#SPJ11

Which of the following statements are true about cross-platform development? Select 3 options.
Hybrid apps are cross-platform and provide access to many hardware features.
Web apps are not cross-platform, unless they are being run on a smartphone.
Native apps are cross-platform applications, where one version of the app runs on all devices.
Application programming interfaces are often used to make cross-platform development easier.
Cross-platform development allows programmers to create one version of an app that runs on many
different platforms.

Answers

Answer:

- Application programming interfaces are often used to make cross-platform development easier.

-Hybrid apps are cross-platform and provide access to many hardware features.

-Cross-platform development allows programmers to create one version of an app that runs on many different platforms.

Explanation:

The statements that are correct about "cross-development platform" would be:

A). Hybrid apps are cross-platform and provide access to many hardware features.

D). Application programming interfaces are often used to make cross-platform development easier.

E). Cross-platform development allows programmers to create one version of an app that runs on many different platforms.

What is a cross-development platform?

The Cross-Development platform is described as the process of development of application software that carries the ability to function on various operating systems.

The above statements correctly state that these applications offer access to multiple characteristics of the hardware and work on a number of platforms.

The applications are prepared to allow its access on distinct devices and it helps in making on the application that will work on all platforms.

Thus, options A, D, and E are the correct answers.

Learn more about "Development" here:

brainly.com/question/752980

please help asap! someone good with python

please help asap! someone good with python

Answers

Answer:

import turtle

t = turtle.Turtle()

for x in range(1,11):

 t.circle(10*x)

Write a short thesis statement about the IoT (Internent of things) I just need this just for ideas on my thesis statement. :)

Answers

The Internet of Things, or IoT for short, is a relatively new topic in the world of technology. This topic is both engaging and innovative for students pursuing their bachelor's and master's degrees. They can write their M.Tech. or Ph.D. thesis in this field. The internet has become an integral component of our everyday lives. The Internet of Things (IoT) concept is centered on the combination of comfort and the Internet.

What should you remember about typography while creating your résumé?
It is advisable to avoid using [blank] font when creating your résumé. To facilitate readability, your font should not be smaller than [blank]
points.

Answers

Answer:

Your font should not be smaller than 0.5

Explanation:

How a student can use computer to improve academic performance?

Answers

Answer:

k Nishant

Explanation:

he can learn many things internet by using computer he change his self by learning about many things

Answer:

A student can use it by searching up things with his/her computer.

Browse for different new things everyday that gives knowledge.

Ask questions.

Do new things everyday.

A computer can easily input grades and send data.

Explanation:

Okay.

Tim has several workbooks open in the Excel application. He would like to view them all at the same time, so he should use the ______ command.

Answers

Answer:

Arrange All

Explanation:

For him to to view them all at the same time, so he should use the Arrange All

command. To do this, you will need to

Open the workbooks that is needed to arrange, in this case at least two workbooks are to be opened, then make selection of the worksheet in each workbook that is needed to be displayed, then on the view tab, you can make selection of "Arrange All button" in the Window.

In the array declaration below, what is the significance of the number 13?
int[] pointCount = new int[13];
A. It is one less than the number of elements in the array
B. It is one greater than the number of elements in the array
C. It indicates the number of elements in the array.
D. It is the value assigned to every element in the array

Answers

C. The number 13 in the array declaration indicates the number of elements in the array. When an array is declared, the number inside the square brackets specifies the size of the array, or the number of elements it can hold.

In this case, the array "pointCount" has been declared with a size of 13, which means it can hold 13 integer values. It is important to specify the size of the array when declaring it because it determines how much memory space will be allocated for the array in the computer's memory.

In the array declaration `int[] pointCount = new int[13];`, the number 13 signifies the size of the array, which means there will be 13 elements in the array. The array will have indexes ranging from 0 to 12, and each index will store an integer value.

Learn more about array here:

brainly.com/question/30757831

#SPJ11

help plz (will give brainliest)

help plz (will give brainliest)

Answers

Answer:

The answer to this question is given below in the explanation section.

Explanation:

This is the python program in the question that is:

def sum(n1,n2):

n=n1+n2

return n

The question is: write a function CALL that displays the return value on the screen.

So, the correct program is written below:

*********************************************************************  

def sum(n1,n2):# it is function that define sum

 n=n1+n2 # variable n that store the result of n1 and n2

 return n # return the result

print(sum(3,5))# call the sum function with parameter 3 and 5 , it will print 8

print(sum(4,101))

# call the sum function with parameter 4 and 101 it will print 105

********************************************************************************

you can also store the sum result into another variable, because this function return the sum. So, you can store that return value into another vairable and using the print function, to print the value of this variable such as:

*****************************************************************************

def sum(n1,n2):# it is function that define sum

n=n1+n2 # variable n that store the result of n1 and n2

return n # return the result

result= sum(6,9) # store the sum result into another variable i.e result

print(result)# print the result variable value

*****************************************************************************

TRUE/FALSE. if two methods in the same class have the same name but different signatures, the second overrides the first.

Answers

The statement is false. You can override a superclass method by creating a new instance method in the subclass that has the same signature.

Every class derives from the Object class, either directly or indirectly. The subclass method overloads the superclass method if the signature of the methods in the two classes match. The second method replaces the first if two methods in the same class have the same name but different signatures.

If a method in your subclass has the same name and signature as a method in its superclass, the method in your subclass takes precedence. As a result, the method from the superclass is not inherited by the subclass.

Learn more about subclass here-

https://brainly.com/question/15992142

#SPJ4

The use of databases enables organizations to (choose all that apply):
a. Minimize data inconsistency.
b. Minimize data isolation.
c. Minimize data security risks
d. Eliminate data integrity
e. Eliminate data redundancy

Answers

The use of databases enables organizations to minimize data inconsistency, minimize data isolation, minimize data security risks, and eliminate data redundancy. The correct options are: a, b, c, and e.

A database is a collection of data that is organized and managed in such a way that it can be easily accessed, managed, and updated.

A database is made up of tables that contain rows and columns of data.

Databases are commonly used to store information such as customer data, sales transactions, inventory data, and employee records.

What are the advantages of using databases in organizations?

1. Data consistency: Databases aid in data consistency by ensuring that all data is formatted and labeled the same way throughout the organization.

2. Data isolation: Databases reduce data isolation by allowing multiple users to access the same data simultaneously, minimizing the need to create and maintain multiple copies of the same data.

Know more about databases  here:

https://brainly.com/question/518894

#SPJ11

Please help, will give brainliest!!! I need help with these coding questions, any help is appreciated

Please help, will give brainliest!!! I need help with these coding questions, any help is appreciated
Please help, will give brainliest!!! I need help with these coding questions, any help is appreciated

Answers

Answer:

class Foo:

   def F(self, n):

       if n == 1:

           return 1

       return self.F(n - 1) + 3 * n - 2

Explanation:

This should cover part a to this question. The thing I'm not sure on is they use the term "method" which in python technically means a class function...but then list one argument with the function call which makes me think it is possibly just supposed to be a regular function. Which would be the following snippet. It would depend on if you are using classes or not yet in your coding class.

def F(n):

   if n == 1:

       return 1

   return F(n - 1) + 3 * n - 2

Play around with it and look into python "lists" and "for loops" for part c. Part b I'm not sure what kind of example they want since I'm not in that class. Good luck!

I need help please and thank you

I need help please and thank you

Answers

Answer:

Explanation: For "BEST way to handle the situation," try Option 1, because it would possibly help them or make the Technical Support Representative do less work.

For "WORST way to handle the situation," Option 4 would be the best because you're basically just hanging up on the person.

After 4th collision in ethernet, find the maximum time that the adapter waits until sensing the channel again for a 100 mbps broadcast channel?

Answers

The maximum time that the adapter waits until sensing the channel again for a 100 mbps broadcast channel is 0.512 ms. When two devices on the same half-duplex Ethernet network try to send data at precisely the same time, it results in a collision.

What is a collision in Ethernet?On a half-duplex Ethernet network, a collision occurs when two devices on the same network attempt to communicate data at the same time. The network "collapses" the two transmitted packets, resulting in the network discarding both of them. Collisions are unavoidable on Ethernets.A collision is a brief interaction between two or more bodies that alters the motion of the bodies involved as a result of internal forces at work. Collisions necessitate the use of force (there is a change in velocity). When two devices on the same half-duplex Ethernet network try to send data at precisely the same time, it results in a collision.

A 100 Mbps broadcast channel has a waiting time of 0.512 ms.

Remember that the CSMA/CD protocol requires the adapter to wait K 512 bit times after a collision.

Where K is drawn randomly. For K = 100,

The one bit time for 10 Mbps is 1/10000000 s = 0.0001 ms

The one bit time for 100 Mbps is 1/100000000 s = 0.00001 ms

Waiting time for a 10 Mbps broadcast channel is

K × 512 × 0.0001 = 5.12 ms

Waiting time for a 100 Mbps broadcast channel is

K × 512 × 0.00001 = 0.512 ms

The maximum time that the adapter waits until sensing the channel again for a 100 mbps broadcast channel is 0.512 ms.

To learn more about Ethernet refer to:

brainly.com/question/14123270

#SPJ4

The creation of OSHA provided this important right to workers:
a) The right to equal employment opportunities. b) The right to privacy. c) The right to pension benefits. d) The right to a safe and healthful workplace.

Answers

The creation of OSHA provided this important right to workers: d) The right to a safe and healthful workplace.

What is OSHA?

OSHA is simply an abbreviation for occupational safety and health administration that was created under the Occupational Safety and Health Act, so as to develop work-safety standards for workers and providing precautionary measures against all workplace hazards.

Generally, OSHA is an agency of the federal government which is saddled with the following responsibilities of developing work-safety standards for employees and providing precautionary measures against all workplace hazards.

In this context, we can infer and logically deduce that the creation of OSHA provided this important right to workers the right to a safe and healthful workplace.

Read more on OSHA here: brainly.com/question/17199752

#SPJ1

Use the conversion table below to help you answer the question.


What is the decimal value of the b-i-n-a-r-y number 1011?
0.1011
0.1100
11
13

Answers

Correct answer is 11

in a cloud computing arrangement, if the customer has a contractual right to take possession of the software without significant penalty and the customer could run the software on its own, the costs are treated as

Answers

Answer:Purchased Intangibles

Explanation:

Write a method that takes two circles, and returns the sum of the areas of the circles.

This method must be named areaSum() and it must have two Circle parameters. This method must return a double.

For example suppose two Circle objects were initialized as shown:

Circle circ1 = new Circle(6.0);
Circle circ2 = new Circle(8.0);
The method call areaSum(circ1, circ2) should then return the value 314.1592653589793.

You can call your method in the program's main method so you can test whether it works, but you must remove or comment out the main method before checking your code for a score.

Answers

Answer:

public static double areaSum(Circle c1, Circle c2){

 double c1Radius = c1.getRadius();

 double c2Radius = c2.getRadius();

 return Math.PI * (Math.pow(c1Radius, 2) + Math.pow(c2Radius, 2));

public static void main(String[] args){

 Circle c1 = new Circle(6.0);

 Circle c2 = new Circle(8.0);

  areaSum(c1,c2);

 }

Explanation:

The function calculates the sum of the area of two circles with their radius given. The program written in python 3 goes thus :

import math

#import the math module

def areaSum(c1, c2):

#initialize the areaSum function which takes in two parameters

c1 = math.pi * (c1**2)

# calculate the area of the first circle

c2 = math.pi * (c2**2)

#Calculate the area of the second circle

return c1+c2

#return the sum of the areas

print(areaSum(6.0, 8.0))

A sample run of the program is attached

Learn more : https://brainly.com/question/19973164

Write a method that takes two circles, and returns the sum of the areas of the circles.This method must

how to sum all the odd or even numbers in an arraylist in java?

like the program asks for user input and adds the input to an arraylist and then the user can click a button (sum odd or sum even) and then the value of all odd or even numbers should be returned based on what button the user clicks, so how do i do that ?

Answers

A program exists as a detailed set of ordered operations for a computer to execute. Generally, the program exists placed into a storage area available to the computer.

What is java?

Java exists as a class-based, object-oriented programming language that exists designed to contain as rare implementation dependencies as possible.

For even sum:

BtnSumE.addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

int sumE = 0;

for (int counter = 0; counter < aryNums.size(); counter++)

{

if (aryNums.get(counter) % 2 == 0)

{

sumE += aryNums.get(counter);

TxtArea.setText(String.valueOf(aryNums.get(counter)));

TxtArea2.setText("The sum of the even integers is " + valueOf(sumE));

}

For odd sum:

BtnSumO.addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

int sumO = 0;

for (int counter = 0; counter < aryNums.size(); counter++)

{

if (aryNums.get(counter) % 2!= 0)

{

sumO += aryNums.get(counter);

TxtArea.setText(String.valueOf(aryNums.get(counter)));

TxtArea2.setText("The sum of the odd integers is " + valueOf(sumO));

}

When running the program for an even sum we get "74" and for the odd sum, we get "263".

Array list (aryNums) contain these numbers [0, 2, 23, 74, 263].

To learn more about computer programs refer to:

https://brainly.com/question/23275071

#SPJ9

If the primary voltage of a transformer is 230V and the primary coil is 80. Calculate the secondary voltage when the secondary turn is 160. *Ans 460 volts*

Answers

Answer:

\(V_{out} = 460\)

Explanation:

From your question, you already posted the answer

However, I'll give the steps to get the answer

Given

\(Primary\ Voltage = 230V\)

\(Primary\ Coil = 80\)

\(Secondary\ Coil = 160\)

Required

Secondary Voltage

The relationship between the primary voltage, secondary voltage, turns of primary coil and secondary coil is as follows;

\(\frac{V_{out}}{V_{in}} = \frac{N_{s}}{N_{p}}\)

Where

\(V_{in} = Primary\ Voltage = 230V\)

\(V_{out} = Secondary\ Voltage = ??\)

\(N_{p} = Primary\ Coil = 80\)

\(N_{s} = Secondary\ Coil = 160\)

Substitute these values in the formula above;

\(\frac{V_{out}}{V_{in}} = \frac{N_{s}}{N_{p}}\)

becomes

\(\frac{V_{out}}{230} = \frac{160}{80}\)

\(\frac{V_{out}}{230} = 2\)

Multiply both sides by 230

\(230 * \frac{V_{out}}{230} = 2 * 230\)

\(V_{out} = 2 * 230\)

\(V_{out} = 460\)

Hence, the secondary voltage is 460 Volts

Answer:

460 volts

Explanation: hope this helps :)

A company is monitoring the number of cars in a parking lot each hour. each hour they save the number of cars currently in the lot into an array of integers, numcars. the company would like to query numcars such that given a starting hour hj denoting the index in numcars, they know how many times the parking lot reached peak capacity by the end of the data collection. the peak capacity is defined as the maximum number of cars that parked in the lot from hj to the end of data collection, inclusively

Answers

For this question i used JAVA.

import java.time.Duration;

import java.util.Arrays;;

class chegg1{

 public static int getRandom (int min, int max){

       

       return (int)(Math.random()*((max-min)+1))+min;

   }

public static void display(int[] array){

    for(int j=0; j< array.length; j++){

     System.out.print("   " + array[j]);}

     System.out.println("----TIME SLOT----");

}

public static void main(String[] args){

   int[] parkingSlots= new int[]{ -1, -1, -1, -1, -1 };

   

   display(parkingSlots);

   for (int i = 1; i <= 5; i++) {

     

     for(int ij=0; ij< parkingSlots.length; ij++){

       if(parkingSlots[ij] >= 0){

           parkingSlots[ij] -= 1;

       }

       

       else if(parkingSlots[ij]< 0){

           parkingSlots[ij] = getRandom(2, 8);

       }

       

       

       }

      display(parkingSlots);

   

    // System.out.println('\n');

     try {

       Thread.sleep(2000);

     } catch (InterruptedException e) {

       e.printStackTrace();

     }

   }

   }

}

output:

-1   -1   -1   -1   -1----TIME SLOT----

  8   6   4   6   2----TIME SLOT----

  7   5   3   5   1----TIME SLOT----

  6   4   2   4   0----TIME SLOT----

  5   3   1   3   -1----TIME SLOT----

  4   2   0   2   4----TIME SLOT----

You can learn more through link below:

https://brainly.com/question/26803644#SPJ4

if you want to monitor the average cpu usage of your ec2 instances, which aws service should you use

Answers

If you want to monitor the average CPU usage of your EC2 instances, then you should use the Amazon CloudWatch AWS service.

What is Amazon CloudWatch?

Amazon CloudWatch is a unified monitoring service for resources and applications running on the AWS Cloud. With Amazon CloudWatch, you can collect and access all your monitoring data in one place, monitor resource usage, as well as app performance metrics.

CloudWatch collects data in the form of logs, metrics, and events, which allow you to monitor your AWS resources, applications, and services.

Amazon CloudWatch can help you monitor and analyze log data, set alarms, and react to changes in your AWS resources.

CloudWatch is integrated with most AWS services and can handle custom metrics as well as predefined metrics. With CloudWatch, you can monitor average CPU usage, network usage, and much more.

Learn more about Amazon at

https://brainly.com/question/32475999

#SPJ11

Coding Problem please review my work!
Part 1: Design a Class
You’ll design a class named Car that has the following fields:

yearModel—An Integer that holds the car’s year model
make—A String that holds the make of the car
speed—An Integer that holds the car’s current speed
The class should have the following constructor and other methods:

The constructor should accept the car’s year model and make as arguments. These values should be assigned to the object’s yearModel and make fields. The constructor should also assign 0 to the speed field.
Design appropriate accessor methods to get the values stored in an object’s yearModel, make, and speed fields.
The accelerate method should add 5 to the speed field each time it’s called.
The brake method should subtract 5 from the speed field each time it’s called.

My coding ( it's in pseudocode!)
Class Car
Private Interger yearModel
Private String Make
Private Interger Speed

//Constructor
Public Module Car (Interger y, String m, Interger s)
Set yearModel = y
Set Make = m
Set Speed = s
End Module

//Mutators
Public module setYearModel (Interger y)
Set yearModel = y
End Module

Public module setMake (String m)
Set Make = m
End Module

Public module setSpeed (Interger s)
Set Speed = s
End Module

//Accesors
Public Function Interger getYearModel()
Return yearModel
End Function

Public Function String getMake()
Return make
End Function

Public Function Interger getSpeed()
Return speed
End Function

//Accelerate
Public Module accelerate()
set speed = speed + 5
End Module

//Brakes
Public Module brake()
set speed = speed - 5
End Module

End Class

Part 2: Design a Program

You’ll create both pseudocode and a flowchart to design a program that creates a Car object and then calls the accelerate method five times.

After each call to the accelerate method, get the current speed of the car and display it.
Then, call the brake method five times. After each call to the brake method, get the current speed of the car and display it. Take a screenshot of the results after your fifth time calling the method.

My coding ( it's in Pseudocode!)
Module Main()
Call accelerate(5)
End Module

Module accelerate(Interger times)
If times > 0 Then
Display " The car has increased its speed by 5"
Display "The cars current speed is, 'speed'.
Call accelerate (times - 1)End if
End Module
Module Main()
Call brake(5)
End Module

Module brake (Interger times)
If times > 0 Then
Display " The cars brake has been Increased by 5"
Display " The cars current brake is, 'brake'.
Call brake(times - 1)
End If
End Module

Answers

It appears like you implemented the Vehicle class well. Your accessor and mutator methods have the proper names, and it adheres to the instructions in the prompt.

Which is the correct Java method for creating an instance of the automobile class?

examples of the class. Car myCare = new Car("Olds", 15110); This would invoke the Car class' function Object() { [native code] } and pass it two arguments to specify the car's initial state. Don't give the object fields and parameter variables the same names.

/ for I = 1 to 5, do car, execute the accelerate method five times.

accelerate() returns a vehicle.

display "The vehicle's current speed is " + speed; getSpeed()

/ For I = 1 to 5, call the brake method five times in the do car statement.

speed = car brake().

getSpeed() Show "The vehicle's

To know more about accessor visit:-

https://brainly.com/question/13098886

#SPJ1

Write a program in java to input N numbers from the user in a Single Dimensional Array .Now, display only those numbers that are palindrome

Answers

Using the knowledge of computational language in JAVA it is possible to write a code that  input N numbers from the user in a Single Dimensional Array .

Writting the code:

class GFG {

   // Function to reverse a number n

   static int reverse(int n)

   {

       int d = 0, s = 0;

       while (n > 0) {

           d = n % 10;

           s = s * 10 + d;

           n = n / 10;

       }

       return s;

   }

   // Function to check if a number n is

   // palindrome

   static boolean isPalin(int n)

   {

       // If n is equal to the reverse of n

       // it is a palindrome

       return n == reverse(n);

   }

   // Function to calculate sum of all array

   // elements which are palindrome

   static int sumOfArray(int[] arr, int n)

   {

       int s = 0;

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

           if ((arr[i] > 10) && isPalin(arr[i])) {

               // summation of all palindrome numbers

               // present in array

               s += arr[i];

           }

       }

       return s;

   }

   // Driver Code

   public static void main(String[] args)

   {

       int n = 6;

       int[] arr = { 12, 313, 11, 44, 9, 1 };

       System.out.println(sumOfArray(arr, n));

   }

}

See more about JAVA at brainly.com/question/12975450

#SPJ1

Write a program in java to input N numbers from the user in a Single Dimensional Array .Now, display
Other Questions
according to the ptolemaic (greek) system, the planets have circular orbits. T/F A. (0,-10)B.(-10,0)C.(0,-2)D.(-2,0) Give an example of how Franklin used scientific ideas to solve an everyday problem. Preguntas captulo # 3:1.Por qu disfrutaba Ana Rosa pasar tanto tiempo sentada en las ramas de su rbol gri gri?2.Desde su rbol gri gri Ana Rosa alcanzaba a ver algo que ella describe como un monstruo marino. Qu eventos se dieron para que la gente del pueblo se enterara de la noticia del monstruo marino?3.Cuando Ana Rosa relata lo que vio la gente no le crey. Qu sucedi para que le creyeran?4.Una vez convencidos los vecinos de que s haba un monstruo marino en la baha de Sosa, qu queran hacer los vecinos? Por qu?5.Cuando Ana Rosa comienza a escribir la historia sobre el monstruo marino tal parece como si comenzara a establecer un parecido entre ella y el monstruo. En qu se parecen el monstruo marino y Ana Rosa?6.La historia que Ana Rosa escribi capt la atencin de todo el vecindario, en especial la de su hermano Guario. Cmo sabe el lector que a Guario le gust mucho la historia que escribi su hermanita?7.Qu result ser el monstruo marino que Ana Rosa haba divisado?8. Cmo Ana Rosa describe la experiencia de escribir la historia y por qu?el color de mis palabras novela de espaol Rebecca left her house and walked 2 blocks east. She turned and walked 5 blocks north to getto the library. How far is the direct route from Rebecca's house to the library? Explain the effects that high and low self esteem can have on health. (3 sentence minimum) if you were punched in the stomach would your rubs protect you? 10. Seven more than the quotient of a number band 45 is greater than 5. The other answer are in this picture1. Erika was not among those who disliked Mr. Kelp. As point guard, she was the best passer on the team. She was also the only one not worried about passing science. Her B in Mr. she appreciated how he challenged the class. He didn't let students skate by with minimum effort. Erika considered his class to be good preparation for college. She made plans to would hold a special study session to help the team prepare for the exam. Her teammates were not fond of the idea.The first sentence of paragraph 4 contains an implicit statement. Which choice expresses the same information explicitly? A The following morning, Erika acted strangely to distract Mr. Kelp. B The following morning, Erika danced as she stood in Mr. Kelp's room. C The following morning, Erika stood nervously in Mr. Kelp's room.D The following morning, Erika waited in Mr. Kelp's very cold room. New Voice Incorporation's chief executive officer (CEO) is looking into two options to invest so that in four years from now his company will be able to buy equipment that has been estimated to cost $100,000.00 four years from now. Option 1 is for him to invest with a bank that pays an interest rate of 5% by investing $20,000.00 now, $10,000 in 1 year from now, $20,000.00 in 2 years from now, $500.00 in 3 years from now, and add the rest of the money needed in 4 years from now to buy the equipment. Why did the Ku Klux Clan start again in the 1920s? put the following equation of a line into slope-intercept form simplifying all fractions . Which words have a similar relationship to the relationship of the words bulb and tulip in "Tulip Mania"?A) creation and creatorB) book and publisherC) part and wholeD) product and source Stan drove 300 miles in 5 hours, 20 minutes. Next, he drove 360 miles in 6 hours, 40 minutes. What was Stan's average speed in miles per hour for the total trip? Which of the following was not a problem faced by the Catholic ChurchA is hypocrisy of priest MarryingB is lay investiture in choosing bishopsC is a lack of clergy you to see to peoples needsD is simony-selling of church positions to bishops EB bisects RED. Find the measure of BED if REB = 5x 3 and RED = 8x + 16.If you give me the answer ill love you Find the distance between the skew lines with parametric equations x=3+t,y=2+6t,z=2t, and x=2+2s,y=6+14s,z=3+5s In an introductory psychology class with n = 50 students, there are 9 freshman males, 15 freshman females, 8 sophomore males, 12 sophomore females, and 6 junior females. A random sample of n = 2 students is selected from the class. If the first student in the sample is a male, what is the probability that the second student will also be a male?a. 8/14b. 12/20c. 20/44d. 20/50 a nurse is preparing dietary recommendations for a client with a lung abscess. which statement would be included in the plan of care? the wade-davis bill in 1864:group of answer choicesreceived strong support from congressional democrats but not from republicans.called for at least two-thirds of a southern state's voters to take a loyalty oath.showed radical republicans' frustration with lincoln's reconstruction plan.was the model for lincoln's later ten-percent plan.failed to receive sufficient votes in the senate and therefore died.