d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > 500 Fg For Simple Java Code Homework
Add Reply New Topic New Poll
Member
Posts: 8,899
Joined: May 25 2014
Gold: 0.69
Jun 13 2016 09:37pm
Please PM me if you are working on this.
Otherwise I'll just do it in 3 hours from now :P


Yes!

I have another monster assignment due tonight so willing to pay FG for someone who can do this.



Will pay an extra 200 if i can get it done in 3 hours


Documentation and Other Style Issues

Use descriptive variable names.
Include a comment at the bottom of your code to document 2 test cases that you checked by hand.
Sample Run

Imagine that there is an item that usually costs $15.00 and the customer wants to purchase 60 of them. Here is how the program works:

input normal price

input number of items





After the program performs its decisions and calculations, it display all inputs and results:

This post was edited by Buxx on Jun 13 2016 09:39pm
Member
Posts: 8,899
Joined: May 25 2014
Gold: 0.69
Jun 13 2016 10:49pm
<html>
<head>
<title>Assignment #10</title>

<body>

<h2>The Discount Store Calculator </h2>


<script language="JavaScript">
// INPUT section -- get information from the user
var normalprice = parseFloat( window.prompt("Enter the normal price of an item $" ) );
var numberofitem = parseFloat( window.prompt("Enter the number of items" ) );

// PROCESSING section -- perform calculations

if ( numberofitem >= 0 && numberofitem <= 9 ) {
document.write("<p>You want to purchase " + numberofitem);
document.write("<p>at the price is $ " + normalprice );
document.write("<p>The total cost is $ "+normalprice * numberofitem);
}
else if ( numberofitem >= 10 && numberofitem <= 99 ) {
document.write("<p>You want to purchase " + numberofitem);
document.write("<p>at the price is $ " + normalprice );
document.write("<p>For this purchase the discount rate is % 10 " );
document.write("<p>The amount saved is $ "+normalprice * numberofitem * .1);
document.write("<p>The total cost is $ "+normalprice * numberofitem * .9);
}
else if ( numberofitem >= 100 && numberofitem <= 499 ) {
document.write("<p>You want to purchase " + numberofitem);
document.write("<p>at the price is $ " + normalprice );
document.write("<p>For this purchase the discount rate is % 15 " );
document.write("<p>The amount saved is $ "+normalprice * numberofitem * .15);
document.write("<p>The total cost is $ "+normalprice * numberofitem * .85);
}
else if ( numberofitem >= 500 && numberofitem <= 1000 ) {
document.write("<p>You want to purchase " + numberofitem);
document.write("<p>at the price is $ " + normalprice );
document.write("<p>For this purchase the discount rate is % 20 " );
document.write("<p>The amount saved is $ "+normalprice * numberofitem * .20);
document.write("<p>The total cost is $ "+normalprice * numberofitem * .8);
}
else if ( numberofitem >= 1000 ) {
document.write("<p>You want to purchase " + numberofitem);
document.write("<p>at the price is $ " + normalprice );
document.write("<p>For this purchase the discount rate is % 25 " );
document.write("<p>The amount saved is $ "+normalprice * numberofitem * .25);
document.write("<p>The total cost is $ "+normalprice * numberofitem * .75);
}
else
{
document.write("Error");
}
</script>



</body>
</html>



Was able to do it and get it working first try.. :thumbsup: .

This post was edited by Buxx on Jun 13 2016 11:02pm
Member
Posts: 1,995
Joined: Jun 28 2006
Gold: 7.41
Jun 14 2016 12:01am
Good job on finishing your assignment on your own. Don't give up.


Your next assignment is to learn the difference between java and javascript.
Member
Posts: 2,630
Joined: Nov 17 2007
Gold: 1,700.00
Jun 14 2016 02:52am
Quote (Minkomonster @ Jun 14 2016 07:01am)
Good job on finishing your assignment on your own. Don't give up.


Your next assignment is to learn the difference between java and javascript.


vouch.. I hope he was not requested to do it in java for real
Member
Posts: 2,533
Joined: Jun 15 2013
Gold: 89.00
Jun 14 2016 01:26pm
Quote (Minkomonster @ Jun 14 2016 09:01am)
Good job on finishing your assignment on your own. Don't give up.


Your next assignment is to learn the difference between java and javascript.


You are the real mvp. lol
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll