Need this in javascript 1. A company has determined that its annual profit is ty
ID: 3932898 • Letter: N
Question
Need this in javascript
1. A company has determined that its annual profit is typically 23 percent of total sales. Write a program called sales_prediction.js, that displays the profit based on the project amount of total sales for the year. Use a literal value of $2,500,000 for the projected total sales amount. Display the profit amount formatted to two decimal places. 25 pts
2. One acre of land is equivalent to 43,560 square feet. Write a program called land_calculation.js that calculates the number of acres in the a tract of land based on the total square feet in a tract of land. Use a literal value of 348,480 for the total square feet. 25 pts
3. A customer in a store is purchasing five items. Write a program called total_purchase.js that creates five items with literal numeric values. The prices of the items should be as follows:
item 1: $9.99
item 2: $5.99
item 3: $.99
item 4: $59.50
item 5: $.25
It then calculates and displays the subtotal of the sale, the amount of sales tax, and the total. Assume the sales tax is 7 percent. Display the answer to two decimal places. 25 pts
Explanation / Answer
--------------------sales_prediction.js----------------------
var total_sales=2500000;
var profit=(total_sales*23)/100;
document.writeln("Profit:"+profit.toFixed(2)+"<br>"); //method toFixed is used to print to two decimals
--------------------land_calculation.js----------------------
var total_sqf=348480;
var acre=(total_sqf/43,560);
document.writeln("acres:"+acre+"<br>");
------------------total_purchase.js--------------------------
var item1=9.99,item2=5.99,item3=0.99,item4=59.50,item5=0.25;
var sub_tl=item1+item2+item3+item4+item5;
var sltax=(sub_tl*7)/100;
var total=sub_tl+sltax;
document.writeln("Sub Total:"+sub_tl.toFixed(2)+"<br>");
document.writeln("Sales Tax:"+sltax.toFixed(2)+"<br>");
document.writeln("Total:"+total.toFixed(2)+"<br>");
----------------------run the below html to get the output make sure to put all the files in single folder----------------
<html>
<head>
<title>test</title>
<script src="sales_prediction.js" type="text/javascript"></script>
<script src="land_calculation.js" type="text/javascript"></script>
<script src="total_purchase.js" type="text/javascript"></script>
</head>
<body>
</body>
</html>
--------------------------output ater opening the html-----------------------
Profit:575000.00
acres:560
Sub Total:76.72
Sales Tax:5.37
Total:82.09
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.