Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Oct 2011
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Exclamation Back to School and Lost

    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

  • #2
    $object->toCD-R(LP); vinyl-junkie's Avatar
    Join Date
    Jun 2003
    Posts
    3,088
    Thanks
    2
    Thanked 23 Times in 23 Posts
    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.
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more
    SNAP to it!

  • Users who have thanked vinyl-junkie for this post:

    CMST385 (10-09-2011)

  • #3
    New to the CF scene
    Join Date
    Oct 2011
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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?

  • #4
    $object->toCD-R(LP); vinyl-junkie's Avatar
    Join Date
    Jun 2003
    Posts
    3,088
    Thanks
    2
    Thanked 23 Times in 23 Posts
    Quote Originally Posted by CMST385 View Post
    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. Just keep plugging away at it. If you need more help or hints, just give us a shout.
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more
    SNAP to it!

  • #5
    New to the CF scene
    Join Date
    Oct 2011
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Exclamation

    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 grade
    Char letter

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

    If (grade <= 90) Then
    Letter = ‘A’
    Else
    If (If (grade <= 80&&grade>!90) Then
    Letter = ‘B’
    Else
    If (If (grade <= 70&&grade>!80) Then
    Letter = ‘C’
    Else
    If (If (grade <= 60&&grade>!70) Then
    Letter = ‘D’
    Else
    If (If (grade <= 50&&grade>!60) Then
    Letter = ‘F’
    Else
    If (If (grade == -1) Then
    Letter = ‘Not applicable’
    EndIf
    Last edited by CMST385; 10-10-2011 at 05:16 PM.

  • #6
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,184
    Thanks
    75
    Thanked 4,341 Times in 4,307 Posts
    ** continued in other thread **
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •