{"id":1926,"date":"2017-04-29T11:40:00","date_gmt":"2017-04-29T11:40:00","guid":{"rendered":"https:\/\/www.testingdocs.com\/questions\/?p=1926"},"modified":"2024-09-27T07:16:50","modified_gmt":"2024-09-27T07:16:50","slug":"write-a-java-program-to-calculate-area-of-circle","status":"publish","type":"post","link":"https:\/\/www.testingdocs.com\/questions\/write-a-java-program-to-calculate-area-of-circle\/","title":{"rendered":"Java program to calculate Area of Circle"},"content":{"rendered":"<h2>Java program to calculate the Area of Circle<\/h2>\r\n<p>Write a Java program to calculate the Area of the Circle. On this page, we will write a Java program to calculate the area of the circle. Before writing the program we will analyze the IPO of the program.<\/p>\r\n<h2>IPO Chart<\/h2>\r\n<p>Input: The data, resources, etc that enter the system.<br \/>Process: The actions, operations, or calculations that transform inputs into outputs by the program.<br \/>Output: The final results, and outputs produced by the system.<\/p>\r\n<h2>Input<\/h2>\r\n<p>The radius of the circle<\/p>\r\n<h2>Process<\/h2>\r\n<p>Area of Circle = pi * r * r<\/p>\r\n<h2>Output\u00a0<\/h2>\r\n<p>Area of Circle<\/p>\r\n<h3><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1928\" src=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Area-of-Circle-.png\" alt=\"\" width=\"1129\" height=\"585\" title=\"\" srcset=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Area-of-Circle-.png 1129w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Area-of-Circle--300x155.png 300w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Area-of-Circle--1024x531.png 1024w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Area-of-Circle--768x398.png 768w\" sizes=\"auto, (max-width: 1129px) 100vw, 1129px\" \/><\/h3>\r\n<h2>Java Program<\/h2>\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">import java.util.Scanner;\r\n\r\n\/**************************************************\r\n * CircleDemo.java\r\n * @program \t: Area of Circle\r\n * @web    \t: www.TestingDocs.com\r\n * @author    \t:  \r\n * @version   \t: 1.0\r\n **************************************************\/\r\npublic class CircleDemo {\r\n  \/\/main\r\n  public static void main(String[] args) {\r\n    Scanner keyboard = new Scanner(System.in);\r\n    double radius, areaCircle;\r\n    System.out.print(\"Enter Radius of the Circle := \");\r\n    radius = keyboard.nextDouble();\r\n    \/\/ formula = pi r square\r\n    areaCircle = Math.PI*radius*radius;\r\n    System.out.println(\"Area of Circle = \"+ areaCircle);\r\n    keyboard.close();\r\n  } \/\/ end main\r\n} \/\/ end CircleDemo\r\n<\/pre>\r\n<p>&nbsp;<\/p>\r\n<h2>Sample Output<\/h2>\r\n<p>Sample output of the program is as follows:<\/p>\r\n<p>Enter Radius of the Circle := 3.5<br \/>Area of Circle = 38.48451000647496<\/p>\r\n<h3>\u00a0<\/h3>\r\n<h2>Screenshot<\/h2>\r\n<p>Screenshot of the program in the IDE.<\/p>\r\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1929\" src=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Area-Of-Circle-Java-Program.png\" alt=\"\" width=\"1363\" height=\"705\" title=\"\" srcset=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Area-Of-Circle-Java-Program.png 1363w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Area-Of-Circle-Java-Program-300x155.png 300w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Area-Of-Circle-Java-Program-1024x530.png 1024w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Area-Of-Circle-Java-Program-768x397.png 768w\" sizes=\"auto, (max-width: 1363px) 100vw, 1363px\" \/><\/p>\r\n<p>&nbsp;<\/p>\r\n<h2>Java Tutorials<\/h2>\r\n<p>Java Tutorial on this website:<\/p>\r\n<ul>\r\n<li><a href=\"https:\/\/www.testingdocs.com\/java-tutorial\/\">https:\/\/www.testingdocs.com\/java-tutorial\/<\/a><\/li>\r\n<\/ul>\r\n<p>For more information on Java, visit the official website :<\/p>\r\n<ul>\r\n<li><a href=\"https:\/\/www.oracle.com\/java\/\" target=\"_blank\" rel=\"noopener\">https:\/\/www.oracle.com\/java\/<\/a><\/li>\r\n<\/ul>\r\n","protected":false},"excerpt":{"rendered":"<p>Java program to calculate the Area of Circle Write a Java program to calculate the Area of the Circle. On this page, we will write a Java program to calculate the area of the circle. Before writing the program we will analyze the IPO of the program. IPO Chart Input: The data, resources, etc that [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[24],"class_list":["post-1926","post","type-post","status-publish","format-standard","hentry","category-java-programs","tag-java-programs","has-post-title","has-post-date","has-post-category","has-post-tag","has-post-comment","has-post-author",""],"_links":{"self":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts\/1926","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/comments?post=1926"}],"version-history":[{"count":11,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts\/1926\/revisions"}],"predecessor-version":[{"id":19771,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts\/1926\/revisions\/19771"}],"wp:attachment":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/media?parent=1926"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/categories?post=1926"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/tags?post=1926"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}