Question

i need help with this homework web page and i need the code too Using the "do while" or the "for" contr...

i need help with this homework web page and i need the code too

  1. Using the "do while" or the "for" control statements, have a visitor to your Web page do, or see, something repeatedly. You could have him or her enter a number of months, an interest-rate, and an amount, and print out a table with the amount on deposit. Try to make the loop appropriate to the website theme that you have picked.
  2. Use a function in your Web page. You can use a user-written function that you design, or one of the provided functions in JavaScript, and you can combine Parts A and B by putting your function inside of the loop.
  3. Update your header to indicate where the loop script is located, its purpose, which function(s) are used, and where they are in your website (file and location).
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Program 1:

<!DOCTYPE html>
<html>
<title> Demo </title>

<head>


<script>

function calculate() {
var amt = parseInt(document.getElementById("amount").value);
var no = parseInt(document.getElementById("noOfMonths").value);
var interest = parseInt(document.getElementById("interestVal").value);
var total = (amt * no * interest) / 100;
alert("Amount is " + total);
}
</script>


</head>


<body>

Amount : <input type="text" id="amount"> <br> <br>

No of Months : <input type="text" id="noOfMonths"> <br> <br>

Interest Value <input type="text" id="interestVal"> <br> <br>


<button onclick="calculate()"> Calculate </button>


</body>
</html>

Program 2: You need enter -1 to terminate the program

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<h3>Question 2 Solution </h3>
<hr />
   <div id="total"></div>
<div id="total1"></div>
<div id="total2"></div>
<script type="text/javascript">

   var count1=0, count2=0, count3=0, userInput=0, number=0;
   while(number != -1) {
       userInput = prompt("Please enter a number");
       number = parseInt(userInput);
if(!isNaN(number)) {
       count1++;
   if(number%3==0)
           count2++;
       if(number%5==0)
           count3++;
}
}
document.getElementById('total').innerHTML = "You entered " + (count1-1) + " numbers";
document.getElementById('total1').innerHTML = "Mulitple of 3: " + (count2) + " numbers";
document.getElementById('total2').innerHTML = "Multiple of 5: " + (count3) + " numbers";

</script>

</body>
</html>

Add a comment
Know the answer?
Add Answer to:
i need help with this homework web page and i need the code too Using the "do while" or the "for" contr...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • i need help with this homework webpage and code too: The webpage must include: Global Structure...

    i need help with this homework webpage and code too: The webpage must include: Global Structure Tags Text Tags Images   Your first page must be named index.html Include a table within your site, challenge yourself to add a header in the table, and choose interesting border and/or cell formatting. Include a hyperlink within your site. Include an image in your site. Include a form in your site to demonstrate understanding of a variety of form components (the form does not...

  • i need help with this web page project and i need the code too for this web page Include two or three HTML features that...

    i need help with this web page project and i need the code too for this web page Include two or three HTML features that make the website more robust, dynamic, and professional. Which features you opt to add can be discussed in the discussions. Some ideas might be to have all three types of links (internal to the page, links to your other pages, or links to other websites). Complete a Contact Us page which includes a form. Try...

  • HTML Web Page project: Need help to create a web page exactly as the example below...

    HTML Web Page project: Need help to create a web page exactly as the example below using HTML. I need the source code. Page 1 of CA272 Midterm Welcome to your name's CA272 Midterm Text In this class, I learned how to... 1. create an X)HTML web page, where I can 2. change the size of my font, 3. change the color of my fonts, 4. change my font style, 5. and change the background color of my web page....

  • Fake News This exercise is about modifying the content of a page in your web browser using Javascript. As we have said, Javascript has access to the current page via the Document Object Model or DOM....

    Fake News This exercise is about modifying the content of a page in your web browser using Javascript. As we have said, Javascript has access to the current page via the Document Object Model or DOM. In your browser, the variable document represents the current document and your code can use it to read and write to the current page. In this exercise we will use the developer tools Javascript console to write Javascript to access parts of the main...

  • I need some help in jquery or javascript. I managed to do the hover effects using...

    I need some help in jquery or javascript. I managed to do the hover effects using css and js but i can't seem to "hold" the hover effects on the default page or even after i clicked on a particular page and landed there. Am i missing something in my css or js or both? You can download the working files here together with the instructions + screenshots so that you can better understand what i am trying to describe:...

  • i need the code that goes within the <script> opening and closing following the insturctions of...

    i need the code that goes within the <script> opening and closing following the insturctions of the insturctions of the pasted assignment screen shots please. <!DOCTYPE html> <html> <head> <!-- JavaScript 6th Edition Chapter 3 Hands-on Project 3-1 Filename: index.htm --> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width,initial-scale=1.0"> <title>Hands-on Project 3-1</title> <link rel="stylesheet" href="styles.css" /> <script src="modernizr.custom.05819.js"></script> </head> <body> <header> <h1> Hands-on Project 3-1 </h1> </header> <article> <h2>Lunch selections</h2> <form> <input type="checkbox" id="item1" value="8" /> <label for="item1">Fried chicken ($8.00)</label> <input type="checkbox"...

  • dont know how to do Create a web page using a text editor. Name the file...

    dont know how to do Create a web page using a text editor. Name the file with your name and the number of the assignment. Submit the assignment via D2L by 5:00 on the due date. Put your name on the last line in camelCase. Write a JavaScript function that gets a number from two to twenty-five from the user. Reject numbers that aren't in that range. Then find the double, square and total of all three numbers. Display all...

  • I need help I would like the time to run but every time it hits a...

    I need help I would like the time to run but every time it hits a minute the font style, font size, and color in JavaScript. Directions below Write an HTML document that uses JavaScript to show on your page the time (MM:SS) a visitor has spent viewing your web page. The digit string indicating the time should change the font type, font size and font color each next minute in a circular fashion 7 times, as shown below File...

  • Can someone plz help me??? I would like a website that has to do with guitars...

    Can someone plz help me??? I would like a website that has to do with guitars or something to do with music, someone asked me what kind of website I would like to have and that would be awesome. The attributes to be included, are below. I need a small website that to where I need to interlink a CSS file into the HTML file. I don't know to save the files to have to be able to run with...

  • Create an HTML5 page that contains a form to collect the following data. The text in...

    Create an HTML5 page that contains a form to collect the following data. The text in bold indicates the id value that should be assigned to each html control: Product (drop down list) product – iPad, iPhone 6S, Galaxy 5S, Moto X, and so on Quantity (number) quantity Unit price (number) unit_price Discount (%)(number) discount_rate Date (date)   order_date First Name (text box)   first_name Last Name (text box)   last_name Payment type (drop down list)   payment_type – Visa, Master, Discover, Amex, and...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT