HS2021 Database Design and Use
Week 2 - 2020 Tutorial
Date:
Instructions:
This exam has three (3) questions.
You are expected to select one question out of three (3) questions and to submit your answer via the blackboard assessment system.
Assessment Weight:
This test accounts for five per cent (5%) of total marks.
Total marks for the paper
5 marks
Question A: Create the Entity-Relationship Diagram and the Relational Schema for the following scenario
BestBank prides itself on having up-to-date information on the current account balance of its customers. To do this, BestBank relies on a company-wide information system. Customers are the heart of the BestBank information system. Customers are characterized by their customer number (unique), first name, last name, address, and date of birth. A customer can have multiple accounts into the BestBank information system. Accounts are characterized by their account number (unique), account type (i.e. everyday, savings, business) and amount and they must be assigned to a specific customer. To keep track of their spending habits BestBank customers can review all the transactions executed using their accounts. A transaction must be associated with a specific account, and each account can have multiple transactions. Finally, each transaction is characterized by a transaction id (unique), a transaction type (i.e. withdraw or deposit) and the transaction amount.
Question B: Create the Entity-Relationship Diagram and the Relational Schema for the following scenario
BestDelivery prides itself on having up-to-date information on the status of shipped item. To do this, BestDelivery relies on a company-wide information system. Items are the heart of the BestDelivery information system. Items are characterized by their item code (unique), delivery status, and destination address. Items are assigned to couriers who are in charge of their delivery. A courier delivers several items in a day. Couriers are characterized by their employee number (unique), first name, last name, and driving license.
Question C: Create the Entity-Relationship Diagram and the Relational Schema for the following scenario
BestFreelancer prides itself on having the most efficient platform through which is possible to find freelancers for any type of work. Freelancers can freely register on the platform and provide information about all the projects they have completed. To do this, BestFreelancer relies on a company-wide information system. Freelancers are the heart of the BestFreelancer information system. Freelancers are characterized by their profile code (unique), first name, last name, and email. Freelancers can list, within their profile, as many projects as they want. Projects are characterized by their project code (unique), start date, end date, project title, and project description.
Student Name: _____________________________________________________
Student ID: ____________________________
HS2021 Databa ...
prog-03.pdf
CSci 430: Programming Project #3
Deadlock Detection
Spring 2019
Dates:
Assigned: Monday February 25, 2019
Due: Wednesday March 13, 2019 (before Midnight)
Objectives:
ˆ Learn more about Deadlock algorithms.
ˆ Better understand how we can algorithmically detect deadlocks on a
system.
ˆ Use C/C++ to implement vector and matrix data structures, get prac-
tice in creating and using such data structures in C/C++.
Description:
Our textbook gives the following algorithm (pg. 276) for algorithmically
detecting if a deadlock is present or not in a system. It requires that the
system keep an Allocation matrix A, listing which resources are currently
allocated to which processes, and the available vector V, which gives the
amount of each resource currently available in the system. In addition, the
deadlock detection algorithm requies a request matrix Q, which keeps track
of the amount of each resource each process is currently requesting from the
system. The algorithm is:
1. Mark each process that has a row in the Allocation matrix of all zeros.
2. Initialize a temporary vector W to equal the Available vector A.
1
3. Find an index i such that process i is currently unmarked and the i th
row of Q is less than or equal toW. That is, Qik ≤ Wk, for 1 ≤ k ≤ m.
If no such row is found, terminate the algorithm.
4. If such a row is found, mark process i and add the corresponding row of
the allocation matrix toW. That is, setWk = Wk+Aik, for 1 ≤ k ≤ m.
Return to step 3.
A deadlock exists if and only if there are unmarked processes at the end
of the algorithm. Each unmarked process is deadlocked.
In this assignment we will implement the deadlock detection algorithm.
Your program will be given a �le that describes the A allocation matrix
and the Q request matrix, representing the current state of all allocations
and requested allocations in the system. Your program will implement the
deadlock detection algorithm described above. The result of your program
will be one of 2 outputs:
1. If no deadlock exists, the program will display No Deadlock on stan-
dard output.
2. If a deadlock does exist, the program will display Deadlock: P0, P1,
P2 on standard output, where P0, P1, P2 are the processes that the
algorithm determined to be deadlocked in the system.
State simulation �le formats
I have provided a p3-start.cpp template that can open up and read in the
process/resource state simulation �les used for this assignment. Here we
discuss a bit more the format of these �le. I have provided 2 or 3 exam-
ple simulations, with expected correct answers, for you to use to test your
implementations with.
The input �les needed for this assignment need to contain the information
found in theV available vector and theA allocation andQ request matrices.
In the following I use r as the number of resources and p as the number of
processes. Thus the general format of the input �le is:
r p
V1 V2 V3 ... Vr
A11 A12 ... A1r
...
Ap1 Ap2 ... Apr
2 ...
Esoft Metro Campus - Diploma in Web Engineering - (Module VII) Advanced PHP Concepts
(Template - Virtusa Corporate)
Contents:
Arrays
Indexed Arrays
Associative Arrays
Multidimensional arrays
Array Functions
PHP Objects and Classes
Creating an Object
Properties of Objects
Object Methods
Constructors
Inheritance
Method overriding
PHP Strings
printf() Function
String Functions
PHP Date/Time Functions
time() Function
getdate() Function
date() Function
mktime() function
checkdate() function
PHP Form Handling
Collecting form data with PHP
GET vs POST
Data validation against malicious code
Required fields validation
Validating an E-mail address
PHP mail() Function
Using header() function to redirect user
File Upload
Processing the uploaded file
Check if File Already Exists
Limit File Size
Limit File Type
Check if image file is an actual image
Uploading File
Cookies
Sessions
1-What are the opportunities and threats that could impact the orgAbbyWhyte974
1-What are the opportunities and threats that could impact the organization?
· Review all the general environmental categories. (PESTEL Analysis)
· Use Porter’s Five Forces model to analyze the company’s industry. Identify key competitors and analyze their strategies, core competencies, and competitive response.
2-What are the strengths or weaknesses of the organization?
· Review factors within the company that are critical to the strategy of the firm and classify them as strengths or weaknesses.
· Look for resources, capabilities, and core competencies.
· Use the "Four Criteria of Sustainable Competitive Advantage".
3-In the past, BMW has been able to successfully differentiate its products by engaging in value-adding value chain activities. What are some of these specific activities? How can BMW ensure its ability to continue with value-adding activities as it evolves into a maker of self-driving cars?
· Use the "Value Chain Analysis" to identify value-adding activities and functions.
· This question is not about Business or Corporate level strategies. focus on the functional level.
Programming Using Inheritance/Programming Using Inheritance/.vs/Programming Using Inheritance/v16/.suo
Programming Using Inheritance/Programming Using Inheritance/Account.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Programming_Using_Inheritance
{
class Account
{
//Declares the instance variable for the class
private decimal Balance;
private string AccountName;
private int AccountNumber;
//Creates the class constructor and initialize its instance variables using mutator methods
public Account(decimal Balance, string AccountName, int AccountNumber)
{
setAccontNumber(AccountNumber);
setAccountName(AccountName);
//For the balance initialization to make sure it is greater than zero
if (Balance >= 0)
setBalance(Balance);
else
setBalance(Balance);
}
//Creates mutator methods to set balance, accountNumber and accountName
public void setBalance(decimal Balance)
{
this.Balance = Balance;
}
public void setAccontNumber(int AccountNumber)
{
this.AccountNumber = AccountNumber;
}
public void setAccountName(string AccountName)
{
this.AccountName = AccountName;
}
//To get the instance field variables
public decimal getBalance()
{
return this.Balance;
}
public int getAccontNumber()
{
return this.AccountNumber;
}
public string getAccountName()
{
return this.AccountName;
}
//Creates a credit method to add current balance to passed balance ...
1-What are the opportunities and threats that could impact the orgMartineMccracken314
1-What are the opportunities and threats that could impact the organization?
· Review all the general environmental categories. (PESTEL Analysis)
· Use Porter’s Five Forces model to analyze the company’s industry. Identify key competitors and analyze their strategies, core competencies, and competitive response.
2-What are the strengths or weaknesses of the organization?
· Review factors within the company that are critical to the strategy of the firm and classify them as strengths or weaknesses.
· Look for resources, capabilities, and core competencies.
· Use the "Four Criteria of Sustainable Competitive Advantage".
3-In the past, BMW has been able to successfully differentiate its products by engaging in value-adding value chain activities. What are some of these specific activities? How can BMW ensure its ability to continue with value-adding activities as it evolves into a maker of self-driving cars?
· Use the "Value Chain Analysis" to identify value-adding activities and functions.
· This question is not about Business or Corporate level strategies. focus on the functional level.
Programming Using Inheritance/Programming Using Inheritance/.vs/Programming Using Inheritance/v16/.suo
Programming Using Inheritance/Programming Using Inheritance/Account.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Programming_Using_Inheritance
{
class Account
{
//Declares the instance variable for the class
private decimal Balance;
private string AccountName;
private int AccountNumber;
//Creates the class constructor and initialize its instance variables using mutator methods
public Account(decimal Balance, string AccountName, int AccountNumber)
{
setAccontNumber(AccountNumber);
setAccountName(AccountName);
//For the balance initialization to make sure it is greater than zero
if (Balance >= 0)
setBalance(Balance);
else
setBalance(Balance);
}
//Creates mutator methods to set balance, accountNumber and accountName
public void setBalance(decimal Balance)
{
this.Balance = Balance;
}
public void setAccontNumber(int AccountNumber)
{
this.AccountNumber = AccountNumber;
}
public void setAccountName(string AccountName)
{
this.AccountName = AccountName;
}
//To get the instance field variables
public decimal getBalance()
{
return this.Balance;
}
public int getAccontNumber()
{
return this.AccountNumber;
}
public string getAccountName()
{
return this.AccountName;
}
//Creates a credit method to add current balance to passed balance ...
prog-03.pdf
CSci 430: Programming Project #3
Deadlock Detection
Spring 2019
Dates:
Assigned: Monday February 25, 2019
Due: Wednesday March 13, 2019 (before Midnight)
Objectives:
ˆ Learn more about Deadlock algorithms.
ˆ Better understand how we can algorithmically detect deadlocks on a
system.
ˆ Use C/C++ to implement vector and matrix data structures, get prac-
tice in creating and using such data structures in C/C++.
Description:
Our textbook gives the following algorithm (pg. 276) for algorithmically
detecting if a deadlock is present or not in a system. It requires that the
system keep an Allocation matrix A, listing which resources are currently
allocated to which processes, and the available vector V, which gives the
amount of each resource currently available in the system. In addition, the
deadlock detection algorithm requies a request matrix Q, which keeps track
of the amount of each resource each process is currently requesting from the
system. The algorithm is:
1. Mark each process that has a row in the Allocation matrix of all zeros.
2. Initialize a temporary vector W to equal the Available vector A.
1
3. Find an index i such that process i is currently unmarked and the i th
row of Q is less than or equal toW. That is, Qik ≤ Wk, for 1 ≤ k ≤ m.
If no such row is found, terminate the algorithm.
4. If such a row is found, mark process i and add the corresponding row of
the allocation matrix toW. That is, setWk = Wk+Aik, for 1 ≤ k ≤ m.
Return to step 3.
A deadlock exists if and only if there are unmarked processes at the end
of the algorithm. Each unmarked process is deadlocked.
In this assignment we will implement the deadlock detection algorithm.
Your program will be given a �le that describes the A allocation matrix
and the Q request matrix, representing the current state of all allocations
and requested allocations in the system. Your program will implement the
deadlock detection algorithm described above. The result of your program
will be one of 2 outputs:
1. If no deadlock exists, the program will display No Deadlock on stan-
dard output.
2. If a deadlock does exist, the program will display Deadlock: P0, P1,
P2 on standard output, where P0, P1, P2 are the processes that the
algorithm determined to be deadlocked in the system.
State simulation �le formats
I have provided a p3-start.cpp template that can open up and read in the
process/resource state simulation �les used for this assignment. Here we
discuss a bit more the format of these �le. I have provided 2 or 3 exam-
ple simulations, with expected correct answers, for you to use to test your
implementations with.
The input �les needed for this assignment need to contain the information
found in theV available vector and theA allocation andQ request matrices.
In the following I use r as the number of resources and p as the number of
processes. Thus the general format of the input �le is:
r p
V1 V2 V3 ... Vr
A11 A12 ... A1r
...
Ap1 Ap2 ... Apr
2 ...
Esoft Metro Campus - Diploma in Web Engineering - (Module VII) Advanced PHP Concepts
(Template - Virtusa Corporate)
Contents:
Arrays
Indexed Arrays
Associative Arrays
Multidimensional arrays
Array Functions
PHP Objects and Classes
Creating an Object
Properties of Objects
Object Methods
Constructors
Inheritance
Method overriding
PHP Strings
printf() Function
String Functions
PHP Date/Time Functions
time() Function
getdate() Function
date() Function
mktime() function
checkdate() function
PHP Form Handling
Collecting form data with PHP
GET vs POST
Data validation against malicious code
Required fields validation
Validating an E-mail address
PHP mail() Function
Using header() function to redirect user
File Upload
Processing the uploaded file
Check if File Already Exists
Limit File Size
Limit File Type
Check if image file is an actual image
Uploading File
Cookies
Sessions
1-What are the opportunities and threats that could impact the orgAbbyWhyte974
1-What are the opportunities and threats that could impact the organization?
· Review all the general environmental categories. (PESTEL Analysis)
· Use Porter’s Five Forces model to analyze the company’s industry. Identify key competitors and analyze their strategies, core competencies, and competitive response.
2-What are the strengths or weaknesses of the organization?
· Review factors within the company that are critical to the strategy of the firm and classify them as strengths or weaknesses.
· Look for resources, capabilities, and core competencies.
· Use the "Four Criteria of Sustainable Competitive Advantage".
3-In the past, BMW has been able to successfully differentiate its products by engaging in value-adding value chain activities. What are some of these specific activities? How can BMW ensure its ability to continue with value-adding activities as it evolves into a maker of self-driving cars?
· Use the "Value Chain Analysis" to identify value-adding activities and functions.
· This question is not about Business or Corporate level strategies. focus on the functional level.
Programming Using Inheritance/Programming Using Inheritance/.vs/Programming Using Inheritance/v16/.suo
Programming Using Inheritance/Programming Using Inheritance/Account.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Programming_Using_Inheritance
{
class Account
{
//Declares the instance variable for the class
private decimal Balance;
private string AccountName;
private int AccountNumber;
//Creates the class constructor and initialize its instance variables using mutator methods
public Account(decimal Balance, string AccountName, int AccountNumber)
{
setAccontNumber(AccountNumber);
setAccountName(AccountName);
//For the balance initialization to make sure it is greater than zero
if (Balance >= 0)
setBalance(Balance);
else
setBalance(Balance);
}
//Creates mutator methods to set balance, accountNumber and accountName
public void setBalance(decimal Balance)
{
this.Balance = Balance;
}
public void setAccontNumber(int AccountNumber)
{
this.AccountNumber = AccountNumber;
}
public void setAccountName(string AccountName)
{
this.AccountName = AccountName;
}
//To get the instance field variables
public decimal getBalance()
{
return this.Balance;
}
public int getAccontNumber()
{
return this.AccountNumber;
}
public string getAccountName()
{
return this.AccountName;
}
//Creates a credit method to add current balance to passed balance ...
1-What are the opportunities and threats that could impact the orgMartineMccracken314
1-What are the opportunities and threats that could impact the organization?
· Review all the general environmental categories. (PESTEL Analysis)
· Use Porter’s Five Forces model to analyze the company’s industry. Identify key competitors and analyze their strategies, core competencies, and competitive response.
2-What are the strengths or weaknesses of the organization?
· Review factors within the company that are critical to the strategy of the firm and classify them as strengths or weaknesses.
· Look for resources, capabilities, and core competencies.
· Use the "Four Criteria of Sustainable Competitive Advantage".
3-In the past, BMW has been able to successfully differentiate its products by engaging in value-adding value chain activities. What are some of these specific activities? How can BMW ensure its ability to continue with value-adding activities as it evolves into a maker of self-driving cars?
· Use the "Value Chain Analysis" to identify value-adding activities and functions.
· This question is not about Business or Corporate level strategies. focus on the functional level.
Programming Using Inheritance/Programming Using Inheritance/.vs/Programming Using Inheritance/v16/.suo
Programming Using Inheritance/Programming Using Inheritance/Account.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Programming_Using_Inheritance
{
class Account
{
//Declares the instance variable for the class
private decimal Balance;
private string AccountName;
private int AccountNumber;
//Creates the class constructor and initialize its instance variables using mutator methods
public Account(decimal Balance, string AccountName, int AccountNumber)
{
setAccontNumber(AccountNumber);
setAccountName(AccountName);
//For the balance initialization to make sure it is greater than zero
if (Balance >= 0)
setBalance(Balance);
else
setBalance(Balance);
}
//Creates mutator methods to set balance, accountNumber and accountName
public void setBalance(decimal Balance)
{
this.Balance = Balance;
}
public void setAccontNumber(int AccountNumber)
{
this.AccountNumber = AccountNumber;
}
public void setAccountName(string AccountName)
{
this.AccountName = AccountName;
}
//To get the instance field variables
public decimal getBalance()
{
return this.Balance;
}
public int getAccontNumber()
{
return this.AccountNumber;
}
public string getAccountName()
{
return this.AccountName;
}
//Creates a credit method to add current balance to passed balance ...
this the a web technology that is used in many web applications . xmlrpc is mainly used to transport request for input parameter and output parameters .
Deep Dive into Salesforce Integrations: Mapping EnginesCRMScienceKirk
Presented by Ami Assayag of CRM Science at a Salesforce World Tour event. This deck covers the importance of a mapping engine in an integration solution and the role it plays in translating and connecting data from end to end.
Included within is an architecture overview, support infrastructure, review of different mapping types, as well as code samples.
MSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docxgilpinleeanna
MSCD650 Final Exam feedback Form
MSCD650 Final Exam Grading Form
(Instructions follow the form)
Coding
55 Percent
Points Earned
Comments:
Trigger Code:
· Code meets requirements
· Code compiles cleanly
/15
Pre-Calculation Procedure Code
· Code meets requirements
· Code compiles cleanly
/15
PL/SQL Block Code
· Code meets requirements
· Code compiles cleanly
/15
Function Code
· Code meets requirements
· Code compiles cleanly
/10
/55
Unit Testing
35 Percent
Points Earned
Comments:
Unit Test for Trigger Code:
· All conditions are thoroughly tested
· The code runs successfully
· All data to prove test worked is displayed
/10
Unit Test for Procedure Code:
· All conditions are thoroughly tested
· The code runs successfully
· All data to prove test worked is displayed
· The tester can easily follow the path of the execution.
/10
.
Unit Test for PL/SQL Block Code:
· All conditions are thoroughly tested
· The code runs successfully
· All data to prove test worked is displayed
· The tester can easily follow the path of the execution.
/10
Unit Test for View/Function Code:
· All conditions are thoroughly tested
· The code runs successfully
· All data to prove test worked is displayed
· The tester can easily follow the path of the execution.
/5
/35
Documentation
10 Percent
Points Earned
Comments:
Presentation:
· The document is easy to read.
· The document is Professional in appearance
· It is easy for the reader to find what they are looking for.
/5
Documentation:
· Code is documented so that anyone who picks it up knows what it is doing.
/5
/10
Total 100
Percent
Points Earned
Comments:
Case Study
Overview of assignment
As a new ABC Consultant assigned to the XYZ Company, you have been asked to enhance the current system to include payroll processing. Although the current employee table has monthly salary and commission columns, it does not provide any means for storing employee deductions. You will add the tables necessary to store employee deductions. Next you will create a payroll pre-calculation program that will calculate the net pay for all the employees via a batch process (a stored procedure in a package, which will call other stored procedures within the package). Although this is not a complete payroll system, the unit test results must be accurate.
Next you will create two PL/SQL blocks for inserting and deleting rows from the employee deduction table. These PL/SQL blocks will be passed information from host or bind variables and a third PL/SQL block which will assign the variables defined in SQL*Plus (e.g. employee number, dollar amount and deduction name). Since the XYZ Company wants to track changes to the employee and employee deduction tables, you will create two database triggers that will update audit tables when rows are changed or deleted.
The XYZ Company also requires a view that will display specific employee information, plus the number of deductions for an employe ...
Oracle Analytical Function Include First Value, Last Value, Lead, Lag, Nth Value with Unbounded and Difference between Rank and Dense Rank . Contain Rollup, Cube and Grouping and Different type of Window Function and Analytical Window frame
Data Flow Diagram (DFD) TipsProcesses VerbsDataflows N.docxwhittemorelucilla
Data Flow Diagram (DFD) Tips
Processes: Verbs
Dataflows: Nouns
Data Stores: Nouns
External Entities: Nouns
1) Process’s input & output are different
2) Each data store should have at least
one data flow in and one data flow out
3) Each process should have at least one
data flow in and one data flow out
4) All inputs and outputs should be
labeled
5) Processes should have an identifier
(Ex., 1.0, 2.0, etc.)
Process Process
Process-to-Process
Process Process
Process-to-Process
Process-to-External Entity
Process
External
Entity
Process-to-External Entity
Process
External
Entity
Data S tore
Process-to-Data Store
Process Data S tore
Process-to-Data Store
Process
External Entity-to-External Entity
External
Entity
External
Entity
External Entity-to-External Entity
External
Entity
External
Entity
Data S tore
Data Store-to-Data Store
Data S toreData S tore
Data Store-to-Data Store
Data S tore
External Entity-to-Data StoreExternal Entity-to-Data Store
External
Entity
Data S tore
External
Entity
Data S tore
External
Entity
Data S tore
External Entity-to-Data Store
External
Entity
Data S toreProcess Process
Process-to-Process
Process-to-External Entity
Process
External
Entity
Data S tore
Process-to-Data Store
Process
External Entity-to-External Entity
External
Entity
External
Entity
Data S tore
Data Store-to-Data Store
Data S tore
External Entity-to-Data Store
External
Entity
Data S tore
DFD_Rules.vsdxTop Process
Stage 2: Requirements Specification
Before you begin this assignment, be sure you have read the Case Study and all assignments for this class, especially Stage 4: Final System Report. The feedback you received on your Stage 1 assignment should be reviewed and used as you proceed with Stage 2.
Purpose of this Assignment
This assignment gives you the opportunity to specify clear and concise requirements, including the use of data and process models, for a system that enables a productive change in a way the business is conducted. This assignment specifically addresses the following course outcomes to enable you to:
· apply a systematic approach to translate requirements into an executable systems design
· effectively communicate with stakeholders to determine, manage, and document business requirements throughout the SDLC
· perform modeling to assist with analysis and decision making
Assignment
The results of your systems analysis and design work in this class will be documented in a Final System Report. The purpose of the Report is to inform management of your system proposal and gain approval to proceed with the project. The Report will be developed and submitted in stages, which will be compiled at the end of class into the Final System Report. Review the outline of the Final System Report in the Stage 4 Assignment description. Note that it contains the analysis of the problem(s) and requirements, and proposes what kind of a system solution is neede.
SECTION D2)Display the item number and total cost for each order l.docxkenjordan97598
SECTION D
2)Display the item number and total cost for each order line (total cost = no of items X item cost). Name the calculated column TOTAL COST.
Answer:
SELECT item_number, no_of_items * item_cost “TOTAL COST”
FROM ORDER_LINE
4)Display the order number and client number from the ORDER table. Output the result in the format. Client <clientno> ordered <orderno>
Answer:
SELECT ‘Client ‘+ clientno+’ordered ‘+ orderno AS result
FROM ORDER
6)Display the client name and order date for all orders using the traditional method.
Answer:
SELECT name, order_date
FROM
CLIENT c INNER JOIN ORDER o
ON (c.clientno = o.clientno);
7)Repeat query (7) but also display all clients who have never ordered anything.
Answer:
SELECT name, order_date
FROM
CLIENT c LEFT OUTER JOIN ORDER o
ON (c.clientno = o.clientno);
8) Display the client name and order date for all orders using the natural join keywords.
SELECT name, order_date
FROM
CLIENT NATURAL JOIN ORDER;
9) Display the client name and order date for all orders using the JOIN . . . USING method.
SELECT name, order_date
FROM CLIENT c JOIN ORDER o
USING (clientno);
10) Display the client number, order date and shipping date for all orders where the shipping date is between three and six months after the order date.
SELECT clientno, order_date, shipping_date
FROM
CLIENT c,
ORDER o,
ORDER_LINE ol
WHERE c.clientno = o.clientno
AND o.orderno = ol.orderno
AND shipping_date BETWEEN ADD_MONTHS(shipping_date,3) AND ADD_MONTHS(shipping_date,6);
16) Display the order number, order line number and the shipping date. If the shipping date is null, display the string <not shipped yet>.
SELECT orderno, order_line_number, NVL(shipping_date,’<not shipped yet>’)
FROM ORDER_LINE
18)Display the clientno and total value for all orders placed by that client. Output the result in the following format: Client <clientno> has placed orders to the value of <total value>
SELECT ‘Client ‘+clientno+’ has placed order to the value of ‘+ SUM(no_of_items*item_cost)
FROM ORDER_LINE
GROUP BY clientno
19) Display all clients whose name begins with the letter J or contains the letter M anywhere or contains E as the third letter.
SELECT *
FROM CLIENT
WHERE UPPER(name) LIKE ‘J%’
OR upper(name) LIKE ‘%M%’
OR
Upper(name) LIKE ‘??E%’
20)Using a set operator, display the client number of all clients who have never placed an order.
Answer:
SELECT clientno
FROM CLIENT
MINUS
SELECT clientno
FROM ORDER
21)Using a set operator, display the client number of all clients who have ever placed an order and whose name does not contain the string Sm.
SELECT clientno
FROM CLIENT
WHERE INSTR(name,’Sm’) = 0
INTERSECT
SELECT clientno
FROM
ORDER
23)Display the client name for all clients who have placed an order where any order line has more than 3 items. Do not use a table join anywhere in your query.
SELECT name
FROM CLIENT c,
ORDER o,
ORDER_LINE ol
WHERE c.clientno = o.clientno
AND o.orderno = ol.orderno
AND ol.no_of_items> 3
26)Display the earli.
Please the following is the currency class of perious one- class Curre.pdfadmin463580
Please the following is the currency class of perious one.
class Currency {
protected:
int whole;
int fraction;
virtual std::string get_name() = 0;
public:
Currency() {
whole = 0;
fraction = 0;
}
Currency(double value) {
if (value < 0)
throw "Invalid value";
whole = int(value);
fraction = std::round(100 * (value - whole));
}
Currency(const Currency& curr) {
whole = curr.whole;
fraction = curr.fraction;
}
/* This algorithm gets the whole part or fractional part of the currency
Pre: whole, fraction - integer numbers
Post:
Return: whole or fraction
*/
int get_whole() { return whole; }
int get_fraction() { return fraction; }
/* This algorithm adds an object to the same currency
Pre: object (same currency)
Post:
Return:
*/
void set_whole(int w) {
if (w >= 0)
whole = w;
}
void set_fraction(int f) {
if (f >= 0 && f < 100)
fraction = f;
}
/* This algorithm adds an object to the same currency
Pre: object (same currency)
Post:
Return:
*/
void add(const Currency* curr) {
whole += curr->whole;
fraction += curr->fraction;
if (fraction > 100) {
whole++;
fraction %= 100;
}
}
/* This algorithm subtracts an object to the same currency
Pre: object (same currency)
Post:
Return:
*/
void subtract(const Currency* curr) {
if (!isGreater(*curr))
throw "Invalid Subtraction";
whole -= curr->whole;
if (fraction < curr->fraction) {
fraction = fraction + 100 - curr->fraction;
whole--;
}
else {
fraction -= curr->fraction;
}
}
/* This algorithm compares the an object of the same currency for equality or inequality
Pre: object (same currency)
Post:
Return: whole/fraction
*/
bool isEqual(const Currency& curr) {
return curr.whole == whole && curr.fraction == fraction;
}
/* This algorithm compares the an object of the same currency to determine which is greater or
smaller
Pre: object (same currency)
Post:
Return: true/false
*/
bool isGreater(const Currency& curr) {
if (whole < curr.whole)
return false;
if (whole == curr.whole && fraction < curr.fraction)
return false;
return true;
}
/* This algorithm prints the name and value of the currency object
Pre: value of whole, fraction, and the name
Post: whole, fraction, get_name()
Return:
*/
void print() {
std::cout << whole << "." << fraction << " " << get_name() << std::endl;
}
};
class Krone : public Currency {
protected:
/*
This algorithm gets the name for the Currency.
Pre: name - declared as string and initialized as Krone
Post:
Return: name
*/
std::string name = "Krone";
std::string get_name() {
return name;
}
public:
Krone() : Currency() { }
Krone(double value) : Currency(value) { }
Krone(Krone& curr) : Currency(curr) { }
};
class Soum : public Currency {
protected:
/* This algorithm gets the name for the Currency.
Pre: name - declared as string and initialized as Soum
Post:
Return: name
*/
std::string name = "Soum";
std::string get_name() {
return name;
}
public:
Soum() : Currency() { }
Soum(double value) : Currency(value) { }
Soum(Krone& curr) : Currency(curr) { }
};
A LinkNode structure or class which will have two attrib.
This is the assignmentOBJECTIVESAfter finishing this lab, stude.pdfbharatchawla141
Sustainability: Sustainability is an important consideration for any nation. Discuss what countries
do to sustain their economy and help its people.
Solution
Sustainable development is a crucial subject to affix downward since it beset so many
contrasting stuff.Due to the complication of this accountable it is big to attention at the big in a
holistic action that approaches affair intelligently.The authority for sustainab;e development at
the civil level that is for the difficult mosaic is a mixture of economic,political that precondition
be bring combine under a particular set of circumstances.Any changes in the people life style
makes a economic atmosphere and candid of championship and business will make a country
effort easy..
Christian Schussele Men of ProgressOil on canvas, 1862Coope.docxtroutmanboris
Christian Schussele Men of Progress
Oil on canvas, 1862
Cooper Union, New York, New York
Transfer from the National Gallery of Art; gift of Andrew W. Mellon, 1942
NPG.65.60
Edward Sorel, “People of Progress” 1999, Cooper Union, New York, New York
Syllabus
The clerks of the Department of State of the United States may be called upon to give evidence of transactions in the Department which are not of a confidential character.
The Secretary of State cannot be called upon as a witness to state transactions of a confidential nature which may have occurred in his Department. But he may be called upon to give testimony of circumstances which were not of that character.
Clerks in the Department of State were directed to be sworn, subject to objections to questions upon confidential matters.
Some point of time must be taken when the power of the Executive over an officer, not removable at his will, must cease. That point of time must be when the constitutional power of appointment has been exercised. And the power has been exercised when the last act required from the person possessing the power has been performed. This last act is the signature of the commission.
If the act of livery be necessary to give validity to the commission of an officer, it has been delivered when executed, and given to the Secretary of State for the purpose of being sealed, recorded, and transmitted to the party.
In cases of commissions to public officers, the law orders the Secretary of State to record them. When, therefore, they are signed and sealed, the order for their being recorded is given, and, whether inserted inserted into the book or not, they are recorded.
When the heads of the departments of the Government are the political or confidential officers of the Executive, merely to execute the will of the President, or rather to act in cases in which the Executive possesses a constitutional or legal discretion, nothing can be more perfectly clear than that their acts are only politically examinable. But where a specific duty is assigned by law, and individual rights depend upon the performance of that duty, it seems equally clear that the individual who considers himself injured has a right to resort to the laws of his country for a remedy.
The President of the United States, by signing the commission, appointed Mr. Marbury a justice of the peace for the County of Washington, in the District of Columbia, and the seal of the United States, affixed thereto by the Secretary of State, is conclusive testimony of the verity of the signature, and of the completion of the appointment; and the appointment conferred on him a legal right to the office for the space of five years. Having this legal right to the office, he has a consequent right to the commission, a refusal to deliver which is a plain violation of that right for which the laws of the country afford him a remedy.
To render a mandamus a proper remedy, the officer to whom it is directed must be one to who.
Christian EthicsChristian ethics deeply align with absolutism. E.docxtroutmanboris
Christian Ethics
Christian ethics deeply align with absolutism. Ethical absolutism claims that moral principles do exist. According to Christians, God created moral absolutes. These absolutes can be seen in God’s revelation. God’s special and general revelation reveal his moral truths. This does not mean that only Christians can understand moral truths. Because humans are made in God’s image, they can recognize moral truths even if they do not believe in God
[1]
. These absolutes were instated by God. Therefore, they apply to all of humanity. This worldview is in direct opposition to the idea of relativism. Christian ethics cannot be viewed through a relativistic point of view. According to relativism, there is no moral truths. There is no absolute distinction between right and wrong within this way of thinking. Right and wrong can be decided by individuals or groups of people. Cultures decide what is right for themselves and their way of life. Even individuals have the ability to decide their own personal moral code. This can seem somewhat reasonable at times. Some things that were considered moral or immoral in the past are viewed differently today. Even with this understanding, Christians deny the idea of relativism. Christians hold to the belief that moral truths come from God. Therefore, these truths do not change. God himself never changes; therefore, his moral truths remain the same. According to Christian ethics, mankind is expected to hold to the moral absolutes mandated by God himself. This understanding is not compatible with relativism. Relativism makes no place of a God. From a relativistic point of view, mankind decides their own morality. Right and wrong are not fixed. In Christian ethics, right and wrong are permanently decided by the God of the universe.
The subjective aspects of Christian ethics can look similar to relativism. The areas that are somewhat subjective in Christian aspects are referred to as the liberties of a Christian. There are some matters that are not said to be morally wrong in the Bible. Some see these issues to be wrong; therefore, they are. Others do not find certain issues to be morally wrong. These individuals are claiming their Christian liberty. One of these issues is drinking alcohol. Some Christians believe that ingesting any amount of alcohol is morally wrong. According to the idea of Christian liberty, it would be wrong for the individuals who hold to this belief to drink alcohol. Others do not have this conviction and are not doing wrong by consuming alcohol. On the surface, the idea of Christian liberty can seem to be related to relativism, but upon closer inspection these ideas are not closely related. Christian liberty is a Biblical concept that harmonize well with the overall message of the Bible. Relativism is nowhere found in the Bible. The Bible is clear that there are universal moral laws. These laws are placed upon humanity by God himself. There are some areas where the Bible remain.
More Related Content
Similar to HS2021 Database Design and UseWeek 2 - 2020 Tutorial
this the a web technology that is used in many web applications . xmlrpc is mainly used to transport request for input parameter and output parameters .
Deep Dive into Salesforce Integrations: Mapping EnginesCRMScienceKirk
Presented by Ami Assayag of CRM Science at a Salesforce World Tour event. This deck covers the importance of a mapping engine in an integration solution and the role it plays in translating and connecting data from end to end.
Included within is an architecture overview, support infrastructure, review of different mapping types, as well as code samples.
MSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docxgilpinleeanna
MSCD650 Final Exam feedback Form
MSCD650 Final Exam Grading Form
(Instructions follow the form)
Coding
55 Percent
Points Earned
Comments:
Trigger Code:
· Code meets requirements
· Code compiles cleanly
/15
Pre-Calculation Procedure Code
· Code meets requirements
· Code compiles cleanly
/15
PL/SQL Block Code
· Code meets requirements
· Code compiles cleanly
/15
Function Code
· Code meets requirements
· Code compiles cleanly
/10
/55
Unit Testing
35 Percent
Points Earned
Comments:
Unit Test for Trigger Code:
· All conditions are thoroughly tested
· The code runs successfully
· All data to prove test worked is displayed
/10
Unit Test for Procedure Code:
· All conditions are thoroughly tested
· The code runs successfully
· All data to prove test worked is displayed
· The tester can easily follow the path of the execution.
/10
.
Unit Test for PL/SQL Block Code:
· All conditions are thoroughly tested
· The code runs successfully
· All data to prove test worked is displayed
· The tester can easily follow the path of the execution.
/10
Unit Test for View/Function Code:
· All conditions are thoroughly tested
· The code runs successfully
· All data to prove test worked is displayed
· The tester can easily follow the path of the execution.
/5
/35
Documentation
10 Percent
Points Earned
Comments:
Presentation:
· The document is easy to read.
· The document is Professional in appearance
· It is easy for the reader to find what they are looking for.
/5
Documentation:
· Code is documented so that anyone who picks it up knows what it is doing.
/5
/10
Total 100
Percent
Points Earned
Comments:
Case Study
Overview of assignment
As a new ABC Consultant assigned to the XYZ Company, you have been asked to enhance the current system to include payroll processing. Although the current employee table has monthly salary and commission columns, it does not provide any means for storing employee deductions. You will add the tables necessary to store employee deductions. Next you will create a payroll pre-calculation program that will calculate the net pay for all the employees via a batch process (a stored procedure in a package, which will call other stored procedures within the package). Although this is not a complete payroll system, the unit test results must be accurate.
Next you will create two PL/SQL blocks for inserting and deleting rows from the employee deduction table. These PL/SQL blocks will be passed information from host or bind variables and a third PL/SQL block which will assign the variables defined in SQL*Plus (e.g. employee number, dollar amount and deduction name). Since the XYZ Company wants to track changes to the employee and employee deduction tables, you will create two database triggers that will update audit tables when rows are changed or deleted.
The XYZ Company also requires a view that will display specific employee information, plus the number of deductions for an employe ...
Oracle Analytical Function Include First Value, Last Value, Lead, Lag, Nth Value with Unbounded and Difference between Rank and Dense Rank . Contain Rollup, Cube and Grouping and Different type of Window Function and Analytical Window frame
Data Flow Diagram (DFD) TipsProcesses VerbsDataflows N.docxwhittemorelucilla
Data Flow Diagram (DFD) Tips
Processes: Verbs
Dataflows: Nouns
Data Stores: Nouns
External Entities: Nouns
1) Process’s input & output are different
2) Each data store should have at least
one data flow in and one data flow out
3) Each process should have at least one
data flow in and one data flow out
4) All inputs and outputs should be
labeled
5) Processes should have an identifier
(Ex., 1.0, 2.0, etc.)
Process Process
Process-to-Process
Process Process
Process-to-Process
Process-to-External Entity
Process
External
Entity
Process-to-External Entity
Process
External
Entity
Data S tore
Process-to-Data Store
Process Data S tore
Process-to-Data Store
Process
External Entity-to-External Entity
External
Entity
External
Entity
External Entity-to-External Entity
External
Entity
External
Entity
Data S tore
Data Store-to-Data Store
Data S toreData S tore
Data Store-to-Data Store
Data S tore
External Entity-to-Data StoreExternal Entity-to-Data Store
External
Entity
Data S tore
External
Entity
Data S tore
External
Entity
Data S tore
External Entity-to-Data Store
External
Entity
Data S toreProcess Process
Process-to-Process
Process-to-External Entity
Process
External
Entity
Data S tore
Process-to-Data Store
Process
External Entity-to-External Entity
External
Entity
External
Entity
Data S tore
Data Store-to-Data Store
Data S tore
External Entity-to-Data Store
External
Entity
Data S tore
DFD_Rules.vsdxTop Process
Stage 2: Requirements Specification
Before you begin this assignment, be sure you have read the Case Study and all assignments for this class, especially Stage 4: Final System Report. The feedback you received on your Stage 1 assignment should be reviewed and used as you proceed with Stage 2.
Purpose of this Assignment
This assignment gives you the opportunity to specify clear and concise requirements, including the use of data and process models, for a system that enables a productive change in a way the business is conducted. This assignment specifically addresses the following course outcomes to enable you to:
· apply a systematic approach to translate requirements into an executable systems design
· effectively communicate with stakeholders to determine, manage, and document business requirements throughout the SDLC
· perform modeling to assist with analysis and decision making
Assignment
The results of your systems analysis and design work in this class will be documented in a Final System Report. The purpose of the Report is to inform management of your system proposal and gain approval to proceed with the project. The Report will be developed and submitted in stages, which will be compiled at the end of class into the Final System Report. Review the outline of the Final System Report in the Stage 4 Assignment description. Note that it contains the analysis of the problem(s) and requirements, and proposes what kind of a system solution is neede.
SECTION D2)Display the item number and total cost for each order l.docxkenjordan97598
SECTION D
2)Display the item number and total cost for each order line (total cost = no of items X item cost). Name the calculated column TOTAL COST.
Answer:
SELECT item_number, no_of_items * item_cost “TOTAL COST”
FROM ORDER_LINE
4)Display the order number and client number from the ORDER table. Output the result in the format. Client <clientno> ordered <orderno>
Answer:
SELECT ‘Client ‘+ clientno+’ordered ‘+ orderno AS result
FROM ORDER
6)Display the client name and order date for all orders using the traditional method.
Answer:
SELECT name, order_date
FROM
CLIENT c INNER JOIN ORDER o
ON (c.clientno = o.clientno);
7)Repeat query (7) but also display all clients who have never ordered anything.
Answer:
SELECT name, order_date
FROM
CLIENT c LEFT OUTER JOIN ORDER o
ON (c.clientno = o.clientno);
8) Display the client name and order date for all orders using the natural join keywords.
SELECT name, order_date
FROM
CLIENT NATURAL JOIN ORDER;
9) Display the client name and order date for all orders using the JOIN . . . USING method.
SELECT name, order_date
FROM CLIENT c JOIN ORDER o
USING (clientno);
10) Display the client number, order date and shipping date for all orders where the shipping date is between three and six months after the order date.
SELECT clientno, order_date, shipping_date
FROM
CLIENT c,
ORDER o,
ORDER_LINE ol
WHERE c.clientno = o.clientno
AND o.orderno = ol.orderno
AND shipping_date BETWEEN ADD_MONTHS(shipping_date,3) AND ADD_MONTHS(shipping_date,6);
16) Display the order number, order line number and the shipping date. If the shipping date is null, display the string <not shipped yet>.
SELECT orderno, order_line_number, NVL(shipping_date,’<not shipped yet>’)
FROM ORDER_LINE
18)Display the clientno and total value for all orders placed by that client. Output the result in the following format: Client <clientno> has placed orders to the value of <total value>
SELECT ‘Client ‘+clientno+’ has placed order to the value of ‘+ SUM(no_of_items*item_cost)
FROM ORDER_LINE
GROUP BY clientno
19) Display all clients whose name begins with the letter J or contains the letter M anywhere or contains E as the third letter.
SELECT *
FROM CLIENT
WHERE UPPER(name) LIKE ‘J%’
OR upper(name) LIKE ‘%M%’
OR
Upper(name) LIKE ‘??E%’
20)Using a set operator, display the client number of all clients who have never placed an order.
Answer:
SELECT clientno
FROM CLIENT
MINUS
SELECT clientno
FROM ORDER
21)Using a set operator, display the client number of all clients who have ever placed an order and whose name does not contain the string Sm.
SELECT clientno
FROM CLIENT
WHERE INSTR(name,’Sm’) = 0
INTERSECT
SELECT clientno
FROM
ORDER
23)Display the client name for all clients who have placed an order where any order line has more than 3 items. Do not use a table join anywhere in your query.
SELECT name
FROM CLIENT c,
ORDER o,
ORDER_LINE ol
WHERE c.clientno = o.clientno
AND o.orderno = ol.orderno
AND ol.no_of_items> 3
26)Display the earli.
Please the following is the currency class of perious one- class Curre.pdfadmin463580
Please the following is the currency class of perious one.
class Currency {
protected:
int whole;
int fraction;
virtual std::string get_name() = 0;
public:
Currency() {
whole = 0;
fraction = 0;
}
Currency(double value) {
if (value < 0)
throw "Invalid value";
whole = int(value);
fraction = std::round(100 * (value - whole));
}
Currency(const Currency& curr) {
whole = curr.whole;
fraction = curr.fraction;
}
/* This algorithm gets the whole part or fractional part of the currency
Pre: whole, fraction - integer numbers
Post:
Return: whole or fraction
*/
int get_whole() { return whole; }
int get_fraction() { return fraction; }
/* This algorithm adds an object to the same currency
Pre: object (same currency)
Post:
Return:
*/
void set_whole(int w) {
if (w >= 0)
whole = w;
}
void set_fraction(int f) {
if (f >= 0 && f < 100)
fraction = f;
}
/* This algorithm adds an object to the same currency
Pre: object (same currency)
Post:
Return:
*/
void add(const Currency* curr) {
whole += curr->whole;
fraction += curr->fraction;
if (fraction > 100) {
whole++;
fraction %= 100;
}
}
/* This algorithm subtracts an object to the same currency
Pre: object (same currency)
Post:
Return:
*/
void subtract(const Currency* curr) {
if (!isGreater(*curr))
throw "Invalid Subtraction";
whole -= curr->whole;
if (fraction < curr->fraction) {
fraction = fraction + 100 - curr->fraction;
whole--;
}
else {
fraction -= curr->fraction;
}
}
/* This algorithm compares the an object of the same currency for equality or inequality
Pre: object (same currency)
Post:
Return: whole/fraction
*/
bool isEqual(const Currency& curr) {
return curr.whole == whole && curr.fraction == fraction;
}
/* This algorithm compares the an object of the same currency to determine which is greater or
smaller
Pre: object (same currency)
Post:
Return: true/false
*/
bool isGreater(const Currency& curr) {
if (whole < curr.whole)
return false;
if (whole == curr.whole && fraction < curr.fraction)
return false;
return true;
}
/* This algorithm prints the name and value of the currency object
Pre: value of whole, fraction, and the name
Post: whole, fraction, get_name()
Return:
*/
void print() {
std::cout << whole << "." << fraction << " " << get_name() << std::endl;
}
};
class Krone : public Currency {
protected:
/*
This algorithm gets the name for the Currency.
Pre: name - declared as string and initialized as Krone
Post:
Return: name
*/
std::string name = "Krone";
std::string get_name() {
return name;
}
public:
Krone() : Currency() { }
Krone(double value) : Currency(value) { }
Krone(Krone& curr) : Currency(curr) { }
};
class Soum : public Currency {
protected:
/* This algorithm gets the name for the Currency.
Pre: name - declared as string and initialized as Soum
Post:
Return: name
*/
std::string name = "Soum";
std::string get_name() {
return name;
}
public:
Soum() : Currency() { }
Soum(double value) : Currency(value) { }
Soum(Krone& curr) : Currency(curr) { }
};
A LinkNode structure or class which will have two attrib.
This is the assignmentOBJECTIVESAfter finishing this lab, stude.pdfbharatchawla141
Sustainability: Sustainability is an important consideration for any nation. Discuss what countries
do to sustain their economy and help its people.
Solution
Sustainable development is a crucial subject to affix downward since it beset so many
contrasting stuff.Due to the complication of this accountable it is big to attention at the big in a
holistic action that approaches affair intelligently.The authority for sustainab;e development at
the civil level that is for the difficult mosaic is a mixture of economic,political that precondition
be bring combine under a particular set of circumstances.Any changes in the people life style
makes a economic atmosphere and candid of championship and business will make a country
effort easy..
Similar to HS2021 Database Design and UseWeek 2 - 2020 Tutorial (20)
Christian Schussele Men of ProgressOil on canvas, 1862Coope.docxtroutmanboris
Christian Schussele Men of Progress
Oil on canvas, 1862
Cooper Union, New York, New York
Transfer from the National Gallery of Art; gift of Andrew W. Mellon, 1942
NPG.65.60
Edward Sorel, “People of Progress” 1999, Cooper Union, New York, New York
Syllabus
The clerks of the Department of State of the United States may be called upon to give evidence of transactions in the Department which are not of a confidential character.
The Secretary of State cannot be called upon as a witness to state transactions of a confidential nature which may have occurred in his Department. But he may be called upon to give testimony of circumstances which were not of that character.
Clerks in the Department of State were directed to be sworn, subject to objections to questions upon confidential matters.
Some point of time must be taken when the power of the Executive over an officer, not removable at his will, must cease. That point of time must be when the constitutional power of appointment has been exercised. And the power has been exercised when the last act required from the person possessing the power has been performed. This last act is the signature of the commission.
If the act of livery be necessary to give validity to the commission of an officer, it has been delivered when executed, and given to the Secretary of State for the purpose of being sealed, recorded, and transmitted to the party.
In cases of commissions to public officers, the law orders the Secretary of State to record them. When, therefore, they are signed and sealed, the order for their being recorded is given, and, whether inserted inserted into the book or not, they are recorded.
When the heads of the departments of the Government are the political or confidential officers of the Executive, merely to execute the will of the President, or rather to act in cases in which the Executive possesses a constitutional or legal discretion, nothing can be more perfectly clear than that their acts are only politically examinable. But where a specific duty is assigned by law, and individual rights depend upon the performance of that duty, it seems equally clear that the individual who considers himself injured has a right to resort to the laws of his country for a remedy.
The President of the United States, by signing the commission, appointed Mr. Marbury a justice of the peace for the County of Washington, in the District of Columbia, and the seal of the United States, affixed thereto by the Secretary of State, is conclusive testimony of the verity of the signature, and of the completion of the appointment; and the appointment conferred on him a legal right to the office for the space of five years. Having this legal right to the office, he has a consequent right to the commission, a refusal to deliver which is a plain violation of that right for which the laws of the country afford him a remedy.
To render a mandamus a proper remedy, the officer to whom it is directed must be one to who.
Christian EthicsChristian ethics deeply align with absolutism. E.docxtroutmanboris
Christian Ethics
Christian ethics deeply align with absolutism. Ethical absolutism claims that moral principles do exist. According to Christians, God created moral absolutes. These absolutes can be seen in God’s revelation. God’s special and general revelation reveal his moral truths. This does not mean that only Christians can understand moral truths. Because humans are made in God’s image, they can recognize moral truths even if they do not believe in God
[1]
. These absolutes were instated by God. Therefore, they apply to all of humanity. This worldview is in direct opposition to the idea of relativism. Christian ethics cannot be viewed through a relativistic point of view. According to relativism, there is no moral truths. There is no absolute distinction between right and wrong within this way of thinking. Right and wrong can be decided by individuals or groups of people. Cultures decide what is right for themselves and their way of life. Even individuals have the ability to decide their own personal moral code. This can seem somewhat reasonable at times. Some things that were considered moral or immoral in the past are viewed differently today. Even with this understanding, Christians deny the idea of relativism. Christians hold to the belief that moral truths come from God. Therefore, these truths do not change. God himself never changes; therefore, his moral truths remain the same. According to Christian ethics, mankind is expected to hold to the moral absolutes mandated by God himself. This understanding is not compatible with relativism. Relativism makes no place of a God. From a relativistic point of view, mankind decides their own morality. Right and wrong are not fixed. In Christian ethics, right and wrong are permanently decided by the God of the universe.
The subjective aspects of Christian ethics can look similar to relativism. The areas that are somewhat subjective in Christian aspects are referred to as the liberties of a Christian. There are some matters that are not said to be morally wrong in the Bible. Some see these issues to be wrong; therefore, they are. Others do not find certain issues to be morally wrong. These individuals are claiming their Christian liberty. One of these issues is drinking alcohol. Some Christians believe that ingesting any amount of alcohol is morally wrong. According to the idea of Christian liberty, it would be wrong for the individuals who hold to this belief to drink alcohol. Others do not have this conviction and are not doing wrong by consuming alcohol. On the surface, the idea of Christian liberty can seem to be related to relativism, but upon closer inspection these ideas are not closely related. Christian liberty is a Biblical concept that harmonize well with the overall message of the Bible. Relativism is nowhere found in the Bible. The Bible is clear that there are universal moral laws. These laws are placed upon humanity by God himself. There are some areas where the Bible remain.
Christian Ethics BA 616 Business Ethics Definiti.docxtroutmanboris
Christian Ethics
BA 616 Business Ethics
Definition of Christian Ethics
A system of values based upon the Judeo/Christian Scriptures
Principles of behavior in concordance with the behaviors of Christian teachings
Standards of thought and behavior as taught by Jesus.
Discussion
What are some of the “ethical” attributes presented in the teachings of Jesus?
What are some ethical attributes presented in the teachings of other religious persons?
Quotes about Christian Ethics
Quotes on Christian Ethics
Recognize the value of work
“And when you reap the harvest of your land, you shall not reap your field right up to its edge, nor shall you gather the gleanings after your harvest. You shall leave them for the poor and for the sojourner: I am the Lord your God.” (Leviticus 23:22).
Do not give the poor the food, rather allow the poor to work for themselves
Discussion
What are examples of the value of work?
Today, some U.S. state governors are trying to get those “able bodied” individuals to work for welfare. They are meeting great resistance politically, why do you think this is?
The value of work
Confirmed by Elton Mayo
Fulfills social, psychological and economic needs of the individual
“If a man will not work, he shall not eat” (2 Thessalonians 3:10)
Christian Ethics
The fruit of a people that have inwardly committed their lives to Christ and are outwardly aligning their actions with His teachings.
“May the favor of the Lord our God rest on us; establish the work of our hands for us— yes, establish the work of our hands” (Psalms. 90:17).
Employees with a Christian Code of Ethics
Welcome accountability
Happy to show their efforts
A system of checks and balances
Sees possible training moment
Fosters collaboration with management
“Those who work their land will have abundant food, but those who chase fantasies have no sense” (Proverbs 12:11)
Employees with a Christian Code of Ethics
Not motivated by greed
Work is its own reward
Measure success in a non-monetary way
Seek payment for the work they do
Money is second to obedience
“Whatever you do, work at it with all your heart, as working for the Lord, not for human masters” (Colossians 3:23).
Employees with a Christian Code of Ethics
Are highly productive
Are work focused
Work hard throughout the day
Find value in completing assigned tasks
Understand that they are there to work
“Diligent hands will rule, but laziness ends in forced labor” (Proverbs 12:24).
Employees with a Christian Code of Ethics
Have a strong work ethic
Believe in a Biblical perspective of work
Reliable
Recognize the value of work
Relate their job to their faith
“All hard work brings a profit, but mere talk leads only to poverty” (Proverbs 14:23)
Employees with a Christian Code of Ethics
Bring a cooperative spirit to the workplace
Supportive of management
Strong contribu.
CHPSI think you made a really good point that Howard lacks poli.docxtroutmanboris
CH/PS
I think you made a really good point that Howard lacks political aspects-especially for presidency. I have no heard his speeches quite yet (since I tend to stray away from politics altogether because people are so aggressive), do you think he is a great leader-type and is he charismatic at all? Great leaders, especially for presidency, should be honest, charismatic, and not only cater to the audience's needs but to the entire country's needs without sugar coating things.
Also, I am not sure what you mean by "In order to improve his leadership style, Jeff should change his model of carrying out business activities. This is because it can be copied and imitated by other companies (Mauri, 2016)".- how can it be imitted by other companies? In what way?
Do you think Jeff Bezos is a bad leader? and why?
CH/AR
I found your comparison of Howard Schultz and Jeff Bezos interesting and compelling. When I was looking at the list of leaders to select from, it was staggering to me how many of the corporate leaders have run or are planning to run for political office. I'm not sure, given our current political environment, that running a large corporation is the right background and experience for the leader of the United States. We'll see what happens in the next year and a half!
Amazon is an amazing, transformative company to watch. I work in the financial services industry and one of our leaders recently described our competition not as other financial services firms but as Amazon. Financial services firms pretty much all offer the same products and services and at a very reasonable price point. Amazon, however, has excelled in service delivery. I would imagine that at sometime in the future, Amazon will partner with a financial service firm to deliver products and services. I'll admit that I was and still am skeptical about Amazon's purchase of Whole Foods, but Bezos seems to be up for trying just about anything.
In your analysis of the two leaders, you didn't mention directly the challenges faced by either the leaders or the organization. Last year, Starbucks was all over the news regarding the incident involving two African American gentlemen and how they were treated by a manger at Starbucks. I'm curious how you or others in the class through about how Schultz led the organization through that crisis. Bezos, as well, has not been immune to controversy with his recent affair and divorce becoming public. How do the personal lives and behaviors of leader impact the organizations they lead? Should it matter?
SO
The first leader I chose to research is Sundar Pichai, the CEO of Google. Sundar began to show in interest in technology at an early age, and eventually earned a degree in Metallurgy, and an M.B.A from the Wharton School of the University of Pennsylvania. He then began working at Google in 2004 as the head of product management and development (Shepherd). From there, he assisted in the development of many different departme.
Chosen brand CHANELStudents are required to research a fash.docxtroutmanboris
Chosen brand:
CHANEL
Students are required to research a fashion brand of their choice and analyze its positioning strategy in the market.
● The report will assess students’ ability to collect data, in an efficient manner and use this data to scrutinise the marketing aspects of a fashion brand.
● The report will be covering the following subjects:
1. Analysis Of The Macro And Micro-environment of the brand.
2. Positioning Strategy Of The Brand: Target Customer(Pen Portrait)
3. Competitor Analysis.
4. Critical evaluation of the marketing communications strategy of the brand
supporting the development of the individual report, using relevant PRIMARY and SECONDARY RESEARCH.
NB: Please kindly devise a survey (Google forms) and make up some responses to it so as to then incorporate PRIMARY results into the report. Thanks
see attached file
word count: 2000 words
.
Chose one person to reply to ALBORES 1. Were Manning’s acti.docxtroutmanboris
Chose one person to reply to:
ALBORES
1. Were Manning’s actions legal under the Foreign Corrupt Practices Act, and what are the possible penalties for violating the act?
The Foreign Corrupt Practices Act states (1977) “It shall be unlawful for any issuer...to offer, payment, promise to pay, or authorization of the payment of any money, or offer, gift, promise to give... “. Manning assumed the duty of an issuer because he attended dinner with the prime minister to discuss the contract. Then, Manning offered to fly the prime minister to New York, which he then promised to pay for all of the prime minister's expenses. However, according to the Foreign Corrupt Practices Act (1977) a promise or offer is acceptable if the expense was ”reasonable and bona fide expenditure, such as travel and lodging expenses, incurred by or on behalf of a foreign official… was directly related to the promotion, demonstration, or explanation of products or services”. Manning promised to fly out the prime minister because he wanted to “discuss business further” (UMUC, 2019). Further, Manning used company funds to take the prime minister to luxurious activities and restaurants because he wanted to retain the contract from the prime minister.
Even though Manning did not directly give money to the prime minister, he authorized payment for the prime minster’s two-week stay, which did not involve discussing the contract. Out of the two weeks, business was only conducted for a day. In addition, Manning can be held responsible for bribing the customs officials at Neristan. According to the Foreign Corrupt Practices Act (1977), it is unlawful to influence “any act or decision of such foreign official in his official capacity... omit to do any act in violation of the lawful duty of such official”. Manning influenced the customs officials because Manning gave each custom official $100 to clear the shipment. Custom officials act on behalf of the Neristan government and sometimes require large shipments to be inspected. Manny will likely be held responsible for offering payment to the customs officials in exchange for expediting the company’s shipment.
If Manning violated the Foreign Corrupt Practices Act, he could face imprisonment. Also, the company may have to pay the penalty. The penalty for violating the act is “a fine of up to $2 million per violation. Likewise, an individual may face up to five years in prison and/or a fine of $250,000 per violation of the anti-bribery provision” (Woody, 2018, p. 275).
2. Were Manning’s actions legal under the UK Bribery Act and what are the possible penalties for violating the act?
Based on the UK Bribery Act (2010), an individual is guilty of bribing an official if “intention is to influence F (government official) in F's capacity as a foreign public official...intend to obtain or retain business, or an advantage in the conduct of business.”. Manning bribed the prime minister because he stated: “If, after we are done conducting busi.
Choosing your literary essay topic on Disgrace by J. M. Coetzee .docxtroutmanboris
Choosing your literary essay topic on
Disgrace
by J. M. Coetzee is the first step to writing your literary analysis paper.
After reading the novel, you should be able to decide in which direction you'd like to take your paper.
Topics/ approaches
(Focus on only one of the following, though some may overlap):
Analyze one of the minor characters, such as Petrus.
Example
: Analyze not only the chosen characters' personality but also what role they played in advancing the overall theme of the novel.
The protagonist's conflict, the hurdles to be overcome, and how he resolves it.
Examples:
It could be hope for change, both in South Africa and in David Lurie. OR: the disgrace David Lurie has suffered over the affair with a student and how that matches the disgrace South Africa has suffered through apartheid.
The function of setting to reinforce theme and characterization.
Example
: post-apartheid South Africa is a setting arguably more important than anything else in the novel. Your outside sources would be a bit of history concerning apartheid.The use of literary devices to communicate theme: imagery, metaphor, symbolism, foreshadowing, irony
Symbolism in the novel--
Examples:
Determine if David Lurie represents the old, white authorities of South Africa, while Lucy represents the new white people of South Africa. OR: Analyze what dogs symbolize in this story. Another example: What is symbolized by the opera David Lurie is writing on Byron?
Careful examination of one or more central scenes and its/their crucial role in plot development, resolution of conflict, and exposition of the theme.
Example:
Analyze one or more scenes in which hope that change for the better is possible through a character's remorse and subsequent action, for example, the scene in which David Lurie apologizes to the parents OR the scene in which Lucy gets raped.
The possible issue to be addressed in introduction or conclusion:
Characteristics that make the work typical (or atypical) of the period, the setting, or the author that produced it. For this information, you must go to a library database (you must read "How to Access Miami Dade Databases" if you don't know how) or a valid search site, such as Google Scholar (there is often a fee for this one).
Do
not
open or close with biographical material on the author. Biographical material is important as it influences the author’s writing only and should not be a focus of your paper.
Guidelines for Literary Essay
Be aware that you will be writing about a novel, which in its broadest sense is any extended fictional narrative almost always in prose, in which the representation of character is often the focus. Good authors use the elements of fiction, such as plot, theme, setting etc. purposefully, with a very clear goal in mind. One of the paths to literary analysis is to discover what the author's purpose is with each of his choices. Avoid the problem th.
Choosing your Philosophical Question The Final Project is an opp.docxtroutmanboris
Choosing your Philosophical Question
The Final Project is an opportunity for you to investigate one of the discussion questions to a much greater degree than in the forums. For your Final Project you will choose a philosophical question (stage 1), conduct an analysis of the claims and arguments relevant to the question by reading the primary texts of the philosopher (stage 2), and then take a position on the chosen question and offer an argument in support of your position (stage 3).
For this first stage of your Final Project assignment, (a) choose a question that appears as a discussion question (listed below, with some exceptions). You may choose one that you have previously begun to answer in the discussion forums, or one that you have yet to consider, then (b) explain briefly why you are interested in exploring this philosopher, the primary text and the question further. Submit this assignment on a Word .docx.
Week Four: Philosopher: Thomas Aquinas, Primary Text: Summa Theologica, Part 1, Question 2, Article 1-3
Q1. Does God really exist?
Question to write on, and answer the question fully in all its parts. Be mindful of the question. You are making a claim about something and offering support for it. Try to use examples from the Primary Texts you have read and/or your own experiences in that support.
DISCUSSION QUESTION CHOICE #1: Philosophy of Religion. Study Aquinas' five "ways" of demonstrating God's existence in the learning resources then engage in the study of ontology by examining your belief in God:
Answer the question: Does God really exist?
Use Aquinas and your own reasoning in your argument.
Kreeft, Peter. A Shorter Summa: The Essential Philosophical Passages of St. Thomas Aquinas'
Summa Theologica, Ignatius Press (San Francisco, 1993), chapter II.
Summa Theologica, Part 1, Question 2, Articles 1-3
The Existence of God
Because the chief aim of sacred doctrine is to teach the knowledge of God, not only as He is in
Himself, but also as He is the beginning of things and their last end, and especially of rational
creatures, as is clear from what has been already said, therefore, in our endeavor to expound this
science, we shall treat: (1) Of God; (2) Of the rational creature’s advance towards God; (3) Of
Christ, Who as man, is our way to God.
In treating of God there will be a threefold division: For we shall consider (1) Whatever concerns
the Divine Essence; (2) Whatever concerns the distinctions of Persons; (3) Whatever concerns the
procession of creatures from Him
Concerning the Divine Essence, we must consider: (1) Whether God exists? (2) The manner of His
existence, or, rather, what is not the manner of His existence; (3) Whatever concerns His
operations — namely, His knowledge, will, power.
Concerning the first, there are three points of inquiry: (1) Whether the proposition “God exists” is
self-evident? (2) Whether it is demonstrable? (3) Whether God exists?-
FIRST ARTICLE
Whether the Existence .
Choosing Your Research Method in a NutshellBy James Rice and.docxtroutmanboris
Choosing Your Research Method in a Nutshell
By James Rice and Marilyn K. Simon
Research Method Brief Type
Action research Participatory ‐ problem identification, solution,
solution review
III
Appreciative inquiry Helps groups identify solutions III, IV
Case Study research Group observation to determine how and why a
situation exists
III
Causal‐comparative research Identify causal relationship among variable that
can't be controlled
IV
Content analysis Analyze text and make inferences IV
Correlational research Collect data and determine level of correlation
between variables
I
Critical Incident technique Identification of determining incident of a critical
event
III
Delphi research Analysis of expert knowledge to forecast future
events
I, IV
Descriptive research Study of "as is" phenomena I
Design based research/ decision analysis Identify meaningful change in practices II
Ethnographic Cultural observation of a group
Evaluation research Study the effectiveness of an intervention or
program
IV
Experimental research Study the effect of manipulating a variable or
variables
II
Factor analysis Statistically assess the relationship between large
numbers of variables
I
Grounded Theory Produce a theory that explains a process based on
observation
III, IV
Hermeneutic research Study the meaning of subjects/texts (exegetics is
text only) by concentrating on the historical
meaning of the experience and its developmental
and cumulative effects on the individual and society
III
Historical research historical data collection and analysis of person or
organization
IV
Meta‐analysis research Seek patterns in data collected by other studies and
formulate principals
Narrative research Study of a single person's experiences
Needs assessment Systematic process of determine the needs of a
defined demographic population
Phenomenography Answer questions about thinking and learning
Phenomenology Make sense of lived experiences of participants
regarding a specified phenomenon.
III, IV
Quasi‐experimental Manipulation of variables in populations without
benefit of random assignment or control group.
II
Q‐method A mixed‐method approach to study subjectivity ‐
patterns of thought
I
Regression‐discontinuity design (RD) Cut‐off score assignment of participants to group
(non‐random) used to study effectiveness of an
intervention
II
Repertory grid analysis Interview process to determine how a person
interprets the meaning of an experience
I
Retrospective record review Study of historic data collected about a prior
intervention (both effected and control group)
II
Semiology Studies the meaning of symbols II, III
Situational analysis Post‐modernist approach to grounded theory
(holistic view rather than isolated variables) by
studying lived experiences around a phenomenon
Trend Analysis research Formulate a f.
Choose two of the systems (education, work, the military, and im.docxtroutmanboris
Choose
two
of the systems (education, work, the military, and immigration). Explain how they fit into the domain of social work and the social justice issues social workers should be aware of in these systems.
How does the education, military, workplace, or immigration system rely on social workers?
What is one social justice issue found in education, the military, the workplace, or immigration that influences the practice of social work?
.
Choose two disorders from the categories presented this week.C.docxtroutmanboris
Choose
two disorders from the categories presented this week.
Create
a 15- to 20-slide Microsoft® PowerPoint® presentation that includes the following:
Describes the disorders and explains their differences
Discusses how these disorders are influenced by the legal system
Discusses how the legal system is influenced by these disorders
Include
a minimum of two peer-reviewed sources.
Format
your presentation consistent with APA guidelines.
Submit
your assignment.
*3 slides on How is the legal system influenced by schizophrenia with speaker notes*
.
Choose ONE of the following topics Length 750-900 words, .docxtroutmanboris
Choose
ONE
of the following topics
Length:
750-900 words, double spaced, 12 pt. font
Identify the different forms of religious groups that are comprised in the typology outlined by the classic sociologists of religion. Explain the basic characteristics of each and provide examples.
Establish a distinction between the popular misuses of the term "myth" and its meaning in the scholarly context of Religious Studies. Explain the functions of myth according to the scholar Joseph Campbell.
.
Choose one of the following topicsAmerica A Narrative.docxtroutmanboris
Choose
one
of the following topics
America: A Narrative History
notes Thomas Jefferson's election to the presidency set the tone of "republican simplicity". In what ways was this still true in 1850 following the "Market Revolution" and in what ways was it not?
Connect the technological improvements in water transportation of the early 19th century to the territory acquired in the LA Purchase.
.
Choose one of the following topics below. Comparecont.docxtroutmanboris
Choose
one
of the following topics below.
Compare/contrast the role women played in Puritan Society in colonial Massachusetts with their role in the Great Awakening of the 18th century.
Why is the Declaration of Independence considered historically as a product of the Age of Enlightenment?
500 words
.
Choose one of the following topics below. Comparecon.docxtroutmanboris
Choose
one
of the following topics below.
Compare/contrast the role women played in Puritan Society in colonial Massachusetts with their role in the Great Awakening of the 18th century.
Why is the Declaration of Independence considered historically as a product of the Age of Enlightenment?
requirement of this assignment
Write a 500 word essay
.
Choose one of the states of RacialCultural Identity Development.docxtroutmanboris
Choose one of the states of Racial/Cultural Identity Developmental Model and reflect on how you will intervine with a client in that stage.
Stages:
Conformity
Dissonance and Appreciating
Resistance and immersion
Introspection
Integrative Awareness
.
Choose one of the following topicsNative AmericansWomenEnvi.docxtroutmanboris
Choose
one of the following topics:
Native Americans
Women
Environment
Latin Americans
Sexual liberation
Read
at least three different newspaper articles between 1968 and 1980 that cover important changes affecting your topic. In the University Library, use the ProQuest
®
historical newspaper archive (available under
General Resources > ProQuest >
Advanced Search
>
Search Options
>
Source Type
), which includes the following major newspapers, among others:
New York Times
Washington Post
Wall Street Journal
Los Angeles Times
Christian Science Monitor
Write
a 700- to 1,050-word paper in which you describe the status of the chosen group or idea and how that group or idea was affected by the changes brought about during the 1960s. Include information gleaned from the newspaper articles as well as other material.
.
Choose one of the following films for review (with faculty’s appro.docxtroutmanboris
Choose
one of the following films for review (with faculty’s approval). Put yourself in the movie by choosing one character to follow. What cultural issues would you face? What are cultural challenges? Write a short paper describing the film and your observations. Present your findings in class.
•
Secret Lives of Bees
•
Chocolate
•
Under the Same Moon
•
Maid in Manhattan
•
Walk in the Clouds
•
Get Rich or Die Trying (Gang Culture
) "I like this one"
•
Mu
lan
•
Mississippi Burning
•
A Time to Kill - "
I Also like this one
"
•
Only Fools Rush In
.
Choose and complete one of the two assignment options.docxtroutmanboris
Choose
and
complete
one of the two assignment options:
Option 1: Forecasting Comparison Presentation
Identify
a state, local, or federal policy that impacts your organization or community.
Create
an 8- to 10-slide Microsoft® PowerPoint® presentation in which you complete the following:
Describe how forecasting can be used to implement this policy and highlight any limitations of the usage of forecasting.
Compare and contrast the different forms of forecasting used to aid decision-makers when evaluating policy outcomes.
Discuss the types of information needed to ensure forecasts are accurate.
Analyze the relationship between forecasting, monitoring of observed policy outcomes, and normative futures in goals and agenda setting.
Include
speaker notes with each slide. The presentation should also contain and at least four peer-reviewed references from the University Library.
I live in Lawrence, KS if you can find a policy within this community.
.
How to Make a Field invisible in Odoo 17Celine George
It is possible to hide or invisible some fields in odoo. Commonly using “invisible” attribute in the field definition to invisible the fields. This slide will show how to make a field invisible in odoo 17.
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
Introduction to AI for Nonprofits with Tapp NetworkTechSoup
Dive into the world of AI! Experts Jon Hill and Tareq Monaur will guide you through AI's role in enhancing nonprofit websites and basic marketing strategies, making it easy to understand and apply.
Acetabularia Information For Class 9 .docxvaibhavrinwa19
Acetabularia acetabulum is a single-celled green alga that in its vegetative state is morphologically differentiated into a basal rhizoid and an axially elongated stalk, which bears whorls of branching hairs. The single diploid nucleus resides in the rhizoid.
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdfTechSoup
In this webinar you will learn how your organization can access TechSoup's wide variety of product discount and donation programs. From hardware to software, we'll give you a tour of the tools available to help your nonprofit with productivity, collaboration, financial management, donor tracking, security, and more.
Biological screening of herbal drugs: Introduction and Need for
Phyto-Pharmacological Screening, New Strategies for evaluating
Natural Products, In vitro evaluation techniques for Antioxidants, Antimicrobial and Anticancer drugs. In vivo evaluation techniques
for Anti-inflammatory, Antiulcer, Anticancer, Wound healing, Antidiabetic, Hepatoprotective, Cardio protective, Diuretics and
Antifertility, Toxicity studies as per OECD guidelines
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
This presentation provides a briefing on how to upload submissions and documents in Google Classroom. It was prepared as part of an orientation for new Sainik School in-service teacher trainees. As a training officer, my goal is to ensure that you are comfortable and proficient with this essential tool for managing assignments and fostering student engagement.
Read| The latest issue of The Challenger is here! We are thrilled to announce that our school paper has qualified for the NATIONAL SCHOOLS PRESS CONFERENCE (NSPC) 2024. Thank you for your unwavering support and trust. Dive into the stories that made us stand out!
HS2021 Database Design and UseWeek 2 - 2020 Tutorial
1. HS2021 Database Design and Use
Week 2 - 2020 Tutorial
Date:
Instructions:
This exam has three (3) questions.
You are expected to select one question out of three (3)
questions and to submit your answer via the blackboard
assessment system.
Assessment Weight:
This test accounts for five per cent (5%) of total marks.
Total marks for the paper
5 marks
Question A: Create the Entity-Relationship Diagram and the
Relational Schema for the following scenario
BestBank prides itself on having up-to-date information on the
current account balance of its customers. To do this, BestBank
relies on a company-wide information system. Customers are
the heart of the BestBank information system. Customers are
characterized by their customer number (unique), first name,
last name, address, and date of birth. A customer can have
multiple accounts into the BestBank information system.
Accounts are characterized by their account number (unique),
account type (i.e. everyday, savings, business) and amount and
they must be assigned to a specific customer. To keep track of
their spending habits BestBank customers can review all the
2. transactions executed using their accounts. A transaction must
be associated with a specific account, and each account can
have multiple transactions. Finally, each transaction is
characterized by a transaction id (unique), a transaction type
(i.e. withdraw or deposit) and the transaction amount.
Question B: Create the Entity-Relationship Diagram and the
Relational Schema for the following scenario
BestDelivery prides itself on having up-to-date information on
the status of shipped item. To do this, BestDelivery relies on a
company-wide information system. Items are the heart of the
BestDelivery information system. Items are characterized by
their item code (unique), delivery status, and destination
address. Items are assigned to couriers who are in charge of
their delivery. A courier delivers several items in a day.
Couriers are characterized by their employee number (unique),
first name, last name, and driving license.
Question C: Create the Entity-Relationship Diagram and the
Relational Schema for the following scenario
BestFreelancer prides itself on having the most efficient
platform through which is possible to find freelancers for any
type of work. Freelancers can freely register on the platform
and provide information about all the projects they have
completed. To do this, BestFreelancer relies on a company-wide
information system. Freelancers are the heart of the
BestFreelancer information system. Freelancers are
characterized by their profile code (unique), first name, last
name, and email. Freelancers can list, within their profile, as
many projects as they want. Projects are characterized by their
project code (unique), start date, end date, project title, and
project description.
Student Name:
_____________________________________________________
3. Student ID: ____________________________
HS2021 Database Design and use
Week 2 - 2020
10
p3-start.cppp3-start.cpp/** @file p3-start.cpp
*
* @author Your Name Here
*
* @assg Programming Assignment #3
*
* @desc Implement the deadlock detection algorithm. Given a
file
* that describes the current allocation A of resources in th
e
* system, and the current set of outstanding requests Q in
* the system, determine if a deadlock is present or not. U
se
* the algorithm given on p.276 in the Stallings textbook.
*
* @date March 05, 2018
*/
#include<stdlib.h>
#include<iostream>
#include<iomanip>
#include<fstream>
#include<string>
usingnamespace std;
4. // global constants
constint MAX_PROCESSES =10;// I won't test your algorithm
with simulations with more than 10 processes
constint MAX_RESOURCES =10;// nor will I give a simulation
to test with more than 10 resources
// simple struct to read in and hold the state of the system
typedefstruct
{
int numResources;
int numProcesses;
int available[MAX_RESOURCES];// V available vector
int alloc[MAX_PROCESSES][MAX_RESOURCES];// A allocati
on matrix
int request[MAX_PROCESSES][MAX_RESOURCES];// Q requ
est matrix
}State;
/** Read system state from file.
* Given a file, read the current system state from the file.
* The system state file is expected to hold the available vector
V
* the allocation matrix A and the request matrix Q.
*
* @param simfilename The name of the file to open and read st
ate & request
* from.
* @return state A new State structure is allocated and filled wit
h the
* system state from the file. A pointer to this allocated sy
stem
* state structure is returned as a result of calling this func
5. tion.
*/
State* readSystemState(char* statefilename)
{
ifstream simstatefile(statefilename);
State* state;
int r, p;
// If we can't open file, abort and let the user know problem
if(!simstatefile.is_open())
{
cout <<"Error: could not open system state file: "<< statefile
name
<< endl;
exit(1);
}
// dynamically allocate a new State structure, to be filled in and
returned
state =newState;
// Format of file is this (where m = numResource n = numProces
ses
// V = available vector
// A = allocation matrix and
// Q = request matrix)
// m n
// V1 V2 V3 ... Vm
// A11 A12 ... A1m
// ...
// An1 An2 ... Anm
// Q11 Q12 ... Q1m
// ...
// Qn1 Qn2 ... Qnm
// First line, get m (numResources) and n (numProcesses)
6. simstatefile >> state->numResources >> state->numProcesses;
// Next line contains the available vector V
for(r =0; r < state->numResources; r++)
{
simstatefile >> state->available[r];
}
// Next n lines contain the allocation matrix A
for(p =0; p < state->numProcesses; p++)
{
for(r =0; r < state->numResources; r++)
{
simstatefile >> state->alloc[p][r];
}
}
// Next n lines contain the request matrix Q
for(p =0; p < state->numProcesses; p++)
{
for(r =0; r < state->numResources; r++)
{
simstatefile >> state->request[p][r];
}
}
// return the newly allocated and filled in system state
return state;
}
/** Display a vector
* Display a state vector to standard output
*
* @param len The number of items in the vector
* @param v An array of integers of len items
*/
7. void displayVector(int len,int v[])
{
int i;
// Display a header
for(i =0; i < len; i++)
{
cout <<"R"<< i <<" ";
}
cout << endl;
// Display values
for(i =0; i < len; i++)
{
cout << setw(2)<< v[i]<<" ";
}
cout << endl;
}
/** Display a matrix
* Display a state matrix to standard output
*
* @param rows The number of rows in the matrix
* @param cols The number of cols in the matrix
* @param m A 2 dimensional array of rows x cols integers
*/
void displayMatrix(int rows,int cols,int v[MAX_PROCESSES][
MAX_RESOURCES])
{
int r, c;
// display column headers
cout <<" ";// extra space over for row labels
for(c =0; c < cols; c++)
{
cout <<"R"<< c <<" ";
8. }
cout << endl;
// now display data in matrix
for(r =0; r < rows; r++)
{
cout <<"P"<< r <<" ";
for(c =0; c < cols; c++)
{
cout << setw(2)<< v[r][c]<<" ";
}
cout << endl;
}
cout << endl;
}
/** Display state
* Display the values of the resource vectors and matrices in the
indicated
* state structure
*
* @param state A pointer to a State struct whose info we shoul
d display on stdout.
*/
void displayState(State* s)
{
cout <<"numResources (m) = "<< s->numResources <<" ";
cout <<"numProcesses (n) = "<< s-
>numProcesses << endl << endl;
cout <<"Available vector V:"<< endl;
displayVector(s->numResources, s->available);
cout << endl;
cout <<"Allocation matrix A: "<< endl;
displayMatrix(s->numProcesses, s->numResources, s->alloc);
9. cout << endl;
cout <<"Request matrix Q: "<< endl;
displayMatrix(s->numProcesses, s->numResources, s-
>request);
cout << endl;
}
/** The deadlock detector
* The starting point for implementation of the deadlock detecti
on algorithm.
* We open and read in the allocation matrices here, then perfor
m the deadlock detection.
*
* @ param statefilename A string with the name of the file hol
ding the A and Q system state matrices
*/
void detectDeadlock(char* statefilename)
{
State* state;
state = readSystemState(statefilename);
// I have provided some example routines to read and display sy
stem state, implemented as a plain
// C struct using C 1 and 2 dimensional arrays. You can uncom
ment out the following, and/or use
// the displayMatrix() and displayVector() functions to help you
debug. But make sure you
// remove or comment back up any statements after you are done
debugging.
displayState(state);
// You need to implement your solution here. I would recomme
nd you use functions for each of
10. // these steps.
// Step 1: Set up a data structure that records marked/unmarked
// processes. All processes are initially unmarked Search
// through the allocation matrix to find rows of all 0, and
// mark corresponding processes in your mark structure
// Step 2: Create a temporary vector W. Copy contents of availa
ble
// vector V to W. Suggestion: create a function called
// copyVector, that takes a vector as its parameter, and returns
// a new vector.
// Need to put Steps 3 and 4 in a loop
// Step 3: Find index i such that process i is currently unmarked,
// and the ith row of Q is less than or equal to W. If no
// such process is found, need to terminate algorithm/loop.
// Suggestion: write a function that takes Q and W, and
// returns either i (index of process meeting criteria) or
// -1
// Step 4: If a row was found (e.g. i was a valid process that met
// criteria of step 3), mark process i and add the
// correspoinding row of allocation matrix to W. Loop bac
k
// to beginning of step 3.
// Step 5: after loop finishes,
// if (your marked/unmarked processes contains unmarked proce
sses)
// {
// cout << "Deadlock";
// // loop through your marked/unmarked structure, print out al
l unmarked processes as P1, P2, etc.
// cout << endl;
11. // }
// else // all processes were marked, so no deadlock
// {
// cout << "No Deadlock" << endl;
// }
}
/** Main entry point of deadlock detection.
* The main entry point of the deadlock detection program. Thi
s function
* checks the command line arguments, and calls the detection f
unction if correct
* arguments were supplied. We expect a single command line
argument
* which is the name of the file holding the allocation and reque
st matrices
* of the current state of the system.
*
* @param argc The argument count
* @param argv The command line argument values. We expect
argv[1] to be the
* name of a file in the current directory holding A and
Q matrices.
*/
int main(int argc,char** argv)
{
if(argc !=2)
{
cout <<"Error: expecting state matrix file as first command li
ne parameter"<< endl;
cout <<"Usage: "<< argv[0]<<" system-state.sim"<< endl;
exit(1);
}
detectDeadlock(argv[1]);
12. // if don't want to use command line do following. Need to reco
mpile by hand since file
// name to get simulated events from is hard coded.
// Make sure you revert back to using command line before sub
mitting your program.
//detectDeadlock("state-01.sim");
}
prog-03.pdf
CSci 430: Programming Project #3
Deadlock Detection
Spring 2019
Dates:
Assigned: Monday February 25, 2019
Due: Wednesday March 13, 2019 (before Midnight)
Objectives:
� Learn more about Deadlock algorithms.
� Better understand how we can algorithmically detect
deadlocks on a
system.
� Use C/C++ to implement vector and matrix data structures,
get prac-
tice in creating and using such data structures in C/C++.
Description:
13. Our textbook gives the following algorithm (pg. 276) for
algorithmically
detecting if a deadlock is present or not in a system. It requires
that the
system keep an Allocation matrix A, listing which resources are
currently
allocated to which processes, and the available vector V, which
gives the
amount of each resource currently available in the system. In
addition, the
deadlock detection algorithm requies a request matrix Q, which
keeps track
of the amount of each resource each process is currently
requesting from the
system. The algorithm is:
1. Mark each process that has a row in the Allocation matrix of
all zeros.
2. Initialize a temporary vector W to equal the Available vector
A.
1
3. Find an index i such that process i is currently unmarked and
the i th
row of Q is less than or equal to W. That is, Qik ≤ Wk, for 1 ≤ k
≤ m.
If no such row is found, terminate the algorithm.
4. If such a row is found, mark process i and add the
corresponding row of
the allocation matrix to W. That is, set Wk = Wk+Aik, for 1 ≤ k
14. ≤ m.
Return to step 3.
A deadlock exists if and only if there are unmarked processes at
the end
of the algorithm. Each unmarked process is deadlocked.
In this assignment we will implement the deadlock detection
algorithm.
Your program will be given a �le that describes the A
allocation matrix
and the Q request matrix, representing the current state of all
allocations
and requested allocations in the system. Your program will
implement the
deadlock detection algorithm described above. The result of
your program
will be one of 2 outputs:
1. If no deadlock exists, the program will display No Deadlock
on stan-
dard output.
2. If a deadlock does exist, the program will display Deadlock:
P0, P1,
P2 on standard output, where P0, P1, P2 are the processes that
the
algorithm determined to be deadlocked in the system.
State simulation �le formats
I have provided a p3-start.cpp template that can open up and
read in the
process/resource state simulation �les used for this assignment.
Here we
discuss a bit more the format of these �le. I have provided 2 or
15. 3 exam-
ple simulations, with expected correct answers, for you to use to
test your
implementations with.
The input �les needed for this assignment need to contain the
information
found in the V available vector and the A allocation and Q
request matrices.
In the following I use r as the number of resources and p as the
number of
processes. Thus the general format of the input �le is:
r p
V1 V2 V3 ... Vr
A11 A12 ... A1r
...
Ap1 Ap2 ... Apr
2
Q11 Q12 ... Q1r
...
Qp1 Qp2 ... Qpr
For example, the example of the deadlock detection algorithm
given on
page 277 has a system with r=5 resources and p=4 processes.
16. The V, A and
Q vector/matrices are shown on that page. The input �le for the
current
state of the system shown on page 277 would be
5 4
0 0 0 0 1
1 0 1 1 0
1 1 0 0 0
0 0 0 1 0
0 0 0 0 0
0 1 0 0 1
0 0 1 0 1
0 0 0 0 1
1 0 1 0 1
The function named readSystemState() in your template p2-
start.cpp
code expects a �le of this format, and reads it into a State
structure for you.
Running Simulations
The following is a discussion of the expected output of your
program. Your
program must work from the command line, and expect a single
parameter,
17. the name of the state simulation input �le, as its input. Your
program
should display only a single line to standard output as a result
of running it.
If the system, described in the state input �le is not deadlocked,
the program
should simply state there was no deadlock to standard output:
$ p3.exe state-02.sim
No Deadlock
On the other hand, if your program is deadlocked, it should say
that it
detected a deadlock, and it should print out the processes that
are deadloked
to standard output:
$ p3.exe state-01.sim
Deadlock: P0, P1,
3
I have provided 2 or 3 example input state �les, named state-
01.sim,
state-02.sim, etc. I have also provided the correct and expected
output for
these simulations, named state-01.res, state-02.out, etc.
4
state-01.sim
23. 0 0 0 0 0 1 0 0 0 0
1 2 0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 0 0 1
1 0 0 0 0 0 0 1 0 0
state-08.res
p5-start.cppp5-start.cpp/**
* @author Jane Student
* @cwid 123 45 678
* @class CSci 430, Spring 2018
* @ide Visual Studio Express 2010
* @date November 15, 2018
* @assg prog-04
*
* @description This program implements a simulation of proce
ss
* scheduling policies. In this program, we implement round-
robin
* scheduling, where the time slice quantum can be specified a
s
* as a command line parameter. And we also implement shor
test
* remaining time (SRT) scheduling policy
*/
#include<stdlib.h>
#include<iostream>
#include<iomanip>
#include<fstream>
#include<string>
#include<list>
usingnamespace std;
24. // global constants
// I won't test your round robin implementation with more than 2
0 processes
constint MAX_PROCESSES =20;
constint NO_PROCESS =0;
// Simple structure, holds all of the information about processes,
their names
// arrival and service times, that we are to simulate.
typedefstruct
{
string processName;
int arrivalTime;
int serviceTime;
// holds running count of time slices for current time quantum,
when
// serviceTime == quantum, time slice is up
int sliceTime;
// holds total number of time steps currently run, when == to
// serviceTime process is done
int totalTime;
// holds time when process finishes, used to calculate final stats,
// like T_r, T_r/T_s
int finishTime;
// a boolean flag, we will set this to true when the process is co
mplete
bool finished;
}Process;
// Process table, holds table of information about processes we a
re simulating
typedefstruct
{
int numProcesses;
Process* process[MAX_PROCESSES];
25. }ProcessTable;
/** Create process table
* Allocate memory for a new process table. Load the process
* information from the simulation file into a table with the proc
ess
* information needed to perform the simulation. At the same ti
me we
* initialize other information in process table for use in the
* simulation. Return the newly created ProcessTable
*
* @param processFilanem The name (char*) of the file to open
and read
* the process information from.
* @param processTable This is actually a return parameter. Th
is
* should be a pointer to an already allocated array of
* Process structure items. We will fill in this structure
* and return the process information.
*
* @returns ProcessTable* The newly allocated and initialized P
rocessTable
* structure.
*/
ProcessTable* createProcessTable(char* processFilename)
{
ifstream simprocessfile(processFilename);
ProcessTable* processTable;
int pid;
string processName;
int arrivalTime;
int serviceTime;
// If we can't open file, abort and let the user know problem
if(!simprocessfile.is_open())
26. {
cout <<"Error: could not open process simulation file: "
<< processFilename << endl;
exit(1);
}
// Format of file is
// ProcessName1 ArrivalTime1 ServiceTime1
// ProcessName2 ArrivalTime2 ServiceTime2
// ...
// ProcessNameN ArrivalTimeN ServiceTimeN
//
// Where the name is any arbitray string identifier, and ArrivalT
ime
// and ServiceTime are integer values
pid =0;
processTable =new(ProcessTable);
while(simprocessfile >> processName >> arrivalTime >> servic
eTime)
{
// allocate a new process to hold information
Process* process =new(Process);
processTable->process[pid]= process;
// load information into process read from simulation file
process->processName = processName;
process->arrivalTime = arrivalTime;
process->serviceTime = serviceTime;
// initialize other process information for the simulaiton
process->sliceTime =0;
process->totalTime =0;
process->finishTime =0;
process->finished =false;
pid++;
27. }
// Set the number of processes we need to simulate information i
n
// the process table
processTable->numProcesses = pid;
return processTable;
}
/** Display process table
* Convenience method, dump all of the information about the p
rocesses
* in a process table to stdout.
*
* @param processTable The table, a pointer to type ProcessTab
le
* struct, with the information we are to display
*/
void displayProcessTable(ProcessTable* processTable)
{
cout <<"Process Table num = "<< processTable-
>numProcesses << endl;
cout <<"PID Name Arrv Srvc"<< endl;
cout <<"------------------"<< endl;
for(int pid=0; pid < processTable->numProcesses; pid++)
{
Process* p = processTable->process[pid];
cout << setw(2)<< right << pid <<") ";
cout << setw(4)<< left << p->processName <<" ";
cout << setw(4)<< right << p->arrivalTime <<" ";
cout << setw(4)<< right << p->serviceTime <<" ";
cout << endl;
}
}
28. /** Round robin scheduler simulator
* The main routine for performing the round robin preemptive
* scheduler simulator. We expect the time quantum to already
be
* specified and given to us as the first parameter. The file nam
e
* with the process arrival and service time information is given
as
* the second parameter. We simulate preemptive round robin
* scheduling of all of the processes until there are no longer an
y
* processes left in the system (all processes have exceeded thei
r
* service time and have exited).
*
* @param processTable A pointer to a ProcessTable structure h
olding
* information about the processes, arrival times and duratio
ns
* that we are simulating execution of.
* @param quantum An integer value holding the time slice qua
ntum we
* are using for this simulation.
*/
void roundRobinScheduler(ProcessTable* processTable,int quan
tum)
{
// Implement the round robin scheduler here
cout <<"<roundRobinScheduler> entered, quantum: "<< quant
um << endl;
}
/** shortest remaining time simulator
29. * The main routine for performing the shortest remaining time
* preemptive scheduler simulator. The file name with the proc
ess
* arrival and service time information is given as the first
* parameter. We simulate preemptive shortest remaining time
* scheduling of all of the processes until there are no longer an
y
* processes left in the system (all processes have exceeded thei
r
* service time and have exited).
*
* @param processTable A pointer to a ProcessTable structure h
olding
* information about the processes, arrival times and duratio
ns
* that we are simulating execution of.
*/
void shortestRemainingTime(ProcessTable* processTable)
{
// Implement the shortest remaining time policy here
cout <<"<shortestRemainingTime> entered"<< endl;
}
/** Main entry point of round robin scheduler
* The main entry point of the round robin scheduler simulator.
The main funciton
* checks the command line arguments, and calls the simulation
function if correct
* arguments were supplied. We expect two command line argu
ments, which are the
* time slice quantum value we are to use for this preemptive sc
heduler simulation,
* and the name of the simulation file holding the process arriva
l and service
* time information.
30. *
* @param argc The argument count
* @param argv The command line argument values. We expect
argv[1] to be the
* time slice quantum parameter (int format) and argv[2
] to be the
* name of the process simulation file (charcter string)
*/
int main(int argc,char** argv)
{
string policy;
ProcessTable* processTable;
int quantum =0;
// If not all parameters provides, abort and let user know of prob
lem
if(argc <3|| argc >4)
{
cout <<"Error: expecting process simulation file and scheduli
ng policy as command line parameters"
<< endl;
cout <<"Usage: "<< argv[0]<<" process-
file.sim [rr|srt] [quantum]"<< endl;
exit(1);
}
// load process table and parse command line arguments
processTable = createProcessTable(argv[1]);
// just to confirm that process table loaded correctly. You shoul
d
// comment out or remove this as it is not asked for as part of th
e
// output for the assignment simulation
displayProcessTable(processTable);
// determine policy to simulate
31. policy.assign(argv[2]);
// perform simulation of indicated scheduling policy
if(policy =="rr")
{
if(argc !=4)
{
cout <<"Error: time quantum must be provided for round ro
bin `rr` scheduling policy"<< endl;
exit(1);
}
quantum = atoi(argv[3]);
if((quantum <=0)||(quantum >1000))
{
cout <<"Error: received bad time slice quantum parameter:
"<< argv[1]<< endl;
cout <<" valid values are integers in range from 1 to 10
00"<< endl;
exit(1);
}
roundRobinScheduler(processTable, quantum);
}
elseif(policy =="srt")
{
shortestRemainingTime(processTable);
}
else
{
cout <<"Error: unknown process scheduling policy: "<< polic
y << endl;
}
}
prog-05.pdf
32. Programming Assignment #5
CSci 430, Spring 2019
Dates:
Assigned: Monday April 15, 2019
Due: Wednesday May 1, 2019 (before Midnight)
Objectives:
� Understand short-term process scheduling.
� Work with data structures to implement a round-robin
scheduler.
� Look at e�ects of di�erent time slice quantum sizes on the
round-robin scheduling algorithm.
� Use C/C++ to implement vector and matrix data structures,
get practice in creating and using
such data structures in C/C++.
Description:
Our textbooks chapter 9 discusses several possible short-term
process scheduling policies. In this
programming assignment exercise we will implement two of the
preemptive policies, the simple shortest
remaining time policy (SRT) and the round-robin scheduler with
preemptive time slicing. Your program
will be given a simple input �le, indicating the process name,
its arrival time and its total service time,
the same as the process scheduling examples from our textbook
33. in Table 9.4 and Figure 9.5. You will
simulate the execution of the required schedulers. As in
previous assignments, you program will need
to work non-interactively and be callable from the command
line. The program will be provided with
the �le name of a �le with process information, in the format
discussed below. Your program will also
be given the time slicing quantum parameter it is to use for the
simulation, if round-robin scheduling
is selected. Your program will need to output the results of
running the set of simulated processes
using the selected scheduling policy with the indicated time
slice for the round-robin scheduler. Your
program will have to output its results exactly as shown below
in the required output format. Your
program will also need to calculate some summary statistics for
the simulated processes, including the
turnaround time and Tr/Ts ratio for each process, and the mean
Tr and Tr/Ts values for the given
simulation.
Process simulation �le formats
The �les with the information about the processes to be
simulated are fairly simple, and have the same
information that our textbook uses to illustrate the process
scheduling examples. Each simulation �le
contains multiple rows of data, where each row consists of the
process name, its arrival time, and its
service time. Here is an example:
1
A 0 3
34. B 2 6
C 4 4
D 6 5
E 8 2
This �le is named process-01.sim in the zip archive of �les I
have given you to get started on this
assignment. This is also the same set of processes and
start/service times used for all of the examples
in table 9.4 and �gure 9.5.
Running Simulations
As with previous assignments you are required to support using
your simulation from the command
line. Your program will take the name of the �le containing the
process information �rst. The next
parameter will be either 'rr' to perform round-robin scheduling,
or 'srt' if shortest remaining time policy
is to be simulated. Finally, a 3rd parameter will be supplied for
the round-robin scheduler, the time
slice quantum to use. An example of running your �nished
program should look like this:
$ ./p3 process-01.sim rr 4
A A A B B B B C C C C D D D D B B E E D
Name Fnsh T_r T_r/T_s
----------------------
35. A 3 3 1
B 17 15 2.5
C 11 7 1.75
D 20 14 2.8
E 19 11 5.5
Here we are running the simulation using the set of process
information given in the previous section
and with a time slice quantum of 4.
Required Output
As shown above, your program must generate 2 bits of output.
First of all, while running the simulation
of the selected scheduling policy, you should display the
process names in the order they are run. In
the previous example, the sequence of scheduled/run processes
was:
A A A B B B B C C C C D D D D B B E E D
This indicates that process A ran �rst (times 0, 1 and 2),
followed by B running 4 times (times 3
to 7), etc. You are required to output the sequence of process
runs as the �rst line of output, with a
single space in between each process name as shown.
After the processes have run, you need to calculate and display
the statistics for the processes that
you just simulated. In our previous example, the statistics for
our round-robin simulation with a time
quantum of 4 time slices were:
36. Name Fnsh T_r T_r/T_s
----------------------
A 3 3 1
B 17 15 2.5
C 11 7 1.75
2
D 20 14 2.8
E 19 11 5.5
For each process, you need to output the time when it �nished,
the turnaround time (Tr) and the
ratio of the turnaround time to the service time (Tr/Ts).
I have provided a zip �le with a �le named p3-start.cpp as a
template to get you started. In addition,
I have provided you with two process simulation �les, named
process-01.sim and process-02.sim, with
2 sets of process information you can simulate. There are
several examples of correct results generated
for the two sets of inputs, named things like process-01-q1.res,
process-01-q4.res, process-01-srt.res, etc.
These are the correct results you should get for running your
simulation with round-robin scheduling
for various time quantums or for shortest remaining time
scheduling.
37. 3
processtable-01.sim
A 0 3
B 2 6
C 4 4
D 6 5
E 8 2
processtable-02.sim
A 0 4
B 1 7
C 4 5
D 4 5
E 7 2
F 8 5
G 10 1
H 10 4
I 12 6
processtable-03.sim
A 0 3
B 2 4
C 3 5
D 3 8
E 3 2
F 5 6
G 7 9
H 7 4
I 8 3
J 8 5
K 8 4
40. sim-03-rr-5.res
sim-03-srt.res
p2-start.cppp2-start.cpp/**
* @author Your Name Here
* @cwid 123 45 678
* @class CSci 430, Summer 2017
* @ide Visual Studio Express 2017
* @date June 11, 2017
* @assg Programming Assignment #2
*
* @description Implement a simulation of a basic 3 process sta
te system
* Ready, Running, Blocked. Simulation includes a round-
robin scheduler
* with time slice scheduling. Need to implement a basic Proc
ess
* Control Block (PCB) in order to implement the round robin
scheduler.
* Program will also have ready queues, and possible queues o
r other
* structures to keep track of blocked processes and the events
they
* are waiting on.
*
*/
#include<stdlib.h>
#include<iostream>
#include<fstream>
#include<string>
41. usingnamespace std;
/** The process simulator.
* The main loop for running a simulation. We read simulation
* events from a file
*
* @param simfilename The name of the file (e.g. simulaiton-
01.sim) to open
* and read simulated event sequence from.
* @param timeSliceQuantum The value to be used for system ti
me slicing preemption
* for this simulation.
*/
void runSimulation(char* simfilename,int timeSliceQuantum)
{
ifstream simeventsfile(simfilename);
string command;
int eventnum;
if(!simeventsfile.is_open())
{
cout <<"Error: could not open simulator events file: "<< simf
ilename << endl;
exit(1);
}
while(!simeventsfile.eof())
{
simeventsfile >> command;
// Handle the next simulated event we just read from the
// simulation event file
if(command =="cpu")
{
42. cout <<" cpu: simulate a cpu cycle here"<< endl;
}
elseif(command =="new")
{
cout <<" new: simulate creation of new process here"<< e
ndl;
}
elseif(command =="done")
{
cout <<" done: simulate termination of currently running p
rocess here"<< endl;
}
elseif(command =="wait")
{
simeventsfile >> eventnum;
cout <<" wait: eventnum: "<< eventnum <<
" simulate event blocked and waiting"<< endl;
}
elseif(command =="event")
{
simeventsfile >> eventnum;
cout <<" event: eventnum: "<< eventnum <<
" simulate event occurring possibly making some processes read
y"<< endl;
}
elseif(command =="exit")
{
// we use an explicit indicator to ensure simulation exits correctl
y
break;
}
else
{
cout <<" ERROR: unknown command: "<< command << e
ndl;
exit(0);
43. }
}
simeventsfile.close();
}
/** Main entry point of simulator
* The main entry point of the process simulator. We simply se
t up
* and initialize the environment, then call the appropriate func
tion
* to begin the simulation. We expect a single command line ar
gument
* which is the name of the simulation event file to process.
*
* @param argc The argument count
* @param argv The command line argument values. We expect
argv[1] to be the
* name of a file in the current directory holding proces
s events
* to simulate.
*/
int main(int argc,char** argv)
{
int timeSliceQuantum =0;
// validate command line arguments
if(argc !=3)
{
cout <<"Error: expecting event file as first command line par
ameter and time slice quantum as second"<< endl;
cout <<"Usage: "<< argv[0]<<" simeventfile.sim time_slice"
<< endl;
exit(1);
}
44. // Assume second command line argument is the time slice quan
tum and parse it
timeSliceQuantum = atoi(argv[2]);
if(timeSliceQuantum <=0)
{
cout <<"Error: invalid time slice quantum received: "<< time
SliceQuantum << endl;
exit(1);
}
// Invoke the function to actually run the simulation
runSimulation(argv[1], timeSliceQuantum);
// if don't want to use command line do following.
// need to recompile by hand since file
// name to get simulated events from is hard coded
//runSimulation("simulation-01.sim", 5);
return0;
}
p2-start.c
/**
* @author Your Name Here
* @cwid 123 45 678
* @class CSci 430, Summer 2017
* @ide Visual Studio Express 2017
* @date June 11, 2017
* @assg Programming Assignment #2
*
* @description Implement a simulation of a basic 3 process
state system
* Ready, Running, Blocked. Simulation includes a round-
robin scheduler
45. * with time slice scheduling. Need to implement a basic
Process
* Control Block (PCB) in order to implement the round robin
scheduler.
* Program will also have ready queues, and possible queues
or other
* structures to keep track of blocked processes and the events
they
* are waiting on.
*
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
/** The process simulator.
* The main loop for running a simulation. We read simulation
* events from a file
*
* @param simfilename The name of the file (e.g. simulaiton-
01.sim) to open
* and read simulated event sequence from.
* @param timeSliceQuantum The value to be used for system
time slicing preemption
* for this simulation.
*/
void runSimulation(char* simfilename, int timeSliceQuantum)
{
FILE* simeventsfile;
char line[256]; // temporary buffer to hold the whole line we
read in
char* command;
char* eventnumstr;
int eventnum;
46. // open the simulation file, and make sure we were successful
// before continuing
simeventsfile = fopen(simfilename, "r");
if (!simeventsfile)
{
fprintf(stderr, "Error: could not open simulator events file:
%sn", simfilename);
exit(1);
}
while (fgets(line, sizeof(line), simeventsfile))
{
// get first token from line, up to first whitespace character,
put into command
command = strtok(line, " tn"); // splits line on space, tab or
newline
// Handle the next simulated event we just read from the
// simulation event file
if (strcmp(command, "cpu") == 0)
{
printf(" cpu: simulate a cpu cycle heren");
}
else if (strcmp(command, "new") == 0)
{
printf(" new: simulate creation of a new process heren");
}
else if (strcmp(command, "done") == 0)
{
printf(" done: simulate termination of currently running
process heren");
}
else if (strcmp(command, "wait") == 0)
{
eventnumstr = strtok(NULL, " tn"); // get pointer to event
number string
47. sscanf(eventnumstr, "%d", &eventnum);
printf(" wait: eventnum: %d simulate event blocked and
waitingn", eventnum);
}
else if (strcmp(command, "event") == 0)
{
eventnumstr = strtok(NULL, " tn"); // get pointer to event
number string
sscanf(eventnumstr, "%d", &eventnum);
printf(" event: eventnum: %d simulate event occurring
possibly making some processes readyn", eventnum);
}
else if (strcmp(command, "exit") == 0)
{
// we use an explicit indicator to ensure simulation exits
correctly
break;
}
else
{
fprintf(stderr, "Error: unknown command: %sn",
command);
exit(0);
}
}
fclose(simeventsfile);
}
/** Main entry point of simulator
* The main entry point of the process simulator. We simply
set up
* and initialize the environment, then call the appropriate
function
* to begin the simulation. We expect a single command line
48. argument
* which is the name of the simulation event file to process.
*
* @param argc The argument count
* @param argv The command line argument values. We expect
argv[1] to be the
* name of a file in the current directory holding
process events
* to simulate.
*/
int main(int argc, char** argv)
{
int timeSliceQuantum = 0;
// validate command line arguments
if (argc != 3)
{
printf("Error: expecting event file as first command line
parameter and time slice quantum as secondn");
printf("Usage: %s simeventfile.sim time_slicen", argv[0]);
exit(1);
}
// Assume second command line argument is the time slice
quantum and parse it
timeSliceQuantum = atoi(argv[2]);
if (timeSliceQuantum <= 0)
{
printf("Error: invalid time slice quantum received: %dn",
timeSliceQuantum);
exit(1);
}
// Invoke the function to actually run the simulation
runSimulation(argv[1], timeSliceQuantum);
49. // if don't want to use command line do following.
// need to recompile by hand since file
// name to get simulated events from is hard coded
//runSimulation("simulation-01.sim", 5);
return 0;
}
prog-02.pdf
Programming Assignment #2
CSci 430 Spring 2019
Dates:
Assigned: Monday February 4, 2019
Due: Wednesday February 20, 2019 (before Midnight)
Objectives:
� Explore the Process state models from an implementation
point of
view.
� Practice using basic queue data types and implementing in C.
� Use C/C++ data structures to implement a process control
block and
round robin scheduling queues.
� Learn about Process switching and multiprogramming
concepts.
50. Description:
In this assignment you will simulate a Three-State process
model (ready,
running and blocked) and a simple process control block
structure as dis-
cussed in Chapter 3. Your program will read input and
directives from a
�le. The input describes a time sequence of events that occur.
These are the
full set of events you will simulate:
1
Event Description
cpu The processor executes for 1 time step the currently running
process
new A new process is created and put at tail of the ready queue
done The currently running process has �nished
wait X The currently running process has done an I/O operation
and
is waiting on event X
event X Event X has occurred, the process waiting on that event
should
be made ready.
The input �le will simply be a list of events that occur in the
system, in
the order they are to occur. For example:
----- simulation-01.sim --------
52. cpu
cpu
exit
----------------------------------
Your task is to read in the events, and simulate the creation and
execution
of processes in the system as they move through the various
three-states of
their process life cycle. You need to:
2
� De�ne a simple process control block (PCB) to hold
information about
all processes currently running in your system. The PCB can be
a
simple C struct or a C++ class. At a minimum you need to have
a
�eld for the process identi�er and the process state (Ready,
Running or
Blocked). You need to also keep track of the time step that the
process
entered the system, and the number of steps the process has
been
running. Minimal credit will be given to programs that at least
handle
new events and create a process in a simulated PCB. You
probably
need a list or an array to hold the current processes that have
53. been
created and are being managed by your simulated system.
� You will need a ready queue of some kind. You should use a
C++
Standard Template Library (STL) container to manage your
ready
queue.
� You will need to implement a simple dispatcher function.
Whenever
a cpu event occurs, and no process is currently running, you
should
select the next Ready process from the head of your ready queue
and
start it running on the processor.
� You need to also implement a simple time slicing mechanism.
The
time slice value to use will be passed into your program when it
is
started. At the end of a cpu cycle, you should check if the
currently
running process has executed for its full time quantum. In that
case,
the currently running process should timeout, and be returned to
the
end of the Ready queue.
� new events should cause a new process to be created
(including creating
its PCB and �lling it in). New processes should be placed on
the tail
of the ready queue after being created. You should assign each
new
process a process identi�er. The process identi�er should be a
54. simple
integer value, and you should start numbering processes from 1.
� For a done event, if a process is currently running it should
then be
released. It should be removed from the CPU, and not placed
back on
the ready or blocked queue. If a done occurs when the CPU is
idle,
then nothing will happen as a result of this event.
� A wait event simulates the currently running process
performing some
I/O operation. If a wait occurs, the currently running process
should
become blocked and put on the blocked queue. You also need an
entry
in the PCB so you know what event the process is waiting for.
The
3
wait event is followed by an integer number, which is an
indication of
the type of event the process has requested.
� Likewise the event directive simulates the �nishing of some
I/O oper-
ation. When an event occurs, you should scan your blocked
processes
and make any process ready that was waiting on that event. The
in-
teger value following an event indicates the type of event that
just
55. occurred.
You have been given some example event sequences
(simulation-01.sim,
simulation-02.sim, etc.) along with the expected output for
those sequence
of events (simulation-01.res, simulation-02.res, etc.). The
output of your
program should be sent to standard output. The correct output
for the
simulation-01.sim simulation is:
Time: 1
CPU (currently running):
pid=1, state=RUNNING, start=1, slice=1,
Ready Queue:
EMPTY
Blocked Queue:
EMPTY
Time: 2
CPU (currently running):
pid=1, state=RUNNING, start=1, slice=2,
Ready Queue:
EMPTY
61. Blocked Queue:
EMPTY
Time: 15
CPU (currently running):
pid=2, state=RUNNING, start=4, slice=4,
Ready Queue:
EMPTY
Blocked Queue:
EMPTY
Your output to standard out should look exactly the same as this
output
(i.e. if I do a di� and your program is generating the correct
output, then
there will be no di�erence between the output your program
generates and
the above output format). The output is generated by displaying
the system
state after each cpu cycle executes. Basically we print out the
system time.
Then we show which process (if any) is currently running on the
CPU (or
say it is IDLE if no process is running). Then we display the
queue of
processes currently on the Ready and Blocked queues. Note that
the queues
are displayed in order. The top of the output corresponds to the
head of the
62. queue. Thus when a new process is dispatched, the next one
selected should
be the �rst process listed from the ready queue in the previous
system cycle.
I have given you some template code (p2-start.cpp) to get you
started
The code is meant to be run from the command line, thus from a
shell or
dos prompt you would do something like:
$ p2-start simulation-01.sim 5
i.e. the program expects two parameters on the command line,
which
should be the name of a �le that holds the events to be
simulated, and the
value to be used for the time slice quantum. If you need to test
your program
and can't �gure out how to invoke running it from the command
line, you
can change the line in 'p2-start.cpp' to explicitly run a particular
simulation
�le, like this:
runSimulation("simulation-01.sim", time_slice_quantum)
7
However, you need to make sure that your program correctly
works using
the command line invocation, as shown in `p2-start.cpp`.
I have given some template code to get you started in the �le
63. called
p2-start.cpp. I have already provided you with the code needed
in order to
correctly parse the command line parameters for the program,
and to open
and read in the simulation �le events. Your job is to implement
the necessary
actions and data structures to handle the simulated events
described. The
runSimulation() in 'p2-start.cpp holds example code and
indicates locations
where you need to write your own functions to implement the
simulation.
You can use this as a starting point to implement your solution.
Assignment Submission and Requirements
All source �les you create for you solution (.c or .cpp/.c++ and
.h header
�les) should be uploaded to the MyLeo Online submission
folder created for
this assignment by the deadline. You should not attach any �les
besides the
source �les containing your C/C++ code. But you should make
sure you
attach all needed �les you create to your submission, so that I
can compile
and run your solution.
You are required to write the program in standard C/C++
programming
language. You should use a relatively recent version of the
C/C++ compiler
(C90 C++98 is �ne, or the more recent C99 C++11 will also be
acceptable),
and/or recent IDE that has an up to date compiler. You should
64. only use
standard C/C++ libraries, do not use Microsoft speci �c or other
third-party
developed external libraries. This page
http://en.cppreference.com/w/
provides a good up to date reference of the libraries in the
standard C++ and
C languages. You may use the C++ standard template library
containers
(like the list and queue items) to implement the ready queue you
need. We
will go over a simple implementation of a queue using pointers
and/or arrays
in class, if you would like an example implementation in plain
C that might
be simpler to use than learning the STL.
8
http://en.cppreference.com/w/
simulation-01.sim
new
cpu
cpu
cpu
new
cpu
cpu
cpu
cpu
wait 1
cpu
cpu
event 1
cpu
68. wait 2
cpu
cpu
cpu
event 1
cpu
cpu
event 3
cpu
cpu
cpu
cpu
cpu
done
cpu
cpu
cpu
cpu
done
event 2
cpu
cpu
cpu
wait 1
cpu
cpu
cpu
cpu
cpu
done
cpu
done
event 1
cpu
cpu
done
72. cpu
cpu
cpu
cpu
wait 1
cpu
wait 1
cpu
wait 1
cpu
wait 1
cpu
wait 1
cpu
wait 1
cpu
wait 1
cpu
event 1
cpu
cpu
cpu
cpu
cpu
cpu
cpu
cpu
cpu
cpu
cpu
cpu
cpu
cpu
cpu
cpu
cpu