Remove Ad, Sign Up
Register to Remove Ad
Register to Remove Ad
Remove Ad, Sign Up
Register to Remove Ad
Register to Remove Ad
Signup for Free!
-More Features-
-Far Less Ads-
About   Users   Help
Users & Guests Online
On Page: 1
Directory: 2 & 168
Entire Site: 7 & 1067
Page Staff: pokemon x, pennylessz, Barathemos, tgags123, alexanyways, supercool22, RavusRat,
04-24-24 08:13 PM

Forum Links

Thread Information

Views
2,017
Replies
7
Rating
0
Status
CLOSED
Thread
Creator

09-02-08 07:05 AM
Last
Post

09-12-08 08:43 PM
Additional Thread Details
Views: 229
Today: 0
Users: 1 unique

Thread Actions

Thread Closed
New Thread
New Poll
Order
 

Is this correct?

 

09-02-08 07:05 AM
is Offline
| ID: 72123 | 120 Words


JigSaw
Level: 164


POSTS: 790/7936
POST EXP: 584185
LVL EXP: 57403667
CP: 8045.8
VIZ: -46031833

Likes: 0  Dislikes: 0
Began class today and programming is now actually a bit fun now! So I decided to try my own pseudocode out does it look fine? This is not meant to be actually used just to understand logic of processing using pseudocode so there is no quotations or anything. Just wanna know if I am right or close to being right.

input creatureFish
input creatureSnail
input creatureCat
input creatureDog
input creatureSheep
input creatureHorse
input creaturePig
input creatureLlama

creatureFish = 0
creatureSnail = 0
creatureCat = 0
creatureDog = 0
creatureSheep = 1
creatureHorse = 1
creaturePig = 1
creatureLlama = 1

creatureCount = plus one
if creatureSheep, creatureHorse, creaturePig, creatureLlama
else creatureCount = 0

if creatureCount is more than 4
print farm
else
print nofarm
endif

Began class today and programming is now actually a bit fun now! So I decided to try my own pseudocode out does it look fine? This is not meant to be actually used just to understand logic of processing using pseudocode so there is no quotations or anything. Just wanna know if I am right or close to being right.

input creatureFish
input creatureSnail
input creatureCat
input creatureDog
input creatureSheep
input creatureHorse
input creaturePig
input creatureLlama

creatureFish = 0
creatureSnail = 0
creatureCat = 0
creatureDog = 0
creatureSheep = 1
creatureHorse = 1
creaturePig = 1
creatureLlama = 1

creatureCount = plus one
if creatureSheep, creatureHorse, creaturePig, creatureLlama
else creatureCount = 0

if creatureCount is more than 4
print farm
else
print nofarm
endif

Vizzed Elite
PHP Developer, Security Consultant

Affected by 'Laziness Syndrome'

Registered: 04-06-06
Location: Area 51
Last Post: 1733 days
Last Active: 1727 days

09-03-08 05:24 AM
BigBob85 is Offline
| ID: 72152 | 138 Words

BigBob85
Level: 151

POSTS: 5849/6381
POST EXP: 217397
LVL EXP: 42877436
CP: 170.6
VIZ: 49768

Likes: 0  Dislikes: 0
Persudo code is ment to be easy to read, aswell as resemble code.

I wouldnt declare variables with input like how you did, unless you ment get input from keyboard..

Its kinda hard to tell what you mean here,

if creatureSheep, creatureHorse, creaturePig, creatureLlama
else creatureCount = 0

If I were to guess, I'd say if its them animals exist, but then you dont have any code there to run if thats true, then you have an else case.. so its kinda confusing.

As for this part,

if creatureCount is more than 4
print farm
else
print nofarm
endif

I would have written it with "> 4", rather than "is more than 4", but your endif is right. Im not sure if theres any presudocode syntax to print stuff to the screen, it can either be print, println, echo, <<, or quite a few things.
Persudo code is ment to be easy to read, aswell as resemble code.

I wouldnt declare variables with input like how you did, unless you ment get input from keyboard..

Its kinda hard to tell what you mean here,

if creatureSheep, creatureHorse, creaturePig, creatureLlama
else creatureCount = 0

If I were to guess, I'd say if its them animals exist, but then you dont have any code there to run if thats true, then you have an else case.. so its kinda confusing.

