PDA

View Full Version : HELP is this right???


cooldude16
04-19-2010, 12:48 AM
PLEASE HELP!!!!!! I have to write pseudocode for a program and I want to know if this looks correct?I am using VB

the problem is:
The camp keeps records for each camper including first name,last name, birthdate and skill scores ranging from 1 to 10 in 4 areas:tennis,crafts,swimming and horsemanship.the birthdate is stored in the format YYYYMMDD without punctuation.First name and last name should be 15 characters max.The camp wants a printed report listing each campers data and the sum of the 4 skill scores.Write the pseudocode.


so, did i do this right?


start
string lastName
string firstName
num birthdate
num totalSkillScore
string MAIN_HEADER="Campers Data"
string COLUMN_HEADERS
="First Name Last Name Birth Date Total Skill Score"
string lastFormat="15 characters MAX"
num swimScore
num tennisScore
num craftsScore
num horsemanshipScore
num birthdateFormat=YYYYMMDD
string ERROR_MSG="Invalid Format"
string ERROR_MSG2="Invalid Number"
print MAIN_HEADER
print COLUMN_HEADERS
print"last name and first name =15 characters max, birthdate = YYYMMDD"
print"Enter skill score from 1 to 10"
get lastName,firstName,birthDate,swimScore,tennisScore,craftsScore,horsemanshipScore
while not eof
If birthDate=birthDateFormat then
If lastName=lastFormat then
If firstName=lastFormat then
If(horsemanshipScore>=1AND<=10)AND(tennisScore>=1AND<=10)AND(craftsScore>=1AND<=10)AND
(swimScore>=1ANd<=10?then
totalSKillScore=horsemanshipScore+tennisScore+craftsScore+swimScore
else
print ERROR_MSG2
else
print ERROR_MSG
else
print ERROR_MSG
else
print ERROR_MSG
endif
print firstName,lastName,birthDate,totalSkillScore
get lastName,firstName,birthDate,swimScore,tennisScore,
craftsScore,horsemanshipScore
endwhile
stop


the thing is that I don't really know how to make sure the user enters the birthdate in the correct format[YYYYMMDD]or how to limit the number of characters in a name.

cooldude16
04-19-2010, 04:15 AM
Does anyone know if this is correct?please answer!!!!

oracleguy
04-19-2010, 05:12 AM
Welcome to CodingForums, please be aware of our guideline on bumping your thread:

5) Do not bump your thread repeatedly when you don't get a response. Sometimes when you post for help, you may not get a response in a timely matter, if at all. Forums aren't wishing wells, and some questions will fall through the cracks. That's a fact of life. It's ok to occasionally bump a thread, but only when done after an ample amount of time (ie: 2-3 days) have passed without a response, and never more than once, . Your thread is no more important than another member's when it comes to the amount of attention it should receive.

As for your question, after briefly looking at it, it looks like you got it correct. Though I wouldn't print out the record unless there was no error so you should consider moving the print to after you assign totalSKillScore a value so if there is an error the wrong thing isn't printed.

cooldude16
04-19-2010, 05:17 AM
Thanks a lot .One more thing is did I validate the birthdate correct?How can I validate that the user enters the right year format?