Questions
Write a program to display privilege list of the roles and role list for privileges using...

Write a program to display privilege list of the roles and role list for privileges using many to many concept.

Problem Specification:

1. Prefill the data for roles and privileges.

2. Create a menu 1. Assign privilege 2. Cancel privilege 3. Search privilege by role 4. Search role by privilege.

3. Assign privilege -- To assign specific privilege for role.

4. Cancel Privilege -- To cancel specific privilege for role.

5. Search privilege by role -- To display all the privileges assigned for specific role.

6. Search role by privilege -- To display all the roles who are having specified privilege.

[Note :Strictly adhere to the object oriented specifications given as a part of the problem statement.Use the same class names, method names and attribute names.]

Create a class Role with the following private member variables/attributes.

  • private Integer id
  • private String name
  • private List<Privilege> privilegeList

1. Include a default constructor and 3-argument constructor with following argument order id, name , privilegeList

2. Include appropriate getters and setters.

Create a class Privilege with the following private member variables/attributes.

  • private Integer id
  • private String name
  • private List<Role> roleList

1. Include a default constructor and 3-argument constructor with following argument order id, name, roleList.

2. Include appropriate getters and setters.

Input and Output Format:

Refer sample input and output for formatting specifications.

All text in bold corresponds to input and the rest corresponds to output.

Sample Input and output :

Available roles:

Id Name

1 Manager

2 Shipper

3 Agent

4 Customer

Available privileges:

Id Name

1 Process Shipment

2 Create Shipment

3 Schedule Shipment

4 Cancel Shipment

1. Assign privilege

2. Cancel privilege

3. Search privilege by role

4. Search role by privilege

Enter the choice:

1

Enter the id for role:

1

Enter the id for privilege:

1

Do you want to process again?(yes/no)

yes

1. Assign privilege

2. Cancel privilege

3. Search privilege by role

4. Search role by privilege

Enter the choice:

1

Enter the id for role:

2

Enter the id for privilege:

1

Do you want to process again?(yes/no)

yes

1. Assign privilege

2. Cancel privilege

3. Search privilege by role

4. Search role by privilege

Enter the choice:

1

Enter the id for role:

3

Enter the id for privilege:

1

Do you want to process again?(yes/no)

yes

1. Assign privilege

2. Cancel privilege

3. Search privilege by role

4. Search role by privilege

Enter the choice:

1

Enter the id for role:

1

Enter the id for privilege:

2

Do you want to process again?(yes/no)

yes

1. Assign privilege

2. Cancel privilege

3. Search privilege by role

4. Search role by privilege

Enter the choice:

3

Enter the role name:

Manager

Process Shipment

Create Shipment

Do you want to process again?(yes/no)

yes

1. Assign privilege

2. Cancel privilege

3. Search privilege by role

4. Search role by privilege

Enter the choice:

4

Enter the privilege name:

Process Shipment

Manager

Shipper

Agent

Do you want to process again?(yes/no)

no

Don'ts:

1. Do not create packages for classes. Strictly adhere to the program structure given in the template code.   

2. Do not use Internet Explorer, highly recommended to use chrome browser to launch Tekstac platform.   

3. Do not create multiple classes inside a single file. Create separate file for each class.

3 classes--

Role.Java

Privilege.java

Main.Java

In: Computer Science

Earlier, we discussed “The List”---the list of services and products that are provided to all people...

Earlier, we discussed “The List”---the list of services and products that are provided to all people “free” at the point of sale by our government and our society, with the costs paid for by taxation---income taxes, sales taxes, property taxes, special taxes on alcohol, tobacco, gasoline, and other taxes…. 1. IN YOUR OPINION, which service or product on The List is the MOST important? Why? 2. Which service or product is the LEAST important? Why? 3. WHAT ONE SERVICE OR PRODUCT WOULD YOU ADD TO THE LIST? WHY? Why did you choose this service or product over all other possible choices? 4. Has the pandemic played a role in your answer to #3.? Why or why not?

In: Operations Management

We were asked this: Write a function that takes a list, and returns a list representing...

We were asked this:

