#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Posts
    3
    Rep Power
    0

    I need help with writing a python program


    Hi devshed memebers
    I've trying to write this python program for days and so far no luck with running it.
    i just don't understand the idea of it
    can someone please help me with writing it
    this is the logic that i was given

    Thanks!!
    ---------------------------------------------------------------------
    COMS B10 – Structured Program Design
    Assignment #4 (Grade Calculator)
    Create the Python program that will allow a user to generate a grade report containing grade
    averages for up to 5 courses. Your program should be able to create a run that looks EXACTLY
    like the sample run. Make sure you pay close attention to the details, i.e., spacing, indentation,
    and string manipulation (case, concatenation, etc.).
    Your program should perform the following:
    1. Print “GRADE CALCULATOR PROGRAM” as your heading.
    2. Print a blank line.
    3. Ask the user for their name and address information.
    4. Print a blank line.
    5. Allow the user to type in grade information for up to 5 courses. You should print the grade
    report when they enter “STOP” for the course name OR if they have entered information for
    5 courses.
    6. For each course, get the name of the course, and the points received and points possible for
    as many courses as the user enters. Your program should skip to the next course when they
    type 9999 for the points received.
    7. After all the course information has been entered, print the name and address information as
    it would appear on an envelope.
    8. Print a line indicating each course name and the percentage grade received.
    9. Print the overall GPA
    10. Terminate the program in the normal method.
    Additional notes:
    · You must use the program template for your program.
    · Upload a copy of your program source code to Moodle AND turn in a printed copy of your
    source code to me.
    · Your messages and prompts should look EXACTLY like those in the sample. Duplicating
    all blank lines and spacing.
    SAMPLE PSEUDOCODE
    Declare the variables and constants
    Print headings
    Get name and address information from the user
    Make sure to change the case of the input appropriately
    Set the course loop counter to 0
    Set the total scores accumulator to 0
    Set the total points possible accumulator to 0
    Get the course name (Priming Get)
    While the course name does not equal “STOP” and the course loop < 5
    Add 1 to the course loop counter
    Get the assignment score (Priming Get)
    While the assignment score does not equal 9999
    Add the assignment score to the total scores accumulator
    Get the assignment possible points
    Add possible points to the total possible points accumulator
    Get the assignment score (Post Get)
    Calculate the course average and round to 2 decimal places
    Store the course average and course information in the appropriate course line 1-5
    Add the course average to the grand total accumulator
    Set the total scores accumulator to 0
    Set the total points possible accumulator to 0
    If course loop counter < 5 (Do this only because there are 2 items that can stop the loop)
    Get the course name (Post Get)
    Print 2 blank lines
    Print name and address like on an envelope
    Print each of the course lines if they exist
    Print the overall GPA
    Sample run:
    GRADE CALCULATOR PROGRAM
    Enter your first and last name: phil whitney
    Enter your street address: 1801 panorama drive
    Enter your city: bakersfield
    Enter your state abbreviation: ca
    Enter your zip code: 93308
    Enter course name (Type 'STOP' when finished): coms b10
    Enter points received for assignment (Type '9999' when finished): 10
    Enter points possible for this assignment: 10
    Enter points received for assignment (Type '9999' when finished): 20
    Enter points possible for this assignment: 20
    Enter points received for assignment (Type '9999' when finished): 30
    Enter points possible for this assignment: 30
    Enter points received for assignment (Type '9999' when finished): 9999
    Enter course name (Type 'STOP' when finished): coms b11
    Enter points received for assignment (Type '9999' when finished): 5
    Enter points possible for this assignment: 10
    Enter points received for assignment (Type '9999' when finished): 10
    Enter points possible for this assignment: 20
    Enter points received for assignment (Type '9999' when finished): 15
    Enter points possible for this assignment: 30
    Enter points received for assignment (Type '9999' when finished): 9999
    Enter course name (Type 'STOP' when finished): stop
    Phil Whitney
    1801 Panorama Drive
    Bakersfield, CA 93308
    COMS B10 percentage grade = 100.0%
    COMS B11 percentage grade = 50.0%
    Overall GPA = 75.0%
    Run complete. Press the Enter key to exit.
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Location
    Saint-Petersburg, Russia
    Posts
    237
    Rep Power
    29
    I've trying to write this python program for days and so far no luck with running it.
    Perhaps if you post here what you have written so far and ask more specific questions, you will have better chance of help. It does not look like anyone really wants to write your assignment instead of you completely.

    If you have problems with python, I dare to recommend google for "python tutorial" and select one suitable for your version of python (2 or 3).

    Your task does not look extremely difficult, so cheer up and try to work in some more systematic way - at least then you can decide what to ask...
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Posts
    3
    Rep Power
    0
    this is what i have written so far
    -----------------------------------------------------------
    #-----------------------------------------------------------------------
    # Program name: Grade calculator
    # Author: Abdulhalim Rafeik
    # Date: 9/28/2013
    # Purpose:
    #
    #-----------------------------------------------------------------------
    # VARIABLE DEFINITIONS
    name = ""
    street = ""
    city = ""
    state = ""
    zipCode = ""
    courseLoop = 0
    totalScoresAccu = 0
    pointsPossibleAccu = 0
    courseName = ""
    assignmentScore = 0.0
    pointsPossible = 0.0
    assignmentCounter = 0
    #-----------------------------------------------------------------------
    # CONSTANT DEFINITIONS

    #-----------------------------------------------------------------------
    # FUNCTION DEFINITIONS

    #-----------------------------------------------------------------------
    # PROGRAM'S MAIN LOGIC
    print "GRADE CALCULATOR PROGRAM\n"
    name = raw_input("Enter your first and last name: ").capitalize()
    street = raw_input("Enter your street address: ").capitalize()
    city = raw_input("Enter your city: ").capitalize()
    state = raw_input("Enter your state abbreviation: ").upper()
    zipCode = raw_input("Enter your zip code: ")
    courseName = raw_input("Enter course name (type 'STOP' when finished): ")
    while courseName != "STOP" and courseLoop < 5:
    courseLoop += 1
    assignmentScore = float(raw_input("Enter points received for assignment"/
    "(Type '9999' when finished): "))
    while assignmentScore != 9999:
    totalScoresAccu += assignmentScore
    pointsPossible = float(raw_input("Enter points possible for this"/
    "assignment: "))
    pointsPossibleAccu += pointsPossible
    assignmentScore = float(raw_input("Enter points received for assignment"/
    "(Type '9999' when finished): "))
    assignmentCounter += 1
    totalScoreAverage = totalScoresAccu / assignmentCounter
    totalScoreAverage = round(totalScoreAverage, 2)











    raw_input("\nRun complete. Press the Enter key to exit.")
    --------------------------------------------------------
    my problem is that i don't know how em i gonna assign each class name to a diffrent variable.
    every time a user enters aclass name the program is supossed to save that class name to a variable. and the program should allow the user to enter up to 5 classes and assign eatch class name to a deffrent variable,
    its like every time the program loops to ask for the class name the variable to witch that name will be saved is supposed to be diffrent

    can someone help me with that pleas!!
    thanks

IMN logo majestic logo threadwatch logo seochat tools logo