Ask Question, Ask an Expert

+1-415-315-9853

info@mywordsolution.com

Ask Programming Language Expert

prepare a program that would allow the user to input the corners of a triangle. The program would draw small yellow circles for each input point, then draw the triangle and compute the perimeter and area of the triangle. The program will also draw the "mirror image" of the triangle, formed by swapping the x and y coordinates of each point. This is sometimes called the "reflection" of an object.

These actions would then be repeated 4 more times for triangles in different colors.
The equation for the perimeter is length of each of the three sides added together. Use the distance formula from Program 1 (it was used for finding the radius there).

The area of a triangle could be computed using these equations (a, b and c are the lengths of the three sides of the triangle):

646_Herons formula.jpg

The program must report the perimeter and area of each triangle and its reflection. It must also keep a total of each of those 2 measures and report the total when the program is about to end. The totals must include all triangles, including reflections. Note that the output samples also show a counter "Triangle 1", "Triangle 2", etc.

The list of colors it should use for triangles is ["red", "blue", "green", "pink", "black"].

• This program uses input from the mouse; remember to print the prompt to the user on the shell for the points.

• Use assignment statements to carry out the calculations, not output statements.

• You must use a for loop to control the color changes.

• Hint: make the triangle objects by using Polygon with 3 points as arguments.

• You should use at least one function from the math library.

• Obviously you should use several graphics functions.

• Do not forget to pause the program at the end and ask the user for a click, then close the graphics window.

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M91859

Have any Question? 


Related Questions in Programming Language

Design a project to allow a student to access current

Design a project to allow a student to access current grades and/or create a "What-if" situation on a continuing basis to understand where they are at any given point in the semester. You will need to calculate multiple ...

Create an application for a company to save and display

Create an application for a company to save and display customer information. Begin with designing class named Person with the following properties: · LastName (String) · FirstName (String) · Address (String) · City (Str ...

1 take into account the number of hours worked if the

1.) take into account the number of hours worked. If the hours is greater than 40, then calculate 1.5 times the rate times the hours over 40. Add the overtime pay to the regular pay, calculated by multiplying rate times ...

A theater-seating chart is implemented as a two-dimensional

A theater-seating chart is implemented as a two-dimensional array of ticket prices, like this: ROW 6: 10 10 10 10 10 10 10 10 10 10 ROW 5: 10 10 10 20 20 20 20 10 10 10 ROW 4: 20 20 20 20 20 20 20 20 20 20 ROW 3: 20 20 3 ...

Create a program that allows the user to enter sets of

Create a program that allows the user to enter sets of integer values, in any order.Per set of data,the program is to output the largest number. EXAMPLE 1 Given the set of supplied values:(1,-3,22,-30),the program should ...

Assignmentcollege maintains a file of credit hours

Assignment College maintains a file of credit hours completed for their students, named CREDITS.TXT. Each line of the file contains: • the student's ID number (an 8-character string, containing 2 letters followed by 6 di ...

Assignmentwrite a program that calculates the intersection

Assignment Write a program that calculates the intersection of two sets of numbers. The sets can be represented using arrays. The general idea is that A!=0 if i is in the set and A==0 if it is not. Array element A can th ...

Assignment instructionsexception handlingfirst create three

Assignment Instructions Exception Handling First, create three exception classes named NumberHighException, NumberLowException, and NumberNegativeException. Both NumberHighException and NumberLowException should be direc ...

Fr each of the following c assignment statementsa x a

For each of the following C assignment statements a) x = a + b*c; b) x = a/(b+c) - d*(e+f); c) x = a[i] + 1; d) a[i] = b[c[i]]; e) a[i][j] = b[i][k] + c[k][j]; f) *p++ = *q++; generate three-address code, assuming that a ...

Generate code for the following three-address statements

Generate code for the following three-address statements assuming a and b are arrays whose elements are 4-byte values. a) The four-statement sequence x = a[i] y = b[j] a[i] = y b[j] = x b) The three-statement sequence x ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Section onea in an atwood machine suppose two objects of

SECTION ONE (a) In an Atwood Machine, suppose two objects of unequal mass are hung vertically over a frictionless

Part 1you work in hr for a company that operates a factory

Part 1: You work in HR for a company that operates a factory manufacturing fiberglass. There are several hundred empl

Details on advanced accounting paperthis paper is intended

DETAILS ON ADVANCED ACCOUNTING PAPER This paper is intended for students to apply the theoretical knowledge around ac

Create a provider database and related reports and queries

Create a provider database and related reports and queries to capture contact information for potential PC component pro

Describe what you learned about the impact of economic

Describe what you learned about the impact of economic, social, and demographic trends affecting the US labor environmen