Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help with number 1 Programming Assignment II COSC 1336 1. [20 points] Write a Java program named PentagonArea that prompts the user to enter

image text in transcribedPlease help with number 1

Programming Assignment II COSC 1336 1. [20 points] Write a Java program named PentagonArea that prompts the user to enter the length from the center of a pentagon to a vertex and computes the area of the pentagon as shown in the following figure. The formula for computing the area of a pentagon is: Area- 5 x s2 45), [this is tan(Pi divided by 5), for the constant Pi, use Math.PI where, s is the length of a side. The value s can be computed by the formula S-2xrxsin(Pi/5), Where r is the length from the center of the pentagon to a vertex. Round up two digits after the decimal point. Here is a sample run of the program: Enter the length from the center to a vertex: 5.5 The area of the pentagon is 71.92 [30 points] Create a MathTutor Java application that displays math problems by randomly generating two integer numbers, 0 through 10, and an operator: *, +, -, /(use a random number from 1 to 4 to represent the operator; i.e. 1 for +,2 for 3 for *,4 for) and then prompts the user for an answer. Remember that if the operator is division () you should make sure the denominator is not zero. If it is, then generate another random number. Also, if the operator is division () or subtraction (-) and the second random integer number is greater than the first one, swap the two numbers. The application should check the answer, display a message, and the correct answer, if necessary. The application output should look similar to: 2. What is 2 9? 18

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

More Books

Students also viewed these Databases questions