{"id":1948,"date":"2017-05-06T06:32:00","date_gmt":"2017-05-06T06:32:00","guid":{"rendered":"https:\/\/www.testingdocs.com\/questions\/?p=1948"},"modified":"2024-11-16T14:57:53","modified_gmt":"2024-11-16T14:57:53","slug":"java-program-to-compute-simple-interest-on-the-principal-amount","status":"publish","type":"post","link":"https:\/\/www.testingdocs.com\/questions\/java-program-to-compute-simple-interest-on-the-principal-amount\/","title":{"rendered":"Java program to compute simple interest on the principal amount."},"content":{"rendered":"<h1>Problem Statement<\/h1>\r\n<p>Write a Java program to compute simple interest on the given principal amount. In this tutorial, we will write a simple java program to compute the simple interest amount.<\/p>\r\n<p>Before writing the program, we would analyze the IPO(Input-Process-Output) of the program as given below.<\/p>\r\n<h2>IPO chart<\/h2>\r\n<p>Input to the Program:<\/p>\r\n<ul>\r\n<li>P = principal Amount<\/li>\r\n<li>R = Rate per annum<\/li>\r\n<li>T = Time (years)\u00a0<\/li>\r\n<\/ul>\r\n<h2>Process<\/h2>\r\n<p>Simple Interest = P\u00a0*\u00a0T\u00a0*\u00a0R\u00a0100<\/p>\r\n<h2>Eclipse IDE Setup<\/h2>\r\n<p>Some steps and instructions to create a Java application on Eclipse IDE:<\/p>\r\n<ul>\r\n<li>Create Java Project in Eclipse<\/li>\r\n<\/ul>\r\n<p><a href=\"https:\/\/www.testingdocs.com\/create-a-new-java-project-in-eclipse\/\">https:\/\/www.testingdocs.com\/create-a-new-java-project-in-eclipse\/<\/a><\/p>\r\n<ul>\r\n<li>Create Java Package in Eclipse<\/li>\r\n<\/ul>\r\n<p><a href=\"https:\/\/www.testingdocs.com\/create-java-package-in-eclipse-ide\/\">https:\/\/www.testingdocs.com\/create-java-package-in-eclipse-ide\/<\/a><\/p>\r\n<ul>\r\n<li>Create Java Class in Eclipse<\/li>\r\n<\/ul>\r\n<p><a href=\"https:\/\/www.testingdocs.com\/create-a-new-java-class-in-a-project\/\">https:\/\/www.testingdocs.com\/create-a-new-java-class-in-a-project\/<\/a><\/p>\r\n<ul>\r\n<li>Run Java Project in Eclipse<\/li>\r\n<\/ul>\r\n<p><a href=\"https:\/\/www.testingdocs.com\/run-java-project-in-eclipse\/\">https:\/\/www.testingdocs.com\/run-java-project-in-eclipse\/<\/a><\/p>\r\n<h2>Java Program<\/h2>\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">package com.testingdocs.simple;\r\n\r\nimport java.util.Scanner;\r\n\r\n\/**************************************************\r\n * SimpleInterest.java\r\n * @program   \t: \r\n * @web        \t: www.TestingDocs.com\r\n * @author      :  \r\n * @version     : 1.0\r\n **************************************************\/\r\n\r\npublic class SimpleInterest {\r\n\r\n  public static void main(String[] args) {\r\n    \r\n    Scanner input = new Scanner(System.in);\r\n    \/\/ Variables used \r\n        double principal, rateOfInterest , timeInYears;\r\n        double simpleInterest;\r\n        \/\/ Prompt user for input\r\n        System.out.println(\"Enter principal amount:= \");\r\n        principal = input.nextDouble();\r\n        System.out.println(\"Enter rate of interest:= \");\r\n        rateOfInterest= input.nextDouble();\r\n        System.out.println(\"Enter time duration in years := \");\r\n        timeInYears = input.nextDouble();\r\n        \r\n        \/\/Calculation\r\n        simpleInterest = ( principal * rateOfInterest * timeInYears )\/100;\r\n        \/\/Output\r\n        System.out.println(\"Simple Interest = \" + simpleInterest);\r\n  }\r\n\r\n}\r\n<\/pre>\r\n<h2>Screenshot<\/h2>\r\n<p>&nbsp;<\/p>\r\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1950\" src=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Simple-Intrest.png\" alt=\"\" width=\"1812\" height=\"1026\" title=\"\" srcset=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Simple-Intrest.png 1812w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Simple-Intrest-300x170.png 300w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Simple-Intrest-1024x580.png 1024w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Simple-Intrest-768x435.png 768w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Simple-Intrest-1536x870.png 1536w\" sizes=\"auto, (max-width: 1812px) 100vw, 1812px\" \/><\/p>\r\n<p>&#8212;<\/p>\r\n<h2>Java Tutorial<\/h2>\r\n<p>Java Tutorial on this website:<\/p>\r\n<p><strong><a href=\"https:\/\/www.testingdocs.com\/java-tutorial\/\">https:\/\/www.testingdocs.com\/java-tutorial\/<\/a><\/strong><\/p>\r\n<p>More information on Java can be found on the official website:<\/p>\r\n<p><strong><a href=\"https:\/\/www.oracle.com\/in\/java\/\" rel=\"noopener\">https:\/\/www.oracle.com\/in\/java\/<\/a><\/strong><\/p>\r\n<!--themify_builder_content-->\n<div id=\"themify_builder_content-1948\" data-postid=\"1948\" class=\"themify_builder_content themify_builder_content-1948 themify_builder tf_clear\">\n    <\/div>\n<!--\/themify_builder_content-->\n","protected":false},"excerpt":{"rendered":"<p>Problem Statement Write a Java program to compute simple interest on the given principal amount. In this tutorial, we will write a simple java program to compute the simple interest amount. Before writing the program, we would analyze the IPO(Input-Process-Output) of the program as given below. IPO chart Input to the Program: P = principal [&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":[],"class_list":["post-1948","post","type-post","status-publish","format-standard","hentry","category-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\/1948","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=1948"}],"version-history":[{"count":9,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts\/1948\/revisions"}],"predecessor-version":[{"id":21765,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts\/1948\/revisions\/21765"}],"wp:attachment":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/media?parent=1948"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/categories?post=1948"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/tags?post=1948"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}