Menu

[solved]-Need Help Code T Get Run Calculations Display Isn T Working Properly Thank Advance Help Qu Q39032068

I need help with my code. I can’t get it to run the calculationsand the display isn’t working properly. Thank you in advance foryour help.

Question Solving for in HTML ( JavaScript) Per TextBook Internetand World Wide Web 5th Edition, Chapter 7, problem 7.12

7.12        Develop a scriptthat will determine whether a department-store customer hasexceeded the credit limit on a charge account. For each customer,the following facts are available:

a)  Account number b) Balance at the beginning of themonth c) Total of all items charged by this customer this month d)Total of all credits applied to this customer’s account this monthe)   Allowed credit limit

The script should input each of these facts from a prompt dialogas an integer, calculate the new balance (= beginning balance +charges – credits), display the new balance and determine whetherthe new balance exceeds the customer’s credit limit. For customerswhose credit limit is exceeded, the script should output HTML5 textthat displays the message “Credit limit exceeded.”

Code is as follows:

<!DOCTYPE html>

<!– Exercise 7.12 Solution–>
<html>
<head>
<meta charset = “utf-8”>
<title>7.12 Solution</title>
   <script type = “text/javascript”>
   <!–
   var accountNumber; // Account Number entered byuser
   var beginningBalance; // Balance at the beginning ofthe month entered by user
   var totalCharges; // Total Charges for the monthentered byh user
   var totalCredits; //Total Credits applied to accountthis month entered by user
   var creditLimit; // Allowed Credit Limit entered byuser
   var newBalance; //New balance of begbalance + charges- credits
   var begBalance; // Converted Intger Value
   var charges; // Converted Intger Value
   var credits; //Converted Intger Value
   var limit; //Converted Intger Value
  
   //prompt user to input account number
   accountNumber = window.prompt( “Enter AccountNumber”);
  
   //prompt user to enter beginning balance
   beginningBalance = window.prompt( “Enter the Balanceat the beginning of the month”);
  
   //convert beginningBalnce to an integer
   begBalance = parseInt( beginningBalance);
  
   //prompt user to enter the total charges for thismonth
   totalCharges = window.prompt( “Enter the Total ofitems charged this month”);
  
   //convert totalCharges to an integer
   charges = parseInt( totalCharges);
  
   //prompt user to enter the total credits for thismonth
   totalCredits = window.prompt( “Enter the total ofcredits this month”);
  
   //convert totalCredits to an integer
   credits = parseInt( totalCredits);
  
   //prompt user to enter the credit limit
   creditLimit = window.prompt( “Enter creditlimit”);
  
   //convert creditLimit to integer
   limit = parseInt(creditLimit);
  
   //calculate newBalance
   newBalance = begBalance+charges-credits;

         //display newbalance
    document.writeln( “<h1> The New Balance is” + newBalance +” </h1>”);
    if(newBalance > limit){
    document.writeln( “<h1> Credit limitexceeded. ” </h1>);
          }
      
        //–>
       </script>
</head><body> </body>
        
</html>

Expert Answer


Answer to I need help with my code. I can’t get it to run the calculations and the display isn’t working properly. Thank you in a… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *