Results 1 to 3 of 3

Thread: Final Exam Urgent Help Needed! 1.5 Hrs Left

  1. #1
    Join Date
    Mar 2006
    Location
    Northern Kentucky
    Posts
    34
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Final Exam Urgent Help Needed! 1.5 Hrs Left

    Quick synopsis I'm on my final exam for college. I have a few questions that have me puzzled.

    Assume an array named salesData[] contains a company's sales figures for the last twelve months. The following is the (partial) pseudocode for a program that uses an accumulator (totalSales), a counter (monthNumber), a loop to sum all the elements in the array, and uses the sum to find the average sales figures over the last 12 months. (Assuming not zero based)

    Part A: fill in the missing elements of the pseudocode (15 points)

    totalSales = ___________

    for monthNumber = 1 to ___12_______ //this was np

    totalSales = ___________ + salesData[ ___________ ]

    endfor

    salesAverage = ____totalSales________ divided by 12 //this part easy

    Part B: Code a second loop to determine how many months the sales exceed the average and then output that value. (10 points)
    The following pseudocode for the logic of a program does the following:

    1) Prompts the user to input a savings account balance and inputs that balance.
    2) Prompts the user to enter the annual interest rate for the account and inputs the interest rate.
    3) If the interest rate was not entered in decimal form, it converts it to a decimal.
    4) Calculates twice the current balance and set this equal to the target balance;
    5) Initializes the year counter that will keep track of the number of years it takes.
    6) Calculates the balance of the account as it continues to earn interest until the balance in the account has reached or exceeded the target balance (each year the new balance is equal to the old balance plus the old balance times the interest rate);
    7) Output the number of years it takes to reach the target balance.

    Note: each row (1-7) in the table given below refers to the description (1 - 7) given above.


    output _______________

    input balance


    output _______________

    input rateOfReturn


    if rateOfReturn >= 1 then

    rateOfReturn = _____________ divided by 100

    _________


    targetBalance = 2 _________ balance



    yearCounter = _____________


    while balance < targetBalance

    ____________ = ____________ + balance times rateOfReturn

    yearCounter = ______________

    endwhile


    output "It will take " + ____________ + "years to double your balance."
    Any help would be greatly appreciated.
    Please delete this post after 1.5 hours

  2. #2
    Join Date
    Mar 2007
    Posts
    3,042
    Mentioned
    1 Post(s)
    Quoted
    14 Post(s)

    Default

    For the first one, you probably instantiate totalSales at 0. Then, when you're adding to it, you probably can do totalSales = totalSales + salesData[monthNumber]. Finding the number of months above the average is easy - loop through each value of salesData and increment a counting variable if the sales for that month is greater than salesAverage.

    The first two outputs for the second one are probably just strings asking for the information needed. Those are easy. Third spot should be rateOfReturn. Number four seems as simple as multiplying the two, but I'm not sure about it. The fifth one should be zero. The two blanks on number six are both balance. And finally, number seven is yearCounter.

    This coding style is really weird, so forgive me if I couldn't figure out everything. I'm more used to Java. Good luck.
    :-)

  3. #3
    Join Date
    Mar 2006
    Location
    Northern Kentucky
    Posts
    34
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Hey thanks we're not dealing with any specific language atm just psuedocode or "computer language in english" you we're a big help though thanks

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Oriental Eye Exam - HILARIOUS!!!
    By Daniel in forum Semi Stupid Pictures
    Replies: 21
    Last Post: 04-06-2009, 08:51 AM
  2. urgent help needed need to transfer some money
    By gamesngeeks in forum RuneScape News and General
    Replies: 5
    Last Post: 05-08-2008, 11:46 PM

Posting Permissions

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