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

Write a program to test for the case of a math equation

Write a program to test for the case of a math equation entered via the keyboard using the SWITCH-CASE operator. Types of equations to test for: x + y  x / y   x * y and x - y. The program is to ask for the following: 1. ...

This assignment introduces you to the perl language and cgi

This assignment introduces you to the Perl language and CGI programming. You will use your scripting and html skills to build a Perl program that will gather user input to then generate a personal webpage. This program w ...

You must do this assignment correctly as described

You must do this assignment correctly as described below.  If you do not follow the directions or break the rules you will receive a 0 score. Simulation of checking tic-tac-toe board for wins by counting X and O in rows, ...

Questioncomplete tutorial 10 case problem 2 - ridgewood

Question: Complete Tutorial 10 Case Problem 2 - Ridgewood Herald Tribune found on pages 734-736 of your textbook. Complete the entire website assignment and upload your files to your 000WebHost account. After uploading t ...

Assignmentthis assignment will be marked out of 100 and

Assignment This assignment will be marked out of 100 and carries 30% of the overall module weighting. Your .java files and report for this part must be uploaded to WebLearn and submitted by 3pm on Wednesday 27th April 20 ...

The given machine description will provide the basis for

The given machine description will provide the basis for this assignment. You will create a virtual machine/operating system for the machine described below that will accept programs in the target machine language. The d ...

Programming assignment 1 grocery storethis assignment

Programming Assignment #1: Grocery Store This assignment attempts to serve as a refresher for concepts that I hope you learned in CS 122. In this assignment, you will be building a simple storefront for a small grocery s ...

The briefyour small development team of ideally three

The Brief Your small development team of (ideally) three people has been asked to implement and test the Human Resource Information System desktop application. Your software product will be a database- backed desktop app ...

Part a-1 what arguments can you make for the idea of a

Part A- 1. What arguments can you make for the idea of a single programming language for all programming domains? It would be ideal to have a single programming language for all 2. What arguments can you make against the ...

Consider the following three programswhere i k l are low

Consider the following three programs: where i, k, l are low variables and a, b, c, d, h, n are high variables. Assume db is a database with two columns (shown as array, where the index represents the row), lookup and is ...

  • 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

A cola-dispensing machine is set to dispense 9 ounces of

A cola-dispensing machine is set to dispense 9 ounces of cola per cup, with a standard deviation of 1.0 ounce. The manuf

What is marketingbullwhat is marketing think back to your

What is Marketing? • "What is marketing"? Think back to your impressions before you started this class versus how you

Question -your client david smith runs a small it

QUESTION - Your client, David Smith runs a small IT consulting business specialising in computer software and techno

Inspection of a random sample of 22 aircraft showed that 15

Inspection of a random sample of 22 aircraft showed that 15 needed repairs to fix a wiring problem that might compromise

Effective hrmquestionhow can an effective hrm system help

Effective HRM Question How can an effective HRM system help facilitate the achievement of an organization's strate