PDA

View Full Version : Back to School and Lost

CMST385
10-09-2011, 06:06 PM
Hello there,

I'm a 30yr old returning to school and I signed up for a CMIS102 class, thinking it be more explanatory as the syllabus let on. But I was wrong. While I do understand some of what the professor has been teaching us, like modular programming and IfElse statements, I can't wrap my head around things like While Loops.

My professor has saddled us with a couple assignments, requiring us to write in pseudocode and I was wondering if anyone could explain what he wants from this assignment or even help me with it, that maybe I can finally have a grasp of it, and will know what I'm doing on the final.

~Tia

P.S.
I've posted the assignment question below:

I need to write a pseudo-codepseudocode for the following question but don't know how:

Write a program to read a list of exam scores (in the range 0 to 100) and to output the total number of grades and the number of grades in each letter=grade category.

The end input is indicated by a negative score as a sentinel value. (The negative value is used only to end the loop, so do not use it in the calculations.

Example:
88
93
55
77
100
-1

(The output would be)
Total number of grades = 5
Number of A's =2
Number of B's = 1
Number of C's =1
Number of D's = 0
Number of F's =1
Must prompt user to run again

vinyl-junkie
10-09-2011, 07:10 PM
Pseudocode is just a high-level description of the processes necessary to describe how your application should work. It's not written as an actual programming language; that's why it's call pseudocode. There is no right or wrong way to do this, but it should be something that you could take the pseudocode and translate it into your coding language of choice.

Below is some pseudocode to both explain what you're trying to do and get you started on your assignment.

Initialize counters for the number of A's, B's, C's, D's and F's

Read the first record in the recordset

While records still exist in the recordset
{
Do something with the A's
Do something with the B's
etc.

Read the next record
}

Do something when you're done reading the records

Hope this helps.

CMST385
10-09-2011, 07:48 PM
That does make sense to a degree, however, I can't put two and two together. I want to explain without seeming like I don't know anything outright. So, let me give it a shot and you tell me if I'm on the right track?

1.)Initialize counters for the number of A's, B's, C's, D's and F's

<>This would be setting up my variables and explaining what number grade they are connected to.

2.) Read the first record in the recordset

<>I create a record that the program will read, then output?

3.) While records still exist in the recordset
{
Do something with the A's
Do something with the B's
etc.

<> The actual calculation part within my pseudocode.

4.) Do something when you're done reading the records

<>Concotencate?

vinyl-junkie
10-09-2011, 08:07 PM
That does make sense to a degree, however, I can't put two and two together. I want to explain without seeming like I don't know anything outright. So, let me give it a shot and you tell me if I'm on the right track?

1.)Initialize counters for the number of A's, B's, C's, D's and F's

<>This would be setting up my variables and explaining what number grade they are connected to.

Correct.

2.) Read the first record in the recordset

<>I create a record that the program will read, then output?

I would assume that the records have already been created that you are reading. Check with your instructor though if you're in doubt about that. You don't output anything until you have read all the records. "Read the first record" just initializes the read. The "while" loop below processes all the records prior to output.

3.) While records still exist in the recordset
{
Do something with the A's
Do something with the B's
etc.

<> The actual calculation part within my pseudocode.

Correct.

4.) Do something when you're done reading the records

<>Concotencate?
Write the results; e.g., what you wrote in the problem statement. For example:
Number of A's =2
etc.

You're on the right track. :thumbsup: Just keep plugging away at it. If you need more help or hints, just give us a shout.

CMST385
10-10-2011, 05:48 PM
This is what I have so far, but I'm not sure if its correct...According to the instruction I think it is supposed to create a list or something like that?

Help where I went wrong?

/*
Write a program to read a list of exam scores (in the range 0 to 100) and to output the total number of grades and the number of grades in each letter=grade category. The end input is indicated by a negative score as a sentinel value. (The negative value is used only to end the loop, so do not use it in the calculations.
*/

//Define Variables for review by fellow programmers:
Char letter

//Input
Write “Input the grades for Class #1.”

If (grade <= 90) Then
Letter = ‘A’
Else
Letter = ‘B’
Else
Letter = ‘C’
Else