VB icon

Area of the Triangle in Java

Email
Submitted on: 9/5/2015 3:08:30 AM
By: Jake R. Pomperada  
Level: Beginner
User Rating: Unrated
Compatibility: Java (JDK 1.1), Java (JDK 1.2), Java (JDK 1.3), Java (JDK 1.4), Java (JDK 1.5)
Views: 3104
author picture
 
     In this article I would like to share with you a sample program that I wrote using Java programming language I called this program area of the triangle. What does the program will do is to ask the base and height of the triangle and then it will compute its area. If you have some questions about programming, about my work please send me an email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com. People here in the Philippines can contact me at my mobile number 09173084360. Thank you very much and Happy Programming.

 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
//**************************************
// Name: Area of the Triangle in Java
// Description:In this article I would like to share with you a sample program that I wrote using Java programming language I called this program area of the triangle. What does the program will do is to ask the base and height of the triangle and then it will compute its area.
If you have some questions about programming, about my work please send me an email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com. People here in the Philippines can contact me at my mobile number 09173084360.
Thank you very much and Happy Programming.
// By: Jake R. Pomperada
//**************************************

// area_of_the_triangle.java
// Written By: Mr. Jake R. Pomperada, BSCS, MAED-IT
// July 9, 2015Thursday
// Email Address: jakerpomperada@gmail.com 
// jakerpomperada@yahoo.com
import java.util.Scanner;
 
public class area_of_the_triangle {
 
public static void main(String[] args) {
 Scanner input = new Scanner(System.in);
 char ch;
 double base_triangle = 0;
 double height_triangle = 0;
 double solve_area = 0;
 do {
 System.out.println();
 System.out.print("\tAREA OF THE TRIANGLE SOLVER ");
 System.out.println("\n\n");
 System.out.print("What is the length of base of the triangle : "); 
 base_triangle = input.nextDouble();
 
 System.out.print("What is the length of height of triangle : "); 
 height_triangle = input.nextDouble();
 
 solve_area = (base_triangle * height_triangle) / 2;
 
 System.out.println();
 System.out.println("The Area of Triangle is : " + solve_area + ".");
 System.out.println();
 System.out.print("\nDo you want to continue (Type y or n) : ");
 ch = input.next().charAt(0);
 } while (ch == 'Y'|| ch == 'y'); 
 System.out.println();
 System.out.print("\t THANK YOU FOR USING THIS PROGRAM");
 System.out.println("\n\n");
}
 
}


Other 53 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.