{"id":1364,"date":"2022-03-03T07:32:56","date_gmt":"2022-03-03T07:32:56","guid":{"rendered":"https:\/\/mdr.foobrdigital.com\/?p=1364"},"modified":"2022-03-03T07:32:56","modified_gmt":"2022-03-03T07:32:56","slug":"calculate-simple-interest","status":"publish","type":"post","link":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/2022\/03\/03\/calculate-simple-interest\/","title":{"rendered":"Calculate simple interest\u00a0"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">&nbsp;Calculate Simple Interest in Java<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>import java.util.Scanner;\n\nclass Main {\n  public static void main(String&#91;] args) {\n\n    \/\/ create an object of Scanner class\n    Scanner input = new Scanner(System.in);\n\n    \/\/ take input from users\n    System.out.print(\"Enter the principal: \");\n    double principal = input.nextDouble();\n\n    System.out.print(\"Enter the rate: \");\n    double rate = input.nextDouble();\n\n    System.out.print(\"Enter the time: \");\n    double time = input.nextDouble();\n\n    double interest = (principal * time * rate) \/ 100;\n\n    System.out.println(\"Principal: \" + principal);\n    System.out.println(\"Interest Rate: \" + rate);\n    System.out.println(\"Time Duration: \" + time);\n    System.out.println(\"Simple Interest: \" + interest);\n\n    input.close();\n  }\n}<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><samp>Enter the principal: 1000\nEnter the rate: 8\nEnter the time: 2\nPrincipal: 1000.0\nInterest Rate: 8.0\nTime Duration: 2.0\nSimple Interest: 160.0<\/samp><\/code><\/pre>\n\n\n\n<p>In the above example, we have used the&nbsp;<code>Scanner<\/code>&nbsp;class to take&nbsp;<strong>principal<\/strong>,&nbsp;<strong>rate<\/strong>, and&nbsp;<strong>time<\/strong>&nbsp;as input from the user. We then use the formula of simple interest to compute the simple interest.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Simple Interest = (Principal * Rate * Time) \/ 100<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp;Calculate Simple Interest in Java Output In the above example, we have used the&nbsp;Scanner&nbsp;class to take&nbsp;principal,&nbsp;rate, and&nbsp;time&nbsp;as input from the user. We then use the formula of simple interest to compute the simple interest.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[490],"tags":[],"_links":{"self":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/1364"}],"collection":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/comments?post=1364"}],"version-history":[{"count":0,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/1364\/revisions"}],"wp:attachment":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/media?parent=1364"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/categories?post=1364"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/tags?post=1364"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}