As for this part,

if creatureCount is more than 4
print farm
else
print nofarm
endif

I would have written it with "> 4", rather than "is more than 4", but your endif is right. Im not sure if theres any presudocode syntax to print stuff to the screen, it can either be print, println, echo, <<, or quite a few things.
Vizzed Elite
Member Of The Year 07


Affected by 'Laziness Syndrome'

Registered: 12-09-04
Location: Melbourne, Australia
Last Post: 1603 days
Last Active: 1237 days

09-03-08 09:15 AM
is Offline
| ID: 72158 | 125 Words


JigSaw
Level: 164


POSTS: 792/7936
POST EXP: 584185
LVL EXP: 57403667
CP: 8045.8
VIZ: -46031833

Likes: 0  Dislikes: 0
Thanks a ton bigbob Pointed out a ton of stuff that I missed. This is the example that was used in the class:
----------------------------------------------------
input gramsCarb
input gramsProtein
input gramsFat

fatCalories = gramsFat times nine
carbCalories = gramsCarb times four
proteinCalories = gramsProtein times four
totalCalories = fatCalories plus carbCalories plus proteinCalories

fatPercentage = fatCalories divided by totalCalories

if fatPercentage is less than 0.30
print healthy
else
print unhealthy
endif
----------------------------------------------------
So I basically followed it's path a bit and tried to write my own lol. Oh well, I think I made some decent progress so far, I took 6 weeks of PHP and couldn't even write my own things now only 3 days of programming logic and it's making a lot more sense.


Thanks a ton bigbob Pointed out a ton of stuff that I missed. This is the example that was used in the class:
----------------------------------------------------
input gramsCarb
input gramsProtein
input gramsFat

fatCalories = gramsFat times nine
carbCalories = gramsCarb times four
proteinCalories = gramsProtein times four
totalCalories = fatCalories plus carbCalories plus proteinCalories

fatPercentage = fatCalories divided by totalCalories

if fatPercentage is less than 0.30
print healthy
else
print unhealthy
endif
----------------------------------------------------
So I basically followed it's path a bit and tried to write my own lol. Oh well, I think I made some decent progress so far, I took 6 weeks of PHP and couldn't even write my own things now only 3 days of programming logic and it's making a lot more sense.


Vizzed Elite
PHP Developer, Security Consultant

Affected by 'Laziness Syndrome'

Registered: 04-06-06
Location: Area 51
Last Post: 1733 days
Last Active: 1727 days

09-06-08 10:39 AM
iBOCK is Offline
| ID: 72213 | 14 Words

iBOCK
Level: 127


POSTS: 2789/4283
POST EXP: 267468
LVL EXP: 23337764
CP: 748.3
VIZ: 115401

Likes: 0  Dislikes: 0
My brain just melted a little. Time to buy a programming book! *batman music*
My brain just melted a little. Time to buy a programming book! *batman music*
Vizzed Elite

Affected by 'Laziness Syndrome'

Registered: 05-02-05
Location: the grid
Last Post: 4194 days
Last Active: 3152 days

09-06-08 01:47 PM
is Offline
| ID: 72233 | 31 Words


JigSaw
Level: 164


POSTS: 796/7936
POST EXP: 584185
LVL EXP: 57403667
CP: 8045.8
VIZ: -46031833

Likes: 0  Dislikes: 0
Yeah, I think I did this way wrong now lol. Anyway, I recommend getting a programming logic book first before jumping into coding it it will make a lot more sense
Yeah, I think I did this way wrong now lol. Anyway, I recommend getting a programming logic book first before jumping into coding it it will make a lot more sense
Vizzed Elite
PHP Developer, Security Consultant

Affected by 'Laziness Syndrome'

Registered: 04-06-06
Location: Area 51
Last Post: 1733 days
Last Active: 1727 days

09-06-08 10:25 PM
BigBob85 is Offline
| ID: 72243 | 114 Words

BigBob85
Level: 151

POSTS: 5854/6381
POST EXP: 217397
LVL EXP: 42877436
CP: 170.6
VIZ: 49768

Likes: 0  Dislikes: 0
In java, this would look like this.

-----------------------
input gramsCarb
input gramsProtein
input gramsFat

