Questions
****NEED CODED IN C++, READ THE INSTRUCTIONS CAREFULLY AND PAY ATTENTION TO THE INPUT FILE, IT...

****NEED CODED IN C++, READ THE INSTRUCTIONS CAREFULLY AND PAY ATTENTION TO THE INPUT FILE, IT IS REQUIRED FOR USE IN THE PROBLEM****

You are to generate a list of customers to serve based on the customer’s priority, i.e. create a priority queue/list for a local company. The company has been receiving request and the request are recorded in a file, in the order the request was made. The company processes each user based on their priority, the highest priority which is the largest number. Priorities of equal value are first come first served as listed in the input file.  

Your input is a collection of customer IDs and priority, one per line.  

You are to read in the data and insert new data into a sorted linked list. The linked list is sorted by priority.

A customer may need an update on his order. He may submit a request a second time in order to change his priority level. If so, you will search the linked list, change the priority and adjust the new order in the sorted link list.

Input file: Priority Queue.txt

Output: List of ID’s with priorities in priority order

Example input:

1345 4

8243 1

Example output:

Customer Processing Order

Customer ID Priority

4124 5
1345 4

….    ….

Restrictions: Use an ordered link list for the data structure and a nice formatted print out.

INPUT FILE (NECESSARY TO IMPORT THE DATA INTO THE PROGRAM, NEEDS TO BE USED WITH IFSTREAM)

Priority Queue.txt

1432 2
8234 3
2124 5
8123 2
1314 2
1432 4
7141 3
7123 4
5523 1
6543 2
1731 5
3813 4
7213 5
3318 5
7213 3
7131 2
8882 3
9974 1
7221 3
7342 4
5523 3
3113 5
7002 4
9769 1
3145 5
7145 3
8834 2
9123 4
7878 1
7588 4
2025 1
6069 3
2025 3

The instructions can be translated as follows:

The objective is to make a priority queue/list.

The requests made to fill this queue include a 4-digit customer number and priority level ranging from 1 through 5.

This information is stored in a file.

If 2 customers have the same prio level, then the one that comes first in the list is treated as higher prio.

(first come, first serve basis)

I need to read in Priority Queue.txt to a sorted linked list. (sorted by prio)

I also need to insert new data into this linked list based on user input.

The input is based on a user being able to submit a 2nd request by entering their ID to change their prio level.

I can assume that when they do this, they bump their priority by 1. This is assumed because this program would serve no real function if every customer could just send another request and automatically be prio-5 or set that themself.

In this case, you want to search the Linked List, find the customer ID, change the prio, and adjust the new order in the sorted Linked List.

An ordered Linked List must be used for the data structure, and the output must be formatted neatly.

For input, this program will port in Priority Queue.txt for data.

For output, the program will display the Customer IDs in order of priority, keeping the FCFS rule in mind.

It will then prompt a user to be able to input their Customer ID for another request, bumping their prio by 1, re-sorting the LL, then outputting the new list.

Again, this is CODED IN C++ AND USES THE INPUT FILE FOR DATA.

In: Computer Science

You will create a program that runs in one of two modes, interactive mode and test...

You will create a program that runs in one of two modes, interactive mode and test mode. The mode will determined by the command line, passing in a "-i" flag for interactive or "-t" for test mode. Require the user to pass in a flag.

$> ./lab02 -i
Make a selection:
1) Insert value at position
2) Remove at position
3) Replace value at position
4) Print length
5) Print list
6) Exit
Choice: 
$> ./lab02 -t
<output from your test class automatically prints>

LinkedList Header File

#ifndef LINKED_LIST_H
#define LINKED_LIST_H

#include "Node.h" //Gone over in class
#include <stdexcept> //For runtime_error
class LinkedList
{
     private:
     Node* m_front;
     int m_length;
    
     public:
     LinkedList();
     LinkedList(const LinkedList& original);
     ~LinkedList();
     LinkedList& operator=(const LinkedList& original);
     bool isEmpty() const;
     int getLength() const;
     void insert(int position, int entry); 
     void remove(int position); 
     void clear();
     int getEntry(int position) const;

     /** Here's an example of a doxygen comment block. Do this for all methods
     * @pre The position is between 1 and the list's length
     * @post The entry at the given position is replaced with the new entry
     * @param position:  1<= position <= length
     * @param newEntry: A new entry to put in the list
     * @throw std::runtime_error if the position is invalid.
     **/
     void replace(int position, int newEntry);
};
#endif

