7.13 A large company pays its salespeople on a commission basis. The salespeople
ID: 3760830 • Letter: 7
Question
7.13 A large company pays its salespeople on a commission basis. The salespeople receive $200 per week, plus 9 percent of their gross sales for that week. For example, a salesperson who sells $5000 worth of merchandise in a week receives $200 plus 9 percent of $5000, or a total of $650. You have been supplied with a list of the items sold by each salesperson. The values of these items are as follows:
Item
Value
1
239.99
2
129.75
3
99.95
4
350.89
Develop a script that inputs one salesperson’s items sold for last week, calculates the salesperson’s earnings and outputs HTML5 text that displays the salesperson’s earnings.
Item
Value
1
239.99
2
129.75
3
99.95
4
350.89
Explanation / Answer
As per above problem statement java script is written to supply the number of items sold in last week. so based on number of items sold by salesperson he will earn 200$ plus 9% of Item costs. See the below HTML with java script code for designed ..please have a see the below code and let me know any uppdates are needed.
<html>
<head>
<title>SalesPersonEarnings</title>
<style type="text/css">
h1
{
font-family: Arial;
}
</style>
<script type="text/javascript">
function calculator ()
{
var itemcount;
var i;
var sum=0;
var cal;
itemcount = prompt("How many item/items Salesman sale last week:");
var count = parseInt(itemcount);
for(i=0;i<count;i++)
{
cal = prompt("Enter item number:");
var getprice = parseInt(cal);
if(getprice == 1)
{
sum = sum + 239.99;
}
else if(getprice == 2)
{
sum = sum + 129.75;
}
else if(getprice == 3)
{
sum = sum + 99.95;
}
else if(getprice == 4)
{
sum = sum + 350.89;
}
}
var sal= 200 + (( 9 / 100)* parseInt(sum));
document.write( "<h1> Total Salary for this salesperson is: " + sal + "</h1>" );
}
</script>
</head>
<body>
<input type="button" value="Click here to run the program">
</body>
</html>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.