CS 1400 Lab #14: Triangle Calculator


Objectives:

Recall that an application's data and the methods that work on that data are encapsulated in what we call a Domain Class. The domain class contains the business logic of the application. The work to manage the user interface goes into the Form class.

Study Material

Using Domain Objects

Designing a Domain class.

In this lab will design a Domain class that represents a right triangle. What data members would this class need? Remember that you can uniquely define a right triangle with just the values of the sides adjacent to the right angle. Everything else that you need to know about the triangle you can calculate. What methods would you need to do these calculations? What methods would you need to set the values of the sides a and b?

Create a class diagram for your Triangle class. You can draw this by hand and submit a photo of your diagram, or use some drawing software and submit an electronic version. A PDF file is preferred if you are going to submit an electronic version.

Questions

When you submit your lab, add comments to your submission that answer the following questions. Suppose that you are going to use the domain class you have designed in this lab in a Console program. Tell me where the following code belongs - In the domain class, or in the Main method: (1) The code that outputs the value of the hypotenuse, so that the user can see it. (2) The code that calculates the hypotenuse of the triangle.

File(s) to Submit:

Place your UML class diagram in a zip file and name the zip file lab_14_your-initials_V1.0.zip. For example, I would name my file lab_14_RKD_V1.0.zip. Submit this assignment as Lab #14 on Canvas. Do not submit any other files.

Grading Guidelines

Description Points possible

Assignment meets grading guidelines:
o Your Class Diagram contains a declaration that this is your own work.
o Assignment has been properly submitted to Canvas

2

You have a correctly drawn Class Diagram that models a triangle.

3

You have a correctly answered the questions in this lab.

2
Total 7