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
How do i delete an account for brainly how do i delete everything
soldi70 [24.7K]

Answer:

The only way ik you can do that is to sign out hope i helped

Explanation:

4 0
3 years ago
Read 2 more answers
TP1. लेखा अभिलेखको अर्थ उल्लेख गर्नुहोस् । (State the mea
schepotkina [342]

Explanation:

TP1. लेखा अभिलेख भनेको ज्ञानको त्यस्तो शाखा हो, जुन व्यवसायको आर्थिक कारोबारहरूलाई नियमित, सु-व्यवस्थित र क्रमबद तरिकाले विभिन्न पुस्तिकाहरूमा अभिलेख गर्ने कार्यसँग सम्बन्धित छ।

5 0
3 years ago
Write the Q basic program to find the area of room.​
Mkey [24]

Explanation:

CLS

Input length

Input breadth

A= l*b

Print" the area of a room is"; A

END

8 0
3 years ago
Michael needs to ensure that those items that are automatically archived are still easily accessible within Outlook. Which optio
rjkz [21]

Answer:

D.   Show archive folder in folder list

Explanation:

Other dude is wrong

8 0
3 years ago
Read 2 more answers
What is the term for the error caused when one end of an unshielded twisted-pair (UTP) cable is terminated in the T568A configur
FinnZ [79.3K]

Answer:

A transposition is the correct answer.

Explanation:

A transposition is the type of encryption that caused when one side of the unshielded twisted pair cable is finished in the configuration of  T568A and at the other side of the configuration of T568B, it is also termed as error or cipher. So, that's why the following answer is true.

7 0
3 years ago
Other questions:
  • What kind of problems could you run into if you format a cell with the wrong format for the data type?
    15·2 answers
  • What special member function of a class is called whenever an instance of a class is created and initialized?
    15·1 answer
  • In the software development life cycle, what is the role of participants in the planning phase? The participants’ role in the pl
    6·1 answer
  • Ansel Adams education and special training
    14·1 answer
  • Write a recursive, bool-valued function, containsVowel, that accepts a string and returns true if the string contains a vowel. A
    5·1 answer
  • What are some of the causes for error 1921 when updating?
    11·2 answers
  • 3s X 82 = X +y? is this true
    10·2 answers
  • What is connectivity?
    15·2 answers
  • What is obamams last name
    9·2 answers
  • Catherine, a web designer, has created new content for a client's website. In order to update the company website, she needs to
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!