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
jeka94
3 years ago
10

Write code which takes two inputs from the user, a number of sides followed by a side length, then creates a regular polygon wit

h that number of sides and side length.Sample run:Type the number of sides:8Type a side length:7.5regular octagon with side length 7.5Hint: Make sure you use the right data types when taking user input.
Computers and Technology
2 answers:
SVETLANKA909090 [29]3 years ago
8 0

Answer:

import java.util.Scanner;

public class Polygon {

       public static void main(String[] args) {

               Scanner sc = new Scanner(System.in);

               System.out.println("Type the number of sides:");

               int sides = sc.nextInt();

               System.out.println("Type a side length:");

               double length = sc.nextDouble();

               if (sides== 5){

                      System.out.println("Pentagon, length "+length);

               } else if (sides == 6){

                      System.out.println("Hexagon, length "+length);

               } else if (sides == 7){

                      System.out.println("Heptagon length "+length);

               } else if (sides == 8){

                       System.out.println("Octagon, length "+length);

                } else if (sides == 9){

                       System.out.println("Nonagon, length "+length);

                 } else if (sides == 10){

                       System.out.println("Decagon, length "+length);

} else if (sides == 11){

                       System.out.println("Undecagon, length "+length);

} else if (sides == 12){

                       System.out.println("Dodecagon, length "+length);

} else {

                       System.out.println("Please choose a valid number.");

               }

       }

}

Explanation:

The Java source code defines a class called 'Polygon' the main method of the class prompts for user inputs for the sides and length variables. The nested if-statement prints the type of polygon with respect to the number of sides.

Ahat [919]3 years ago
5 0

Answer:

i need free point sorry lol

Explanation:

You might be interested in
Write a function endpoints that takes a list of numbers (eg. [5, 10, 15, 20, 25]) and returns a new list of only the first and l
Ne4ueva [31]

I included a picture of my code below. Best of luck with your assignment.

5 0
2 years ago
When a computer or digital device is used as a storage device or in the facilitation of an offense, it is argued to be ____ to t
Katen [24]

Answer:

Incidental.

Explanation:

When a computer or digital device is used as a storage device or in the facilitation of an offense, it is argued to be incidental to the offense.

For instance, the list of customers used by human traffickers is considered to be generated through an incidental system.

8 0
2 years ago
OSHA requires training for employees on the hazards to which they will be exposed.
Sedaia [141]

A, OSHA does require training for employees on the hazards to which they will be exposed.


3 0
3 years ago
Read 2 more answers
Which unit of computer is used to processed data?​<br>Please help!!!!!!
RoseWind [281]

Hello There!

AnimeVines is here!

Is it Central Processing Unit?

HopeThisHelps!!

AnimeVines

7 0
2 years ago
Read 2 more answers
Which of the following is Not included in the Web Accessibility Initiative? Don’t rely on color alone.
Doss [256]
I'm pretty sure it's D. Provide discount software for the underprivileged.
3 0
3 years ago
Other questions:
  • Using the media as equipment for living. Explain how you would use some form of media to serve a purpose in your life—and what t
    6·2 answers
  • Anyone free to inbox me plz....​
    6·2 answers
  • i set up an account and paid the yearly fee, now it's asking me to join. i've tried to log in and brainly isn't accepting my ema
    8·1 answer
  • Assume that you have created a class named DemoCar. Within the Main() method of this class, you instantiate a Car object named m
    12·1 answer
  • In the 1880’s advancements in technology and processes made photography available to the general public. Who is considered the m
    12·1 answer
  • Which control program flow options runs to the end of the code block and resumes the break mode at the statement that follows?
    12·1 answer
  • Cho 3 lớp như hình, viếtchương trình thực hiện các chức năng sau:
    15·1 answer
  • 31. Explain what the program does. Write out the output 20 PRINT "Hellooo00000000000, world!" 30 PRINT "I'm learning about comma
    7·1 answer
  • Is spin to win paying or is a scam app​
    6·2 answers
  • When viewing an e-book section of an assignment in launchpad, you can return to your main course page at any time by clicking th
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!