Your cart is currently empty!
Outcomes: Write programs that obtain user input Write programs that compute mathematical results Write programs that work with Strings Write programs that display numbers formatted according to a given specification Format and comment source code that adheres to a given set of formatting guidelines Scoring: At a bare minimum, the program you submit must…
Outcomes:
Scoring:
At a bare minimum, the program you submit must have the assigned source code, and your source code must compile and run without crashing.
Full credit | No credit or Partial credit | |
Get console input
(8 points) |
Using a Scanner, the program obtains user input, formatted as specified | Program does not use keyboard input, or uses it in a manner inconsistent with specifications |
Compute triangle measures
(12 points) |
Program correctly computes all mathematical measures (side lengths, perimeter, area, centroid, incircle radius, and incircle area) | There are mathematical errors in computation |
Format console output
(10 points) |
Screen output is formatted as specified, including converting vertex letters to uppercase | Screen output does not match specifications |
Preliminaries:
Before beginning to code, use the following website, http://tube.geogebra.org/m/1601355, to experiment with the triangle. This will be useful as you code, because it will let you create triangles to test with your Java program. Note that:
Also, do a little research on incircles. The incircle of a triangle is the largest circle that can fit inside it. An example of a triangle and its incircle are shown here:
Also, you need to be able to extract letters from a String and to convert a String to uppercase. The charAt(), substring(), and toUpperCase() methods are useful. You may choose to use one or more of these in the assignment.
Requirements: You will write one Java class, TriangleMath
Your program should:
Below is a sample run of the program. Your program should be formatted as close to that sample as possible, including spacing, rounding (all values rounded to three places after the decimal point), and so on. The more closely you match, the better. Note that the user input is shown in bold and red. You are NOT supposed to print those. Those are typed by the user.
Submission requirement (2 point deduction for incorrect submission):
Sample run. Your program should match this format as closely as possible
Enter a three letter name for your triangle: jqc
Coordinates of vertex J: .1 .1 Coordinates of vertex Q: 2.2 .1 Coordinates of vertex C: 1.15 .7
— Side lengths — JQ: 2.100 QC: 1.209 CJ: 1.209
— Other measures — Perimeter = 4.519 Area = 0.630 Centroid = (1.150, 0.300) Incircle radius = 0.279 Incircle area = 0.244 |