{ "key_pair_value_system": true, "answer_rating_count": "", "question_feedback_html": { "html_star": "", "html_star_feedback": "" }, "answer_average_rating_value": "", "answer_date_js": "2024-09-09T05:12:16-04:00", "answer_date": "2024-09-09 05:12:16", "is_docs_available": null, "is_excel_available": null, "is_pdf_available": null, "count_file_available": 0, "main_page": "student_question_view", "question_id": "9774645", "url": "\/study-help\/questions\/decode-php-to-javascript-product-discount-calculator-loan-calculator-loan-9774645", "question_creation_date_js": "2024-09-09T05:12:16-04:00", "question_creation_date": "Sep 09, 2024 05:12 AM", "meta_title": "[Solved] decode php to javascript Product Discount | SolutionInn", "meta_description": "Answer of - decode php to javascript Product Discount Calculator Loan Calculator Loan Amount Interest Rate (annual %) Period in ye | SolutionInn", "meta_keywords": "decode,php,javascript,product,discount,calculator,loan,amount,interest,rate,annual,period", "question_title_h1": "decode php to javascript Product Discount Calculator Loan Calculator Loan Amount Interest Rate (annual %) Period in years \/\/Here goes the answer \/\/To ensure form", "question_title": "decode php to javascript Product Discount Calculator Loan Calculator Loan Amount Interest", "question_title_for_js_snippet": "decode php to javascript Product Discount Calculator Loan Calculator Loan Amount Interest Rate (annual ) Period in years Here goes the answer To ensure form is submitted or not if(isset($ REQUEST 'submit' )) Loan amount var loanAmount $ REQUEST 'loan amount' Monthly rate var annualRate $ REQUEST 'annual rate' Months in the loan period var periodInYears $ REQUEST 'years' document write Loan amount $loanAmount document write Annual Rate $annualRate document write Years in the loan periond $periodInYears if ($loanAmount $annualRate $periodInYears) Check if these values are valid Start to do your work here Don't use operator ' ' $monthRate $annualRate 12 100 Convert years to months(periods) $numberOfPeriods $periodInYears 12 Calculating numerator of the formula i e A r $numerator $loanAmount $monthRate Calculating denominator of the formula i e (1 pow((1 r),( n))) $denominator (1 pow((1 $monthRate), ($numberOfPeriods))) Calculating Monthly Payment i e numerator denominator $payment $numerator $denominator Calculating Total Interest i e nP A $totalInterest $numberOfPeriods $payment $loanAmount document write Monthly payment is $payment document write Total Interest is $totalInterest If form not submitted don't show any values else document write Loan amount document write Annual Rate document write Years in the loan periond ", "question_description": "

decode php to javascript <\/strong><\/p>

Product Discount Calculator<\/title> <link rel=\"stylesheet\" type=\"text\/css\" href=\"main.css\"> <\/head><\/p> <p><body> <h1 align=\"center\"> Loan Calculator <\/h1> <div> <form> <table align=\"center\"> <tr> <td> Loan Amount<\/td> <td><input name=\"loan_amount\" type=\"text\" value=\"5000\"\/><\/td> <\/tr> <tr> <td> Interest Rate (annual %)<\/td> <td><input name=\"annual_rate\" type=\"text\" value=\"12\"\/><\/td> <\/tr> <tr> <td> Period in years<\/td> <td><input name=\"years\" type=\"text\" value=\"3\"><\/td> <\/tr> <tr><\/p> <p> <td colspan=\"2\"> <input name= \"submit\" type=\"submit\"> <\/td> <\/tr><\/p> <p> <\/table> <\/form><\/p> <p><\/div> <script language=\"JavaScript1.2\"><\/p> <p>\/\/Here goes the answer \/\/To ensure form is submitted or not if(isset($_REQUEST['submit'])){ \/\/Loan amount var loanAmount = $_REQUEST['loan_amount']; \/\/Monthly rate var annualRate = $_REQUEST['annual_rate']; \/\/Months in the loan period var periodInYears = $_REQUEST['years'];<\/p> <p><script><\/p> <p> document.write \"Loan amount: $loanAmount <br\/>\"; document.write \"Annual Rate: $annualRate <br\/>\"; document.write \"Years in the loan periond: $periodInYears <br\/>\"; <\/script><\/p> <p><script language=\"JavaScript1.2\"><\/p> <p> if ($loanAmount && $annualRate && $periodInYears) { \/\/ Check if these values are valid. \/\/Start to do your work here. Don't use operator '**'. $monthRate = $annualRate \/ 12 \/ 100; \/\/Convert years to months(periods) $numberOfPeriods = $periodInYears * 12; \/\/Calculating numerator of the formula i.e A*r $numerator = $loanAmount*$monthRate; \/\/Calculating denominator of the formula i.e (1 - pow((1+r),(-n))) $denominator = (1 - pow((1 + $monthRate), -($numberOfPeriods))); \/\/Calculating Monthly Payment i.e numerator\/denominator $payment = $numerator\/$denominator; \/\/Calculating Total Interest i.e nP-A $totalInterest = $numberOfPeriods * $payment - $loanAmount;<\/p> <p> document.write \"Monthly payment is: $payment <br\/>\"; document.write \"Total Interest is: $totalInterest <br\/>\";<\/p> <p> } } \/\/If form not submitted don't show any values else{ document.write \"Loan amount: <br\/>\"; document.write \"Annual Rate: <br\/>\"; document.write \"Years in the loan periond: <br\/>\"; } <\/script><\/p> <p><\/body><\/p> <p><\/html><\/p>", "transcribed_text": "", "related_book": { "title": null, "isbn": null, "edition": null, "authors": null, "cover_image": null, "uri": null, "see_more_uri": "" }, "free_related_book": { "isbn": "", "uri": "", "name": "", "edition": "" }, "question_posted": "2024-09-09 05:12:16", "see_more_questions_link": "\/study-help\/questions\/computer-science-programming-2022-November-11", "step_by_step_answer": "The Answer is in the image, click to view ...", "students_also_viewed": [ { "url": "\/study-help\/modern-mathematical-statistics-with-applications\/14-a-consumer-reports-article-on-peanut-butter-sept-1990-1989901", "description": "14. A Consumer Reports article on peanut butter (Sept. 1990) reported the following scores for various brands: Creamy 56 44 62 36 39 53 50 65 45 40 56 68 41 30 40 50 56 30 22 Crunchy 62 53 75 42 47...", "stars": 0 }, { "url": "\/hughes-foods-completed-the-following-selected-transactions-2016-oct-31-sold-goods", "description": "Hughes Foods completed the following selected transactions. 2016 Oct 31 Sold goods to BiLo's Foods, receiving a $36,000, three-month, 4.5% note. (You do not need to make the cost of goods sold...", "stars": 3 }, { "url": "\/study-help\/questions\/youve-just-opened-a-margin-account-with-25970-at-your-10102809", "description": "Youve just opened a margin account with $25,970 at your local brokerage firm. You instruct your broker to purchase 700 shares of Landon Golf stock, which currently sells for $53 per share. Suppose...", "stars": 3 }, { "url": "\/study-help\/questions\/find-the-equation-of-the-tangents-to-the-curve-y-2200047", "description": "Find the equation of the tangents to the curve y = sin x at x = - ?\/2, ? and 2?. Graph the curve over the interval [-3?\/2,3?] together with their tangents. Label each curve and tangent.", "stars": 3 }, { "url": "\/study-help\/questions\/you-purchased-merchandise-from-a-suppler-and-failed-to-pay-482113\/1000", "description": "Joe has designed a new smart water filter for industrial applications. Joe calls the water filter the \"SMARTY SIEVE\". The filter has a novel 3-dimensional shape. Joe asks a Mary to design a logo for...", "stars": 3 }, { "url": "\/study-help\/questions\/the-interview-is-not-the-final-stage-of-the-employment-1004901", "description": "The interview is not the final stage of the employment process. Background checks are frequently conducted to verify the information provided by applicants on their rsums and application forms and...", "stars": 3 }, { "url": "\/study-help\/questions\/question-4-a-study-the-following-balanced-scorecard-diagram-financial-1004992", "description": "QUESTION 4 (a) Study the following balanced scorecard diagram: Financial perspective Customer perspective Learning and Internal growth perspective processes perspective Analyze how balanced scorecard...", "stars": 3 }, { "url": "\/study-help\/questions\/1-production-and-inventory-management-simulation-problem-neo-ev-1005113", "description": "1. Production and Inventory Management - Simulation Problem Neo EV is an electrical bus manufacturer headquartered in California. Based on historical sales data and committed contracts, the forecast...", "stars": 3 }, { "url": "\/study-help\/questions\/read-the-article-why-firms-go-green-schumpeter-2011-then-1005467", "description": "Read the article Why Firms Go Green, Schumpeter, 2011, then: a) What type of single stories do you think internal stakeholders of a company may have in regards to Green initiatives? b) What role do...", "stars": 3 } ], "next_back_navigation": { "previous": "\/study-help\/questions\/problem-101a-straightline-amortization-of-bond-discount-lo-p2-hillside-9774644", "next": "\/study-help\/questions\/please-prepare-a-trial-balance-and-if-at-all-possible-9774646" }, "breadcrumbs": [ { "name": "Study help", "link": "https:\/\/www.solutioninn.com\/study-help\/questions-and-answers" }, { "name": "Computer Science", "link": "https:\/\/www.solutioninn.com\/study-help\/questions-and-answers\/computer-science" }, { "name": "Databases", "link": "https:\/\/www.solutioninn.com\/study-help\/questions\/computer-science-databases" }, { "name": "decode php to javascript Product Discount Calculator Loan Calculator Loan Amount Interest", "link": "https:\/\/www.solutioninn.com\/study-help\/questions\/decode-php-to-javascript-product-discount-calculator-loan-calculator-loan-9774645" } ], "skill_details": { "skill_id": "656", "skill_name": "Databases", "parent_id": "8" } }