Write a function that takes a list, and returns a list representing each word whose reverse is also in the list.

    def find_reversals(lst: List[str]) -> List[str]:

Each pair, such as 'abut', 'tuba', should be represented by the first element encountered. Don't report the same pairs twice.

Don't list palindromes.

I wrote this, which might not be optimal but passes the unit test!

def find_reversals(lst):
#Place to save to
found_reversals=[]
  
#Make each string lowercase
for i in range(len(lst)):
lst[i]=lst[i].lower()
  
#Check the lowercase list
for i in range(len(lst)):
for j in range(i+1,len(lst)):
#Reverse the string using indexing feature ::-1
reversed_string=lst[j][::-1]
#If the original word on the list == the reversed STRING and is not a palindrome
if(lst[i]==reversed_string and lst[i]!=lst[j]):
#If the string is not a duplicate item
if lst[i] not in found_reversals:
#See if a pair exists, then doesn't append in the list
if lst[i][::-1] not in found_reversals:
found_reversals.append(lst[i])
return found_reversals

The next problem wants us to recycle this...

Write a program that finds the reversals in Downey's word list.

List each pair only once, and only report the first word: List 'abut', but not 'tuba'

Do not list palindromes.

    def find_reversals_in_file(fileName: str) -> List[str]:

If you try to open a file that does not exist, you should catch a FileNotFoundError and print an error message in your own words¶

I have this written:

def find_reversals_in_file(filename):
try:
with open(filename) as f:
  
#Use splitlines to remove the \n from the end of lines
f = f.read().splitlines()
  
#Place to save all words from file to
file_words = []
  
#Split the lines of words into multiple words using ' ' as a delimiter
for x in f:
y = x.split()
for temp in y:
#Don't save any spaces
if len(temp.strip()) == 0:
continue
file_words.append(temp)
#If you can't open the file, return an error message.
except:
print("File does not exist.")
return [];
  
lst = find_reversals_in_file("words.txt")
result = find_reversals(lst)
print(f"There were {len(lst)} reversals")

for word in result:
print(word)

What am I missing here? Thank you in advance!

In: Computer Science

Briefly analyze the ratios, then Construct only a list of strengths and a list weaknesses. Gallery...

Briefly analyze the ratios, then Construct only a list of strengths and a list weaknesses.

Gallery of Dreams

Ratios

Ratio

Industry

2015

2014

2013

Current

2.50x

4.48x

4.06x

3.48x

Quick

0.80x

1.47x

1.18x

0.96x

Average collection period

11 days

16 days

15 days

9 days

Inventory turnover

2.30x

1.19x

1.24x

1.37x

Days payable outstanding

15 days

11 days

12 days

8 days

Fixed asset turnover

17.50x

9.74x

9.09x

8.85x

Total asset turnover

2.80x

1.50x

1.67x

1.82x

Debt ratio

62.00%

29.47%

34.04%

39.17%

Long term debt to

total capitalization

25.53%

14.09%

18.91%

22.33%

Times interest earned

9.93x

22.02x

19.00x

14.23x

Fixed charge coverage

8.69x

4.59x

4.47x

4.25x

Gross profit margin

31.10%

59.21%

59.39%

58.52%

Operating profit margin

8.06%

22.05%

21.86%

20.52%

Net profit margin

4.32%

11.89%

11.00%

10.97%

Return on investment

9.21%

17.97%

18.28%

18.35%

Return on equity

11.34%

24.14%

27.51%

29.88%

In: Accounting

5) List and explain the three modes of failure in metals. Include a list of all...

5) List and explain the three modes of failure in metals. Include a list of all the primary factors that determine the likelihood of failure in each mode

In: Civil Engineering

a. list 6 advantages for constructing a site plan ? b. list 6 disadvantages of not...

a. list 6 advantages for constructing a site plan ?
b. list 6 disadvantages of not constructing the site plan during the execution stage of the project?

In: Civil Engineering

1- List the things the system should be capable of doing. List the common facilities and...

1- List the things the system should be capable of doing. List the common facilities and services the framework should have and differentiating features of reservation systems separately. Also, list the possible constraints required for this framework. And I want to create a framework for a dental appointment.