Method Descriptions

  • LinkedList()
    • Creates an empty list
  • Copy Constructor
    • Creates a deep copy
  • ~LinkedList
    • deletes all nodes (note, this could just call clear...)
  • isEmpty
    • Returns true if empty, false otherwise
  • getLength
    • Returns the length
  • insert
    • adds a node containing the entry at that position (so the number of nodes is increased by 1)
    • positions range from 1 to length+1
    • NOTE: The reason for length+1 is to insert at the back of the list
    • if the position is out of range, it throws an exception
  • remove
    • deletes the node at that position (so the number of nodes is decreased by 1)
    • positions range from 1 to length
    • if the position is out of range, it throws an exception
  • clear
    • deletes all nodes in the list
  • getEntry
    • Returns the entry at a given position
    • positions range from 1 to length
    • if the position is out of range, it throws an exception
  • replace
    • replaces the entry at a given position
    • The number of nodes is unchanged
    • positions range from 1 to length
    • if the position is out of range, it throws an exception

Notes

  • You may add private helper functions as you see fit, but their responsibility should be in line with that of a List
  • Never expose private member to other scopes
  • LinkedLists ARE NOT in charge of printing themselves
  • Note: you'll also need to make a Node implementation

LinkedListTester class

  • Runs a battery of tests to verify that our Linked List is working
  • Has a single entry point called runTests()
  • Each test prints what test is currently running and if the List Passed or failed
  • Each test method should work in a vacuum, meaning each test

Sample LinkedListTester.h

class LinkedListTester
{   
    public: 

    LinkedListTester();

    //This will call all your test methods
    void runTests();
     
    private:

    /**
    * @brief Creates an empty list and verifies isEmpty() returns true
    **/
    void test01();

    /**
    * @brief Creates an empty list adds 1 value, verifies isEmpty() returns false
    **/
    void test02();

    /**
    * @brief Creates an empty list and verifies getLength() returns 0
    **/
    void test03();

    //more test methods as needed
};

Tests

I am provided you with some starter tests that you must implement. You will also be required to add new tests for methods not mentioned here

Each test should be ran in isolation, meaning the tests could be run in any order and they don't share any objects/data.

Size tests

  1. size of empty list is zero
  2. size returns correct value after inserting at front of list
  3. size returns correct value after inserting at back of list
  4. size returns correct value after inserting in middle of list
  5. size returns correct value after adds and removing from front of list
  6. size returns correct value after adds and removing from back of list
  7. size returns correct value after adds and removing from middle of list

Insert tests

  1. insert throws exception if given an invalid position

Sample Test Output

$>./lab02 -t
Test #1: size of empty list is zero  PASSED
Test #2: size returns correct value after inserting at front of list addFront PASSED
Test #3: size returns correct value after inserting at back of list FAILED
$>

In: Computer Science

Write a C program for a library automation which gets the ISBN number, name, author and...

Write a C program for a library automation which gets the ISBN number, name, author and publication year of the books in the library. The status will be filled by the program as follows: if publication year before 1985 the status is reference else status is available. The information about the books should be stored inside a linked list. The program should have a menu and the user inserts, displays, and deletes the elements from the menu by selecting options. The following data structure should be used. struct list{ char ISBN[ 20 ]; char NAME[ 20 ]; char AUTHOR[ 20 ]; int YEAR; char STATUS[20]; struct list *next; }INFO; The following menu should be used in the program. Press 1. to insert a book Press 2. to display the book list Press 3. to delete a book from list Hint: use strcpy to fill STATUS.

In: Electrical Engineering

For this concept map, you will be choosing an abnormal finding for Eyes from chapter 14...

For this concept map, you will be choosing an abnormal finding for Eyes from chapter 14 in your Jarvis text. Subtopics should include:

Locate—* list common assessment findings or objective observations associated with the abnormal finding

Communicate—*list questions you would ask the patient related to the abnormal finding

Medicate—list expected treatments/medications for the abnormal finding

Educate—list pertinent patient education items related to the abnormal finding and/or its prevention

Advocate—list items you would request from the physician or advocate for concerning the abnormal finding ie: therapy, home care, etc You are not limited to these subtopics, but these subtopics must all be included. Each subtopic should include at least 2-4 supporting characteristics for that subtopic. APA format is not required on this assignment, but correct spelling and grammar should be used.

In: Nursing

For this concept map, you will be choosing an abnormal finding for respiratory System from chapter...

