1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

HELP in c++ urgently needed please

Discussion in 'Meet and Greet' started by raul14, Aug 21, 2009.

  1. raul14

    raul14 New Member

    hi guys,
    i'm new to this and i desperately need help in a c++ question.
    its on arrays and pointers
    i urgently need the solution to the question attached
    please help

    :cry:

    if anyone can help me please e-mail me the solution:

    p_rahul@live.com

    this is my e-mail account

    please help please

    the attachment is a ZIP archive containg the question

    someone please help
     

    Attached Files:

  2. xpi0t0s

    xpi0t0s Mentor

    Problem statement
    IT South Pacific, a software company in Suva requires its annual budgetary
    report on IT
    staff salaries. This company’s 7 job titles and corresponding salaries are shown
    below in
    Table 1.1.
    TABLE 1.1 Job Titles and corresponding Salaries

    Job Title Yearly Salary
    Trainee_Programmer 15000
    Programmer 20000
    Analyst_Programmer 25000
    Senior_Analyst_Programmer 30000
    Database_Administrator 30000
    Assistant_Manager 35000
    Manager 40000


    According to company’s policy there cannot be more than 20 IT staff members at
    one
    time. Currently 12 IT positions are filled which can change when new staff
    members are
    recruited or old members have resigned. The details of current staff members are
    shown
    below in Table 1.2.
    TABLE 1.2 Individual Staff Members and their Job Titles

    Staff Job Title
    John Trainee_Programmer
    Sam Analyst_Programmer
    Brown Programmer
    White Programmer
    Merry Trainee_Programmer
    Tom Analyst_Programmer
    Harry Programmer
    Frank Trainee_Programmer
    Joe Manager
    Sony Assistant_Manager
    Angela Trainee_Programmer
    Karl Database_Administrator

    Assume these positions will be filled throughout the year. Now produce the
    summarized
    report to get individual job titles and their corresponding total salaries in the
    following
    format:

    (screen shot skipped)

    Requirements
    1. Write a program to store the table for Job Titles and corresponding Salaries
    i.e.
    data shown in Table 1.1.
    2. Write a function void print_salary_table(?) to print the table stored in
    question 1.
    3. Write a search function int salary_index(string job_title) to
    find the array index from the given job title. For example return 0 for
    Trainee_Programmer, 1 for Programmer and so on.
    4. Use the information given in Table 1.2 to determine the total amount of
    salaries
    for each job title. [Hint: Determine total individual job titles in order to determine
    total salaries for individual job title]
    5. Make a function print_annual_budget to print the table for job titles and
    sum of salaries as shown in Fig 1.1.
    6. Additional bonus marks will be given for using 2 dimensional arrays.
    DO NOT VALIDATE ANY KEYBOARD ENTRY UNLESS OTHERWISE SPECIFIED

    Use the following code to check for file error
    Code:
    if (input.fail()){ 
      cerr<<"File not found!"<<endl; 
      system("PAUSE"); 
      return 0; 
    }
    
    Use if possible:

    1. char *_itoa(int value, char *string, int radix)
    Converts int to string

    2. int atoi(const char *string)
    Converts string to int

    3. string str;
    const char * cpt;
    cpt = str.c_str();
    Converts string to const char*

    4. String formatting using <iomanip.h> header file
    Study about <iomanip.h>, setiosflag(?) and setw(?) to represent the data nicely
    in tabular
    format
     
  3. xpi0t0s

    xpi0t0s Mentor

    OK, this seems fairly well specced out. Where are you stuck?
     
  4. raul14

    raul14 New Member


    i have no idea how to this. can you please provide me with a solution please.iv got onli till wednesday(26/08) to finish it and i have no idea where to begin.

    can you help me please.

    i'm no good when it comes to programming.

    please help me please.
     
  5. xpi0t0s

    xpi0t0s Mentor

    > can you please provide me with a solution please
    No, sorry, you're on the programming course to learn programming, and the only way to learn programming is by doing it. If you want others to do your work for you then you should be on a Management course.

    > i have no idea where to begin
    If you've really no idea where to begin then has this approach been the one you've taken throughout, i.e. asking others to do your homework for you? The problem with this method is that programming tasks get progressively harder, so if you don't work out the first one yourself then you're not going to be able to figure out the next one, and so on until you hit a crunch time like this.

    Begin by understanding the requirements. Then design any data structures that may be needed, ensuring you build in some flexibility in case these change (for example, instead of char Name[20] and using the constant 20 all over the program, create a constant called, say, NAMELENGTH and define char Name[NAMELENGTH] and use NAMELENGTH instead of 20. More typing involved but you'll really appreciate this when you realise that the length should have been 25.)

    Then if possible start by just coding up Requirement 1. Add the rest later. If you have understood the requirements in full then you can add some hooks in so that adding new requirements will be less of a task, but that's optional. Debug Requirement 1 and get it fully working before proceeding.

    Keep a cool head. Don't tell yourself you can't do this. You can do it; it's not a complicated task, but it does need breaking down and tackling a bit at a time. Get the first bit done and ignore the rest, and that will give you the confidence to proceed to the next part. Use your course notes to help you; everything you need will be in there.

    > iv got onli till wednesday(26/08)

    So keep a cool head, stay focussed, break it down and work on one bit at a time. Take regular coffee/stretch breaks. The deadline is not unreasonable and you should be able to get much of the task done in that time, if not all of it. Once you've got the hang of it and got a few basic functions written to handle the low level tasks (reading and writing files for example) it's surprising how quickly you can proceed.
     
  6. mayjune

    mayjune New Member

    xp's right as always...
    why do people expect that people on forums are free to just do there homework...atleast do some part of it....start somewhere, we'll help you if you are stuck, if you don't know how to start ask something specific to get you started, but don't expect us to do it for you...
     

Share This Page