Question

HTML only Design and implement a program that calculates the amount of money a person would...

HTML only Design and implement a program that calculates the amount of money a person would earn over a period of time if his or her salary is one penny the first day, two pennies the second day, and continues to double each day. The program should:ask the user for the number of daysdisplay a table showing what the salary was for each daythen show the total pay at the end of the period.The output should be displayed in the dollar amount, not the number of pennies.Dynamically create an HTML graphical table to hold the table data your program generates

0 0
Add a comment Improve this question Transcribed image text
Answer #1

html_code:

<!DOCTYPE html>
<html>
<body>

Amount:<br>
<input id = "amt" type="text" name="amount" value="">
<br>
Time Period:<br>
<input id = "days" type="text" name="time" value="">
<br><br>
<button onclick="myFunction()">Submit</button>
<br>
<br>
<div id="payment-table">
</div>
<p id="total-amount"></p>

<script>
function myFunction() {
document.getElementById("amt").innerHtml = "Hello World";
var a = document.getElementById("amt").value;
var b = document.getElementById("days").value;
var i = 0;
var sum = 0;
var html = "<table border='1' width = '20%'>";
for(i=1;i<=b;i++)
{
   html+="<tr>";
   html+="<td> Salary On Day "+i+": </td>";
   html+="<td>"+a+"</td>";
   html+="</tr>";  
sum = sum+parseFloat(a);
a = a*2;
}
html+="</table>";
document.getElementById("payment-table").innerHTML=html;
document.getElementById("total-amount").innerHTML="Total pay value is: $ " +(sum/100.0);
console.log(sum);
}
</script>
</body>
</html>

Output:

Add a comment
Know the answer?
Add Answer to:
HTML only Design and implement a program that calculates the amount of money a person would...
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
  • Write a program using Python that calculates the amount of money a person would earn over...

    Write a program using Python that calculates the amount of money a person would earn over a period of time if his or her salary is one penny the first day, two pennies the second day, and continues to double each day. The program should ask the user for the number of days. Display a table showing what the salary was for each day, then show the total pay at the end of the period. The output should be displayed...

  • In Java. Use the concept of LOOPS: 2.Write a program that calculates the amount a person...

    In Java. Use the concept of LOOPS: 2.Write a program that calculates the amount a person would earn over a period of time if his or her salary is one penny the first day, two pennies the second day, and continues to double each day. The program should display a table showing the salary for each day, and then show the total pay at the end of the period. The output should be displayed in a dollar amount, not the...

  • Write a program that calculates the amount a person would earn over a 30-day period of...

    Write a program that calculates the amount a person would earn over a 30-day period of time if his/her salary is one penny the first day, two pennies the second day, and continues to double each day. The program should display a table showing the salary for each day, and then show the total pay at the end of the period. The output should be displayed in a dollar amount, not the number of pennies. A sample output might look...

  • <!DOCTYPE html> <html> <body> <script> // // Write a function that calculates the amount of money...

    <!DOCTYPE html> <html> <body> <script> // // Write a function that calculates the amount of money a person would earn over // a period of years if his or her salary is one penny the first day, two pennies // the second day, and continues to double each day. The program should ask the // user for the number of years and call the function which will return the total // money earned in dollars and cents, not pennies. Assume...

  • Week 5 Project Write a program that calculates the amount of money a person would earn...

    Week 5 Project Write a program that calculates the amount of money a person would earn over a period of time if his or her salary is one penny the first day, two pennies the second day, four pennies the third day, and continues to double each day. Output the amount earned each day .. and the total pay at the end. The Algorithm (Plan) for your program would be: Ask the user for the number of days to be...

  • In Python. Write a program that will calculate the amount of money a person would earn...

    In Python. Write a program that will calculate the amount of money a person would earn over a period of time if his/her salary is one penny the first day and two pennies for the second day, and continue to double each day. Hints: Declare variables Get the number of days from the user. Show the salary table for each day 4. Use ‘for loop’ to loop through the range of days (1, num_days +1) 5. Display the total pay...

  • Show Me The Money. (15 points) Write a C++ program that calculates how much a person...

    Show Me The Money. (15 points) Write a C++ program that calculates how much a person earns in a month if the salary is one penny the first day, two pennies the second day, four pennies the third day, and so on, with the daily pay doubling each day the employee works. The program should ask the user for the number of days the employee worked during the month and should display a table showing how much the salary was...

  • Write a Java program that calculates how much a person would earn after a period of...

    Write a Java program that calculates how much a person would earn after a period of time, according to the following rules: 1. The starting salary for the first day is $1. 2. The salary will double each day. Ask the user to input the number of days worked. The output should display how much the salary was for each day worked, and show the total pay at the end of the work period. Get output similar to the sample...

  • 0 solutions submited (max Unlimted Wrte a MATLAB program called PaidPennies that calculates how much a...

    0 solutions submited (max Unlimted Wrte a MATLAB program called PaidPennies that calculates how much a person would eam e the salary were one penny on the irst day, two pennies on the second day and three pennies on the thrd day, and then would contrue ncrease in ths way each day The program should prompt the user to enter the namber of days of employment. The program should display the answer in a sentence For example PaidPenies Now wany...

  • Write a program that calculates the amount of money that you must invest In a savings...

    Write a program that calculates the amount of money that you must invest In a savings account at a given interest rate for a given number of years to have a certain dollar amount at me end of the period Y our program will ask the user for the amount the user wants to have at the end of the term (future value). the number of years the user plans to let the money stay in the account, and the...

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
ADVERTISEMENT