For this concept map, you will be choosing an abnormal finding for respiratory System from chapter 18 in your Jarvis text.

Subtopics should include:

  • Locatelist common assessment findings or observations associated with the abnormal finding
  • Communicatelist questions you would ask the patient related to the abnormal finding
  • Medicatelist expected treatments for the abnormal finding
  • Educatelist pertinent patient education items related to the abnormal finding and/or its prevention
  • Advocatelist items you would request from the physician or advocate for concerning the abnormal finding

You are not limited to these subtopics, but these subtopics must all be included.

Each subtopic should include at least 3-4 supporting characteristics for that subtopic.

APA format is not required on this assignment, but correct spelling and grammar should be used.

Please review the rubric before submitting your concept map.

In: Nursing

Choose a real residential community of more than one person. Describe its macroeconomy. Treat the community...

Choose a real residential community of more than one person.
Describe its macroeconomy.
Treat the community as though it were a country.
If people don't want to disclose information, select another community.

Answer these questions:

What kind of governance does your community have?
E.g. homeowner's association, SCU and dorm administration, city government.
How are financial decisions made?

Calculate the GDP and its parts:
List on a table, and enter the totals of income from all sources, including wages, loans, scholarships, and gifts.
You don't need to list the individual persons' incomes.
List and describe the categories (consumption, investment) and totals of spending, including tuition and housing, and savings.
List the purchase and sale of foreign assets such as a bank account.
Include total income and GDP income and spending.
List these in tables, and then provide relevant explanations.


Have there been any investments?

In: Economics

Java program Prime Numbers A prime number is a natural number which has exactly two distinct...

Java program

Prime Numbers

A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.

Write a java program which reads a list of N integers and prints the number of prime numbers in the list.

Input: The first line contains an integer N, the number of elements in the list.

N numbers are given in the following lines.

Output: Print the number of prime numbers in the given list.

Constraints:

1 ≤ N ≤ 10000

2 ≤ an element of the list ≤ 108

Sample Input 1

5
2
3
4
5
6

Sample Output 1

3

Sample Input 2

11
7
8
9
10
11
12
13
14
15
16
17

Sample Output 2

4

In: Computer Science

Create a Python program that: Allows the user to enter a phrase or sentence. The program...

Create a Python program that:

  • Allows the user to enter a phrase or sentence.
    • The program should then take the phrase or sentence entered
      • Separate out the individual words entered
      • Each individual word should then be added to a list
  • After all of the words have been place in a list
    • Sort the contents of the list
    • Display the contents of the sorted list with each individual word displayed on a separate line
  • Display a message to the user indicating when all of the items in the list have been displayed

The program should:

  • Use variables with meaningful names
  • Display easily understood prompts when collecting user input
  • Have appropriate comments indicating what each part of the program is doing
  • Have a comment area at the beginning of the program identifying the author of the program and the class it was created for

Save the program as a Python module, and submit the program through this assignment.

In: Computer Science

For a LinkedList in Java how do I - Add a method named replace() that takes...

For a LinkedList in Java how do I

- Add a method named replace() that takes in two parameters (the data object to replaced, followed by the one to be inserted) that will remove the first occurrence of the item to be replaced and add the second parameter to the list. The method returns a boolean - true if the item to be replaced was found, false if not

- Add an instance method named showList() (no parameters or return value) that will extract all of the values from the list and display them in order, one per line, followed by another line displaying how many values are currently in the list. If the list is empty, display the message “The list is currently empty” instead

- Overload showList() with an integer parameter which represents how many items to display on each line. The method needs to newline after the last item no matter how many items were displayed (i.e. don’t leave the cursor hanging.)

In: Computer Science

Consider the following database schema: LIKE(person, sport), PRACTICE(person, sport), where person and sport are keys in...

Consider the following database schema:

LIKE(person, sport),

PRACTICE(person, sport),

where person and sport are keys in both tables. The table LIKE gives the sports a person likes, the table PRACTICE gives the sports a person practices. We assume that a person likes at least one sport and practices at least one sport. We assume also that a person does not like a sport if the sport is not listed among the sports that person likes

  1. List the people who practice at least one sport they do not like
  2. List pairs of people who practice at least one common sport
  3. List the people who like all the sports they practice
  4. List the people who practice all the sports they like
  5. List the people who practice all the sports John likes
  6. Who practices the largest number of sport (SQL only)?

In: Computer Science