Write a program that will represent an axis-aligned right

This preview shows page 1 - 5 out of 13 pages.

Write a program that will represent an axis-aligned right
CSE1222 Spring 2014 CSE1222 Lab 13 2 of the triangle is the length of the leg parallel with the x- axis. The height of the triangle is the length of the leg parallel with the y-axis. The procedure main() (see the code template triangles_template.cpp) has been written for you (DO NOT change anything in the main() procedure) as well as the member attributes of the Class Triangle. You will write code for the member functions of the Class Triangle and also helper functions as indicated by the comments /* INSERT CODE HERE */. Run triangles_solution.exe to see an example of the program. A sample run of the program would look like this (bold indicates what the user will enter):
> triangles.exe Enter first file name: first.txt Enter bottom left x coordinate: 0 Enter bottom left y coordinate: 0 Enter length: 5 Enter height: 10 Enter second file name: second.txt Enter scale factor in x direction: 2 Enter scale factor in y direction: 1.5 After running, the output file called first.txt contains: ---------------------------------------- Lower Left Vertex (0, 0) Top Left Vertex (0, 10) Bottom Right Vertex (5, 0) Dimensions (5, 10) Hypotenuse = 11.1803 Perimeter = 26.1803 ---------------------------------------- and the output file called second.txt contains: ---------------------------------------- Lower Left Vertex (0, 0) Top Left Vertex (0, 15) Bottom Right Vertex (10, 0) Dimensions (10, 15) Hypotenuse = 18.0278 Perimeter = 43.0278 ---------------------------------------- CSE1222 Spring 2014
CSE1222 Lab 13 3 To view the contents of the file, type cat first.txt and cat second.txt. Your program must work for any file names and any triangle attribute values entered by the user, i.e. not just the user input given in the example above.

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture