MIT 153 – Assignment #2 A company is in the business of leasing constructionequipment. They have a number of sales people who need to find new deals tosign. They are given a bonus at the end of each quarter based on the totaldollar amount of the lease deals they signed during the previous three months.If they signed $175,000 worth of deals in the latest quarterthey will be given a bonus of $5,000. If they signed $100,000 or more but lessthan $175,000 then they will get a bonus of $2,500 plus 1% of the amount theysigned.Those who did not achieve $100,000 worth of signedagreements are still eligible for a $1,000 bonus if they signed 10% more than theydid in the previous quarter.Create an algorithm using a flow chart to determine thesalesperson’s bonus. It will start by asking for their name and the total ofthe deals they signed this past quarter. It will also ask for the amount ofsales from the previous quarter if that information is necessary. It will endby displaying a message such as: “Johnearned a bonus or $3,700 by signing $120,000 of leases”Create a JavaScript program that will implement this code. Be sure to include appropriate comments, including your name as the programmer.
Flow chart
</span>
<pre class="wp-block-syntaxhighlighter-code"><span style="color: #000000; font-family: verdana, geneva, sans-serif;"><html>
<body>
<script type="text/javascript">
//Assignment#2
// Variable Declarations
var BR = "<br />";
var name; //employee First & Last Name
var deals; //Total Amount of Deal in the Last Quarter
var salesLastQr; //Total Amount of Deals from the Previous Quarter
// input
name= prompt("Enter Employee Name", "");
deals= prompt("Enter The Total of Deals in The Last Quarter", "");
// PROCESSING
if (deals>=175000) {
document.write(name + " earned a bonus of $ 5000 by signing $" + deals + " of leases");
}
else if (deals>=100000){
document.write(name + " earned a bonus of $ " + (2500+parseFloat(.01*deals)) + " by signing $" + deals + " of leases");
}
else {
salesLastQr= prompt("Enter The Amount of Sales from The Previous Quarter", "");
if (deals>1.1*salesLastQr){
document.write(name + " earned a bonus of $ 1000 by signing $" + deals + " of leases");
}
else{
document.write(name + ", Sorry You earned no bonus : ( ");
}
}
</script>
</body>
</html>
</span></pre>
Leave a reply