answer.
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
2 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]2 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]2 years ago
5 0

Answer:

i need free point sorry lol

Explanation:

You might be interested in
Show how to define a view tot_credits (year, num_credits), giving the total number of credits taken by students in each year
andreev551 [17]

Hi! I'm a Digital Marketer Intern at hotels.ng and I have a moderate knowledge on programming.

First, your  question is not very explanatory. The term "view" is often used in back-end web development. A view is simply a Python function that takes a Web request and returns a Web response.

But I'm not sure this is what you want, so I'll just go ahead and write a python function involving class to return the total number of credits taken by a student.

I'll answer this question using Python.

class student(object):  

    credits = None

    year = None

    def num_credits(self):


       #get credit value

       self.credits = input("Enter the total number of credits: "  )


       pass

    def getYear(self):

        self.year = input("Enter current year: ")

        pass

    def tot_credits(self):

          TotalCredits = tempTotalCredits + self.num_credits

           print "Your  total credits are :"+" "+str(TotalCredits)




3 0
2 years ago
Write a class named Employee that has private data members for an employee's name, ID_number, salary, and email_address. It shou
mario62 [17]

Solution :

class Employee:

   #Define the

   #constructor.

   def __$\text{init}$__($\text{self, nam}e$,  ID_number, $\text{salary}$, email):

       #Set the values of

       #the data members of the class.

       $\text{self.nam}e$ = name

       $\text{self.ID}$_number = ID_number

       $\text{self.salary}$ = salary

       self.email_address = email

#Define the function

#make_employee_dict().

def make_employee_dict(list_names, list_ID, list_salary, list_email):

   #Define the dictionary

   #to store the results.

   employee_dict = {}

   #Store the length

   #of the list.

   list_len = len(list_ID)

   #Run the loop to

   #traverse the list.

   for i in range(list_len):

       #Access the lists to

       #get the required details.

       name = list_names[i]

       id_num = list_ID[i]

       salary = list_salary[i]

       email = list_email[i]

       #Define the employee

       #object and store

       #it in the dictionary.

       employee_dict[id_num] = Employee(name, id_num, salary, email)

   #Return the

   #resultant dictionary.

   return employee_dict

6 0
1 year ago
Drag each label to the correct location on the image.
pantera1 [17]

Answer:

1.computer-based  training modules  is an example of hierarchical technique.

Explanation:

Computer based training modules are the example of hierarchical model or technique of website. In this technique courses or modules are linked with each other in hierarchical structure. To start some advance module we should learn some basic modules first.

2.school website is an example of Linear Structure of Website.

Explanation:

In linear structure of website, pages are linked in a sequence. We can follow the links to find some information in sequential manner.

3.bookstore  website is an example of Linear Structure of Website.

Explanation:

In linear structure of website, pages are linked in a sequence. We can follow the links to find some information in sequential manner.

4.single-product  websites is an example of Linear Structure of Website.

Explanation:

In linear structure of website, pages are linked in a sequence. We can follow the links to find some information in sequential manner.

5.county library  website is an example of Webbed technique.

Explanation:

Computer based training modules are the example of webbed model or technique of website. In this technique many pages are connected or linked to many other pages and each page can access any other page. This is a complex structure of website.

6.online gift store  website is an example of Linear Structure of Website.

Explanation:

In linear structure of website, pages are linked in a sequence. We can follow the links to find some information in sequential manner.

7.federal government  website is an example of Webbed technique.

Explanation:

Computer based training modules are the example of webbed model or technique of website. In this technique many pages are connected or linked to many other pages and each page can access any other page. This is a complex structure of website.

3 0
2 years ago
The most commonly used method to connect to a WAN is through the telephone system. To do so, what piece of equipment would you r
Step2247 [10]

Modems create an analog signal that carries digital data on it,
and strip the digital data from an analog signal that they receive. 
That's what's needed to connect through the telephone system,
since the telephone system is still one big analog system.


8 0
2 years ago
Read 2 more answers
Animated graphics that are displayed on the screen after a set of time when the computer is unattended.​
yan [13]

Answer:

Tab b. CTRL+A c. Alt d. Enter 18. Animated graphics that are displayed on the screen after a set of time when the computer is unattended. a. Screen Saver b. Title Bar c. Scroll Bar d.

Explanation:

Tab b. CTRL+A c. Alt d. Enter 16. Animated graphics that are displayed on the screen after a set of time when the computer is unattended

Computer-generated motion graphics[edit]. Before computers were widely available, motion graphics were costly and time-consuming, limiting their use to high-budget filmmaking and ...

7 0
1 year ago
Other questions:
  • What is the major function of the network access layer?
    5·1 answer
  • Prove that any amount of postage greater than or equal to 64 cents can be obtained using only 5-cent and 17-cent stamps?
    15·1 answer
  • Gabe wants to move text from one document to another document. He should _____.
    10·2 answers
  • Classify the given items as belonging to the public domain or protected by copyright law.
    6·2 answers
  • Topological sort requires only a tiny addition to the DFS algorithms. Exactly one of the following data structures is required t
    9·1 answer
  • What company built its first computer from a wooden box
    12·2 answers
  • A file concordance tracks the unique words in a file and their frequencies. Write a program that displays a concordance for a fi
    6·1 answer
  • Write multiple if statements: If carYear is before 1968, print "Probably has few safety features." (without quotes). If after 19
    6·1 answer
  • You are using a polynomial time 2-approximation algorithm to find a tour t for the metric traveling salesman problem. Which of t
    7·1 answer
  • Which of the following is an advantage of inserting a page number field in your document rather than inserting each page number
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!