BullyWiiHacks
Welcome dear guest! Very Happy

To start posting and being part of the community, you simply need to register an account or log into an existing one.

Be sure to check out disposable e-mail services, in case you prefer using one for this site instead of your legit address: http://10minutemail.com/10MinuteMail/

If you do not wish to register at all, that's fine but there will be more advertisements. :/

You can see and download all content provided for regular members even without an account!

Your contributions will be greatly appreciated though, give it a shot and register today! thumbsup
BullyWiiHacks

Gaming, Modding & Programming

Important reminders:

- Click *HERE* for advanced forum search or check out the text field below on the front page for Google before posting
- NO support via private message (use the forum)
- Write meaningful topic titles
Site Translation
Search
 
 

Display results as :
 


Rechercher Advanced Search

June 2017
MonTueWedThuFriSatSun
   1234
567891011
12131415161718
19202122232425
2627282930  

Calendar Calendar

Country Statistics
Free counters!
LaTeX Generator


You are not connected. Please login or register

View previous topic View next topic Go down  Message [Page 1 of 1]

1 Psuedocode and programming question? on 1/31/2013, 8:15 am

Powned2Death

avatar
Newb Level Helper
I have this problem from class, and i'm confused on how to make it determine increase or decrease. Can any of you pros give me advice. Here the problem:

Design a program for calculating percentage increase or decrease of the market value of a building from January 2010 to January 2011. the program should ask the user for the January 2010 price and the January 2011 price, compute the difference, and then calculate and display the percentage increase or decrease over the January 2010 price.

Using pseudocode,develop an algorithm to solve this problem. Include standard documentation and comments, and then convert to Javascript.

Heres what i have for pseudocode:

//Program name: buildPriceInc.txt
//Purpose: Calculating the percentage increase or decrease of market value
//Author: me
//Date modded: 1/30/13

//Declare variables
Declare Numeric perInc
//% increase of market value
Declare Numeric perDec
//% decrease in market value
Declare Numeric mrktValueInc
//difference divided by january 2010 value
Declare Numeric mrktValueDec
//difference divided by january 2010 value
Declare Numeric jan2010
//market value for January 2010
Declare Numeric jan2011
//market value for January 2011

//Get input from user
Display "Enter Market value for january 2010"
input jan2010
Display "Enter market value for January 2011"
input jan2011

if jan2011>jan2011 then
//Caluculate percentage increase
perInc = jan2011 - jan2010
mrktValueInc = perInc/jan2011>jan2010

if jan2011<jan2010 then
//Calculate percentage decrease
perDec = jan2010 - jan2011
mrktValueDec = perDec/jan2011<jan2010

Display "Difference in market value from January 2010:" + perInc or perDec

//End Program
Display "Thank You"

Now this is basic stuff so far only first two chapters of Java book so I limited on what I can use. I'm not sure about the mrktValue lines with < or > signs? will this work and how should I script those two lines in Java?


Seth@WiiPlaza

avatar
Admin & Coder
Admin & Coder
This isn't like any java I've seen.

// is a comment, and you are missing the name of your class and also numerous other things.


_________________

SnB@BWH

avatar
Admin & Writer
Damn, I wish that I'm pretty good at language coding like you guys. I'm just learning Visual Basic 2010 right now. I'm actually getting pretty used to it. I don't think that it would be easy for me to learn such languages as C++ or Assembly, but I could always give it a shot.

I also know a little bit about DOS as well, but I never use anything that's written in DOS anymore.

I have a really great idea for a program that all of the coders on here could work on, but I'll save that for another thread. I might actually PM you about it instead, Seth.


_________________





Become my referrer on site above and earn me at least 5,000 satoshis, and I will give you codes for any game you choose. They pay me commission on what you earn. In other words: what you make yourself, you keep, and the site gives me 50% of what you have earned. PM me your Bitcoin address, so I can keep track of what you have earned for me. Once you reach 5,000 satoshis, I will PM you to let you know. Smile

Powned2Death

avatar
Newb Level Helper
Yeah Seth that was supposed to be pseudocode. Here's my conversion to Javascipt.

<html>
<Body>
<script type="text/javascript">

//Program name: buildPriceInc.txt
//Purpose: Calculating the percentage increase or decrease of market value of the Connors Building
//Author: ME
//Date modded: 1/30/13



//Display Welcome
document.write("Welcome to the Percentage Calculator");


//Declare variables
var perInc; //% increase of market value
var perDec; //% decrease in market value
var mrktValueInc; //difference divided by january 2010 value
var mrktValueDec; //difference divided by january 2010 value
var jan2010; //market value for January 2010
var jan2011; //market value for January 2011
var BR = <"br />"; //Line break
var ES = ""; //Empty String

//Get input from user
jan2010 = prompt("Enter Market value for January 2010." + ES);
jan2010 = parseInt(jan2010);
jan2011 = prompt("Enter Market value for January 2011." + ES);
jan2011 = parseInt(jan2011);


//Caluculate percentage increase
perInc = jan2011 - jan2010
mrktValueInc = perInc/(jan2011>jan2010)


//Calculate percentage decrease
perDec = jan2010 - jan2011
mrktValueDec = perDec/(jan2011<jan2010)

//Display answers
document.write("Difference in market value from January 2010" + mrtktValueInc + mrktValueDec);

//End Program
document.write("Thank You");

SnB@BWH

avatar
Admin & Writer
This is what I got while scanning your JavaScript for errors on http://ideone.com :

language: JavaScript (spidermonkey) (spidermonkey-1.7)


result: Runtime error memory: 4936 kB signal: -1
input: no
output: no
stderr:

prog.js:24: SyntaxError: invalid XML name:
prog.js:24: var BR = <"br />"; //Line break
prog.js:24: ..........^

http://ideone.com/fWTHVf


Here's what I got while scanning your JavaScript for errors with this language as the code: JavaScript (rhino) (rhino-1.7R4)

result: Runtime error memory: 381824 kB signal: -1
input: no
output: no
stderr:

js: "prog.js", line 46: illegally formed XML syntax
js: document.write("Thank You");
js: ...........................^
js: "prog.js", line 46: syntax error
js: document.write("Thank You");
js: ...........................^
js: "prog.js", line 1: Compilation produced 2 syntax errors.


http://ideone.com/6SeQvt


_________________





Become my referrer on site above and earn me at least 5,000 satoshis, and I will give you codes for any game you choose. They pay me commission on what you earn. In other words: what you make yourself, you keep, and the site gives me 50% of what you have earned. PM me your Bitcoin address, so I can keep track of what you have earned for me. Once you reach 5,000 satoshis, I will PM you to let you know. Smile

Powned2Death

avatar
Newb Level Helper
That site is what I was looking for. Every other program makes you configure the tool bar and install bin.files and set paths and arguments to get the debugger or compiler. Every time I try this It don't work and I cant tell if its because I set the toolbar up wrong or my code is bad. Probably both the way I am. Very Happy

Sponsored content


View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum