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
(TELL ME WHY PLEASE!! THANK YOU!!)
Jobisdone [24]
I would say D because in order to be flexible you have to be able to work around or with something in orded for it to still work hope this helped!!
4 0
3 years ago
Read 2 more answers
What will help the programmer understand what’s going on in the program?
Over [174]

Answer:

Programming languages to help solve algorithms

Explanation:

6 0
3 years ago
What would be a standard way for anyone outside an agile team( for example, delivery partner partner of the account, head of the
musickatia [10]

Answer:

He/She can refer the physical/digital kanboard ,which is maintained by the team

7 0
3 years ago
While Joe's wife Molly and daughter Sunny did not mind moving,his son Daniel was not too happy with the sudden change in their l
Ann [662]

It means your stupid look it up!!

6 0
3 years ago
Which of the following correctly defines a procedure in computer programming? Choose all the apply.
Kazeer [188]

Explanation:

A code block programmers can reuse multiple times

3 0
4 years ago
Read 2 more answers
Other questions:
  • True or False? A supervisory control and data acquisition (SCADA) device is a computer that controls motors, valves, and other d
    13·1 answer
  • You are asked to install a device that will combine several connections to the Internet and provide the sum of the available net
    8·2 answers
  • How are appointments scheduled in medisoft
    12·1 answer
  • What is the purpose of using SmartArt Graphics and what is one way you can use SmartArt Graphics in your presentation(s)?
    11·1 answer
  • A new computer workstation has been installed in a small office. the user of the workstation can print a document using a networ
    9·1 answer
  • Technology offers a variety of rich opportunities available to teachers and students. According to Inan and Lowther (2010), ther
    6·1 answer
  • A network administrator has configured ​VLAN 99 as the management VLAN and has configured it with an IP address and subnet mask.
    7·1 answer
  • Helllllllllppppppppppp
    9·1 answer
  • Walter has an associate's degree in computer science and aspires to become a web developer. Which certification will help enhanc
    14·1 answer
  • Your client Mr. Smith has requested a reservation at Eleven Madison Park this evening for a party of 2 at 6PM. Unfortunately, th
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!