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
Gnesinka [82]
4 years ago
15

A regular polygon is an n-sided polygon in which all sides are of the same length and all angles have the same degree (i.e.,the

polygon is both equilateral and equiangular). The formula for computing the area of a regular polygon is:
Area = (n * s²) / (4 * tan(π/n))
Write a method that returns the area of a regular polygon using the following header:
public static double area(int n, double side)
Write a main method that prompts the user to enter the number of sides and the side of a regular polygon and displays its area.
Computers and Technology
1 answer:
butalik [34]4 years ago
4 0

import java.util.Scanner;

public class polygon {

/** Main Method */

public static void main(String[] args) {

 Scanner input = new Scanner(System.in); // Create a Scanner

 // Prompt the user to enter the number of sides  

 // and the side of a regular polygon

 System.out.print("Enter the number of sides: ");

 int n = input.nextInt();

 System.out.print("Enter the side: ");

 double side = input.nextDouble();

 // Display the area of the regular polygon

 System.out.println("The area of the polygon is " + area(n, side));

}

/** Method area computes and returns the area of a regular polygon */

public static double area(int n, double side) {

 return (n * Math.pow(side, 2) / (4 * Math.tan(Math.PI / n)));

}

}

You might be interested in
What is a packet?
sleet_krkn [62]

Answer:

A

Explanation:

A packet is a set of data or information.

7 0
3 years ago
Write the code to declare a variable to hold the value of the grade you hope to get in this class. What stdio.h input function w
GREYUIT [131]

Answer:

// code to read grade

#include <stdio.h>

// main function

int main(void) {

   // if grade is character

char grade;

// if grade is numeric then we can use int or double

// int grade;

// double grade;

printf("Enter your grade:");

// read grade from user

scanf("%c",&grade);

// print grade

printf("your grade is:%c",grade);

return 0;

}

Explanation:

To read a value, scanf() function is used from stdio.h.Read a grade from user and assign it to variable "grade".

Output:

Enter your grade:A

your grade is:A

// code to read die volt

#include <stdio.h>

// main function

int main(void) {

// variable

double die_volt;

printf("Enter die volt:");

// read die volt from user

scanf("%lf",&die_volt);

// print die volt

printf("Entered die volt is:%0.2lf",die_volt);

return 0;

}

Explanation:

Read the die volt from user and assign it to variable "die_volt" with the help

of scanf() function.

Output:

Enter die volt:220                                                                                                        

Entered die volt is:220.00

4 0
3 years ago
PYTHON
Korvikt [17]

Answer:

import random

print("Hello! I have a random number from 1 to 100! It is your job to try and guess it!")

number = random.randint(1,101)

guess = int(input("start to guess: "))

num_guesses = 1

while guess != number:

   if guess > number:

       print("lower")

       guess = int(input("try again: "))

       num_guesses +=1

   elif guess < number:

       print ("higher")

       guess = int(input("start to guess: "))

       num_guesses +=1

print("congrats it took you", num_guesses, "tries")

Explanation:

6 0
3 years ago
What are some tips you can use when taking close up photos
Anit [1.1K]

Set your camera up on a tripod

Choose a subject (anything really)

Get your camera up close to the subject

Switch your camera to Manual focus. You can try auto focus, but generally you will be able to focus a little closer on manual focus.

(If you are using manual focus, the tripod will be important.)

4 0
3 years ago
Read 2 more answers
Types of cybercrime​
sergij07 [2.7K]

Answer:

Types of cybercrime

Here are some specific examples of the different types of cybercrime:

*Email and internet fraud.

*Identity fraud (where personal information is stolen and used).

*Theft of financial or card payment data.

*Theft and sale of corporate data.

*Cyberextortion (demanding money to prevent a threatened attack).

*Ransomware attacks (a type of cyberextortion).

*Cryptojacking (where hackers mine cryptocurrency using resources they do not own).

*Cyberespionage (where hackers access government or company data).

Most cybercrime falls under two main categories:

*Criminal activity that targets

*Criminal activity that uses computers to commit other crimes.

Explanation:

8 0
3 years ago
Read 2 more answers
Other questions:
  • Your smartphone, digital camera, and printer are all part of a network in your workspace. What type of network is likely in use
    7·1 answer
  • Please help
    5·2 answers
  • 9.6 Code Practice: Question 1
    9·1 answer
  • Pinterest, a visual bookmarking Website, logs more than 14 terabytes of new data each day, which means its storage needs are con
    10·1 answer
  • How do i convert videos on the computer
    10·1 answer
  • If a fuse block or holder has tree fuses, it may be termed a...
    7·1 answer
  • True or False? You should never move an injured person.<br> True<br> False
    6·1 answer
  • Write a program that keeps asking the user for new values to be added to a list until the user enters 'exit' ('exit' should NOT
    10·1 answer
  • IT ethics are rules, policies, or principles that guide the behavior of IT professionals.
    11·1 answer
  • An Inspect and Adapt (I&amp;A) event is occurring and a program is trying to address a long-existing problem (WIP)?"unreliable P
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!