SAMPLE: Writing a program to input 2 triangle edge and the angle
between those ones, then compute and display the area of that triangle.
Formula:
Solution :
Open NetBean, create a new project, names Project, then chose Finish.
Input the name of the Project is BaitapB2
In Project window, right click to the
package baitapb2, choose New/Java Class..
Type name of new
class at Class Name and choose Finish to create class.
Name of this class: BaitapDemo
Type code to
input 2 edge, and angle then compute the triangle area as follows:
To run class BaitapDemo, open class BaitapB2, create an instance of class BaitapDemo and click on Run icon or
press F6.
Exercises: From
the sample exercise, do follows exercises:
1: Compute nth
root of x, knowing
. Input values of x and n from keyboard.
2: Write a
program to compute the area of a triangle
Applying the formula:
with
when a, b, c are 3 edges of a triangle
and are input from keyboard.
3: Write a
program to compute the distance between a point I(x0, y0)
To a line which has
equation D: Ax + By + C = 0.
Require: Input values of x0, y0, A, B, C from keyboard.
Suggest: Formula
to compute the distance
No comments
Post a Comment