fatCalories = gramsFat times nine
carbCalories = gramsCarb times four
proteinCalories = gramsProtein times four
totalCalories = fatCalories plus carbCalories plus proteinCalories

fatPercentage = fatCalories divided by totalCalories

if fatPercentage is less than 0.30
print healthy
else
print unhealthy
endif
-----------------------
int gramsCarb;
int gramsProtein;
int gramsFat;
// Other code here to prompt user for them values.

int fatCalories = gramsFat * 9;
int carbCalories = gramsCarb * 4;
int proteinCalories = gramsProtien * 4;
int totalCalories = fatCalories + carbCalories + proteinCalories;

double fatPercentage = fatCalories / totalCalories;

if (fatPercentage < 0.3)
{
System.out.println("Healthy.");
}
else
{
System.out.println("Unealthy.");
}
In java, this would look like this.

-----------------------
input gramsCarb
input gramsProtein
input gramsFat

fatCalories = gramsFat times nine
carbCalories = gramsCarb times four
proteinCalories = gramsProtein times four
totalCalories = fatCalories plus carbCalories plus proteinCalories

fatPercentage = fatCalories divided by totalCalories

if fatPercentage is less than 0.30
print healthy
else
print unhealthy
endif
-----------------------
int gramsCarb;
int gramsProtein;
int gramsFat;
// Other code here to prompt user for them values.

int fatCalories = gramsFat * 9;
int carbCalories = gramsCarb * 4;
int proteinCalories = gramsProtien * 4;
int totalCalories = fatCalories + carbCalories + proteinCalories;

double fatPercentage = fatCalories / totalCalories;

if (fatPercentage < 0.3)
{
System.out.println("Healthy.");
}
else
{
System.out.println("Unealthy.");
}
Vizzed Elite
Member Of The Year 07


Affected by 'Laziness Syndrome'

Registered: 12-09-04
Location: Melbourne, Australia
Last Post: 1603 days
Last Active: 1237 days

09-10-08 10:52 PM
is Offline
| ID: 72359 | 48 Words


JigSaw
Level: 164


POSTS: 807/7936
POST EXP: 584185
LVL EXP: 57403667
CP: 8045.8
VIZ: -46031833

Likes: 0  Dislikes: 0
Awesome example Basically seems the same as the pseudocode! This week I'm learning bout modules / coupling and cohesion

But I don't get the System.out.println statement, shouldn't it be System.out.printOut or System.in.printOut? Wonder why it would be In kinda confusing lol. Unless the In refers to the input?

Awesome example Basically seems the same as the pseudocode! This week I'm learning bout modules / coupling and cohesion

But I don't get the System.out.println statement, shouldn't it be System.out.printOut or System.in.printOut? Wonder why it would be In kinda confusing lol. Unless the In refers to the input?

Vizzed Elite
PHP Developer, Security Consultant

Affected by 'Laziness Syndrome'

Registered: 04-06-06
Location: Area 51
Last Post: 1733 days
Last Active: 1727 days

09-12-08 08:43 PM
is Offline
| ID: 72476 | 6 Words


JigSaw
Level: 164


POSTS: 816/7936
POST EXP: 584185
LVL EXP: 57403667
CP: 8045.8
VIZ: -46031833

Likes: 0  Dislikes: 0
Had a question but solved it
Had a question but solved it
Vizzed Elite
PHP Developer, Security Consultant

Affected by 'Laziness Syndrome'

Registered: 04-06-06
Location: Area 51
Last Post: 1733 days
Last Active: 1727 days

(edited by JigSaw on 09-13-08 11:03 PM)    

Links

Page Comments


This page has no comments

Adblocker detected!

Vizzed.com is very expensive to keep alive! The Ads pay for the servers.

Vizzed has 3 TB worth of games and 1 TB worth of music.  This site is free to use but the ads barely pay for the monthly server fees.  If too many more people use ad block, the site cannot survive.

We prioritize the community over the site profits.  This is why we avoid using annoying (but high paying) ads like most other sites which include popups, obnoxious sounds and animations, malware, and other forms of intrusiveness.  We'll do our part to never resort to these types of ads, please do your part by helping support this site by adding Vizzed.com to your ad blocking whitelist.

×