Sponsored Links


Results 1 to 5 of 5

Thread: CS301 Data Structures Assignment No. 1 Solution and Discussion Fall 2014

  1. #1
    Senior Member
    Join Date
    Oct 2012
    Posts
    323

    CS301 Data Structures Assignment No. 1 Solution and Discussion Fall 2014

    Sponsored Links1


    CS301 Data Structures Assignment No. 1 Solution and Discussion Fall 2014 Due Date: November 17, 2014



    Sponsored Links

    Problem Statement:
    Suppose a company Oraflex organizes interviews for a vacant post. Assume that the interviews of the successful
    candidates after short listing has been started and interview marks are being assigned. You being software
    developer of the company are assigned a task to prepare candidates’ list that will store candidates’ information
    such as their names, test score, interview marks and then display the selected candidate.
    Keeping in view the above scenario, write a program in C++ that will store and display candidates’ names, test
    scores, and interview marks. Further, Your program should contain a function to calculate total score of each
    candidate. It should also contain a function that will display the total number of candidates appeared. Finally, it
    should display the selected candidate.



    Solution Guidelines:



    Use Linked List to implement above scenario.
    Your solution should contain the following two classes:
    Candidate class (Node class)
    CandidateList class (LinkedList class)
    Candidate class should contain constructors, setter and getter functions.
    Create a list of candidates and store each candidate’s information in the candidate list.
    Display each candidate’s information as given in simple output.
    Find and Display total number of candidates appeared in interview.
    Find the selected candidate on the basis of highest score obtained.
     Display the selected candidate along with its score (See sample output



  2. #2
    Senior Member Entboy's Avatar
    Join Date
    Dec 2011
    Posts
    5,454
    i also want help in this assignment

  3. #3
    Senior Member viki's Avatar
    Join Date
    May 2010
    Posts
    2,132
    #include <conio.h>
    #include <iostream>
    using namespace std;
    int n_prime(int n_last);

    int main(int argc, char *argv[])
    {
    int your_num;
    cout"Enter No= ";
    cin>>your_num;
    cout n_prime(your_num);
    system("PAUSE");
    return EXIT_SUCCESS;
    }

    int n_prime(int n_last){
    int count,x;
    count=0;
    for(x=2;x<=n_last/2;x++){
    if(n_last%x==0){
    count++;
    break;
    }
    }
    if(count==0){
    cout"Prime"endl;
    }else{
    cout"Composite"endl;
    }
    }
    {

    public:

    Stack() { size = 10; current = -1;} //constructor

    int pop(){ return A[current--];} // The pop function

    void push(int x){A[++current] = x;} // The push function

    int top(){ return A[current];} // The top function

    int isEmpty(){return ( current == -1 );} // Will return true when stack is empty

    int isFull(){ return ( current == size-1);} // Will return true when stack is full
    {

    1. int x = head->get();

    2. Node * p = head;

    3. head = head->getNext();

    4. delete p;

    5. return x;

    }
    void push(int x)

    {

    1. Node * newNode = new Node();

    2. newNode->set(x);

    3. newNode->setNext(head);

    4. head = newNode;

    }
    :o:o--------------------------------------------------------------------------------------:o:o
    [B]The more knowledge you have, the greater will be your fear of Allah.[/B]

    Please Join My [B]Group Vuhelp[/B][B], Birthday Wishing, Daily Hadees[/B] [CODE][B]http://vuhelp.net/groups/vuhelp.html[/B]
    [B]http://vuhelp.net/groups/birthday-wishing.html[/B]
    [B]http://vuhelp.net/groups/daily-hadees.html[/B][/CODE]
    [CENTER][B][COLOR="Red"][SIZE="4"]Email: [email]viki@vuhelp.net[/email][/SIZE][/COLOR][/B][/CENTER]

  4. #4
    Senior Member viki's Avatar
    Join Date
    May 2010
    Posts
    2,132
    #include

    using namespace std;
    class Node{

    public:

    void set(int object1){
    object = object1;

    }
    int get(){return object;}
    Node *getNext(){return nextNode;}
    void setNext(Node *next){this->nextNode = next;}

    private:
    int object;

    Node *nextNode;

    };
    class List{

    public:
    List();
    void add(int addobject);
    int get();
    bool next();
    friend void traverse(List list);
    friend List addNodes();

    private:
    int size;
    Node * headNode;
    Node *currentNode;
    Node * lastCurrentNode;

    };
    List::List(){// list constructor
    headNode= new Node();
    headNode-> setNext(NULL);
    currentNode = NULL;
    lastCurrentNode=NULL;
    size=0;
    }
    void List::add(int addobject){ //method for add new object
    Node * newNode= new Node();
    newNode->set(addobject);
    if(currentNode!=NULL){
    newNode->setNext(currentNode->getNext());
    currentNode->setNext(newNode);
    lastCurrentNode = currentNode;
    currentNode = newNode;
    }
    else{
    newNode->setNext(NULL);
    headNode->setNext(newNode);
    lastCurrentNode = headNode;
    currentNode = newNode;
    }
    size++;
    }
    int List::get(){
    if(currentNode!=NULL){
    return currentNode->get();
    }
    }
    bool List:: next(){
    if(currentNode == NULL) return false;
    lastCurrentNode = currentNode;
    currentNode = currentNode->getNext();
    if(currentNode==NULL || size==0) return false;
    else return true;

    }
    void traverse(List list){
    Node *savedCurrentNode = list.currentNode;
    list.currentNode= list.headNode;
    for(int i=1; list.next(); i++){
    cout"\n Element "i" "list.get();

    }
    list.currentNode= savedCurrentNode;
    }
    List addNodes(){
    List list;

    list.add(1);
    list.add(2);
    list.add(3);
    list.add(4);
    list.add(5);
    list.add(6);
    cout"\n list size "list.size;
    return list;
    }
    // main method
    main(){
    List list = addNodes();

    traverse(list);

    coutendl;
    system("pause");
    }

    :o:o--------------------------------------------------------------------------------------:o:o
    [B]The more knowledge you have, the greater will be your fear of Allah.[/B]

    Please Join My [B]Group Vuhelp[/B][B], Birthday Wishing, Daily Hadees[/B] [CODE][B]http://vuhelp.net/groups/vuhelp.html[/B]
    [B]http://vuhelp.net/groups/birthday-wishing.html[/B]
    [B]http://vuhelp.net/groups/daily-hadees.html[/B][/CODE]
    [CENTER][B][COLOR="Red"][SIZE="4"]Email: [email]viki@vuhelp.net[/email][/SIZE][/COLOR][/B][/CENTER]

  5. #5
    Administrator Xpert's Avatar
    Join Date
    May 2010
    Location
    Jhelum
    Posts
    6,239
    yah tu seprate files han beaware of it................................dont copy paste in one file and send u will get zero atleast change variable names.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 12-03-2014, 02:20 PM
  2. CS301- Data Structures Assignment No.1 Solution Spring 2014
    By Zombee in forum Assignments & Solutions
    Replies: 1
    Last Post: 05-07-2014, 03:19 PM
  3. CS301-Data Structures Assignment No.3 Fall 2014 Due Date 13-01-2014
    By vuassignments in forum Assignments & Solutions
    Replies: 0
    Last Post: 01-09-2014, 04:06 PM
  4. Replies: 0
    Last Post: 01-28-2013, 02:46 PM
  5. Replies: 0
    Last Post: 01-10-2013, 08:13 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
  •  
-: Vuhelp Disclaimer :-
None of the files shown here are hosted or transmitted by this server. The links are provided solely by this site's users. The administrator's or staff of Vuhelp.net cannot be held responsible for what its users post, or any other actions of its users. You may not use this site to distribute or download any material when you do not have the legal rights to do so. It is your own responsibility to adhere to these terms. If you have any doubts about legality of content or you have any suspicions, feel free to contact us.
Online Education | JhelumSoft