{"id":74,"date":"2022-11-15T05:28:26","date_gmt":"2022-11-15T05:28:26","guid":{"rendered":"https:\/\/iris.siue.edu\/miciahsanders\/?page_id=74"},"modified":"2022-11-16T22:27:30","modified_gmt":"2022-11-16T22:27:30","slug":"some-code","status":"publish","type":"page","link":"https:\/\/iris.siue.edu\/miciahsanders\/some-code\/","title":{"rendered":"Some Code"},"content":{"rendered":"\n<p>I have learned HTML, CSS, JAVASCRIPT, &amp; some PYTHON<\/p>\n\n\n\n<p>\/\/ Construct Scanner object and DecimalFormat object<br>Scanner sc = new Scanner(System.in);<br>DecimalFormat currency = new DecimalFormat(&#8220;$#,##0.00&#8221;);<\/p>\n\n\n\n<pre class=\"wp-block-code has-dark-gray-color has-text-color\"><code>    \/\/ Display welcome message\n    System.out.println(WELCOME_MESSAGE);\n    System.out.println(\" \");\n\n    \/\/ Loop while user chooses Y or y\n    do{\n\n\n\n        \/\/ Get user input for salary            \n         System.out.print(\"Enter salary: \");\n         salary = sc.nextDouble();\n\n         \/\/ As long as salary input is NOT within the valid range, prompt again\n        while(salary &lt; 0 || salary &gt; 300000){\n            System.out.print(\"Error - Enter salary between 0 and 300000: \");\n            salary = sc.nextDouble();\n        }\n\n        System.out.print(\"Enter number of dependents: \");\n        numDependents = sc.nextDouble();\n\n        \/\/ As long as nbr of dependents is NOT within the valid range, prompt again\n        while(numDependents &lt; 0 || numDependents &gt; 20){\n              System.out.print(\"Error - Enter number of dependents between 0 and 20: \");\n              numDependents = sc.nextDouble();\n        }\n\n        System.out.println(\" \");\n        \/\/ Perform calculations\n        stateTax = salary * .065;\n        federalTax = salary * .28;\n        dependentDeduction = (salary * .025) * numDependents;\n        totalWithholding = stateTax + federalTax;\n        takeHomePay = (salary - totalWithholding) + dependentDeduction;\n\n        \/\/ Display formatted output\n        System.out.println(\"State Tax:\\t\\t\" + currency.format(stateTax));\n        System.out.println(\"Federal Tax:\\t\\t\" + currency.format(federalTax));\n        System.out.println(\"Dependent Deduction:\\t\" + currency.format(dependentDeduction));\n        System.out.println(\"Salary:\\t\\t\\t\" + currency.format(salary));\n        System.out.println(\"Take Home Pay:\\t\\t\" + currency.format(takeHomePay));\n        System.out.println(\" \"s);\n\n        \/\/ see if user wants to enter another\n        System.out.print(\"Would you like to enter data for another employee? (y\/n): \");\n        enterAnother = sc.next();\n\n\n    }\n    \/\/ as long as user input is not \"Y\"\/\"y\" and not \"N\"\/\"n\", prompt again\n    while(enterAnother.equalsIgnoreCase(\"Y\"));\n    System.exit(0);\n    }<\/code><\/pre>\n\n\n\n<p>This code may seem foreign to most reading this, but this program is to calculate an employee&#8217;s payroll after placing information.  Straightforward explanation with a paragraph&#8217;s worth of code.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have learned HTML, CSS, JAVASCRIPT, &amp; some PYTHON \/\/ Construct Scanner object and DecimalFormat objectScanner sc = new Scanner(System.in);DecimalFormat currency = new DecimalFormat(&#8220;$#,##0.00&#8221;); This code may seem foreign to most reading this, but this program is to calculate an employee&#8217;s payroll after placing information. Straightforward explanation with a paragraph&#8217;s worth of code.<\/p>\n","protected":false},"author":344,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_sb_is_suggestion_mode":false,"_sb_show_suggestion_boards":false,"_sb_show_comment_boards":false,"_sb_suggestion_history":"","_sb_update_block_changes":"","footnotes":""},"class_list":["post-74","page","type-page","status-publish","hentry","post-preview"],"_links":{"self":[{"href":"https:\/\/iris.siue.edu\/miciahsanders\/wp-json\/wp\/v2\/pages\/74","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/iris.siue.edu\/miciahsanders\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/iris.siue.edu\/miciahsanders\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/iris.siue.edu\/miciahsanders\/wp-json\/wp\/v2\/users\/344"}],"replies":[{"embeddable":true,"href":"https:\/\/iris.siue.edu\/miciahsanders\/wp-json\/wp\/v2\/comments?post=74"}],"version-history":[{"count":3,"href":"https:\/\/iris.siue.edu\/miciahsanders\/wp-json\/wp\/v2\/pages\/74\/revisions"}],"predecessor-version":[{"id":86,"href":"https:\/\/iris.siue.edu\/miciahsanders\/wp-json\/wp\/v2\/pages\/74\/revisions\/86"}],"wp:attachment":[{"href":"https:\/\/iris.siue.edu\/miciahsanders\/wp-json\/wp\/v2\/media?parent=74"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}