2 - If you are asked to develop a dental appointment reservation system. What kind of slots and hooks do you need to develop? Give some descriptions of the specifications in an abstract way

In: Computer Science

Create a list of the top 10 software engineering requirements for the organization. This list should...

Create a list of the top 10 software engineering requirements for the organization. This list should address requirements that are common to most of the software development projects rather than specific project requirements. Include descriptions for each of the requirements that provide sufficient information to align the requirements with architectural strategies that were defined in the previous week. Add the subtitle: Architecture Strategy Evaluation Discuss the pros and cons of the architectural strategy.

In: Computer Science

Write a function which receives a list and returns a number. In the list, all numbers...

Write a function which receives a list and returns a number. In the list, all numbers have been repeated twice except one number that is repeated once. The function should return the number that is repeated once and return it.write a python program for this question. use main function.

In: Computer Science

Modify this linked list code to work with string. Insert the following items into the list...

Modify this linked list code to work with string. Insert the following items into the list and display the list. The items are: Pepsi, Coke, DrPepper, Sprite, Fanta. Insert them in that order. Display the list. Then delete DrPepper and redisplay the list. Then insert 7-UP and redisplay the list. Then append Water and redisplay the list. c++

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

#include <iostream>

using namespace std;

class ListNode {
public:
    int value;
    ListNode *next;

    ListNode(int nodeValue) {
      value = nodeValue;
      next = nullptr;
    }
};

class LinkedList {
private:
    ListNode *head;
public:
    LinkedList() { head = nullptr; }
    //~LinkedList(); // destructor

    void appendNode(int);
    void insertNode(int);
    void deleteNode(int);
    void displayList() const;

};

void LinkedList::appendNode(int newValue) {
ListNode *newNode;
ListNode *nodePtr;

newNode = new ListNode(newValue);

if (!head) {
     head = newNode;
}
else {
    nodePtr = head;
    while (nodePtr->next) {
        nodePtr = nodePtr->next;
    }
    nodePtr->next = newNode;
}
}

void LinkedList::displayList() const {
ListNode *nodePtr;
nodePtr = head;
while (nodePtr) {
    cout << nodePtr->value << " ";
    nodePtr = nodePtr->next;
}
}

void LinkedList::insertNode(int newValue) {
ListNode *newNode;
ListNode *nodePtr;
ListNode *previousNode = nullptr;

newNode = new ListNode(newValue);

if (!head) {
    head = newNode;
    newNode->next = nullptr;
}
else {

    nodePtr = head;
    /*cout << "nodeptr value when assigned as head: " <<
        nodePtr->value << endl;*/
    previousNode = nullptr;
    while (nodePtr != nullptr && nodePtr->value < newValue) {
        previousNode = nodePtr;
        nodePtr = nodePtr->next;
    }
    if (previousNode == nullptr) {
        head = newNode;
        newNode->next = nodePtr;
    }
    else {
        previousNode->next = newNode;
        newNode->next = nodePtr;
    }
}

}

void LinkedList::deleteNode(int searchValue) {
ListNode *nodePtr;
ListNode *previousNode;

if (!head) {
    return;
}
if (head->value == searchValue) {
    nodePtr = head->next;
    delete head;
    head = nodePtr;
}
else {
    nodePtr = head;
    while (nodePtr != nullptr && nodePtr->value != searchValue) {
        previousNode = nodePtr;
        nodePtr = nodePtr->next;
    }
    if (nodePtr) {
        previousNode->next = nodePtr->next;
        delete nodePtr;
    }
}
}

int main()
{
    LinkedList numbers;
    numbers.appendNode(1);
    numbers.appendNode(2);
    numbers.appendNode(4);
    numbers.displayList();
    cout << endl << endl;
    numbers.insertNode(3);
    numbers.displayList();
    cout << endl << endl;
    numbers.deleteNode(2);
    numbers.displayList();
    numbers.appendNode(6);
    cout << endl << endl;
    numbers.displayList();
    numbers.insertNode(5);
    cout << endl << endl;
    numbers.displayList();
    numbers.insertNode(2);
    cout << endl << endl;
    numbers.displayList();
    return 0;
}

In: Computer Science