Free Essay

Sql Assignment

In:

Submitted By sungabe
Words 2277
Pages 10
SQL> select bdate,address 2 from employee 3 where fname='John' and minit='B' and lname='Smith';

BDATE ADDRESS
-------- ------------------------------
65/01/09 731 Fondren, Houston, TX

SQL> select fname,lname,address 2 from employee,department 3 where dname='Research' and 4 dnumber=dno;

FNAME LNAME ADDRESS
------------------------------ ------------------------------ ------------------------------
John Smith 731 Fondren, Houston, TX
Franklin Wong 638 Voss, Houton, TX
Ramesh Narayan 975 Fire Oak, Humble, TX
Joyco English 5631 Rice, Houston, TX

SQL> select pnumber,dnum,lname,address,bdate 2 from project,department,employee 3 where dnum=dnumber and Mgr_ssn=ssn and plocation='Stafford';

PNUMBER DNUM LNAME ADDRESS BDATE
---------- ---------- ------------------------------ ------------------------------ -------- 10 4 Wallace 291 Berry, Bellaire, TX 41/06/20 30 4 Wallace 291 Berry, Bellaire, TX 41/06/20

SQL> select fname, employee.lname, address 2 from employee, department 3 where department.dname='research' and department.dnumber=employee.dno;

선택된 레코드가 없습니다.

SQL> SELECT EMPLOYEE.Fname, EMPLOYEE.Lname, EMPLOYEE.Address 2 FROM EMPLOYEE, DEPARTMENT 3 WHERE DEPARTMENT.Dname='Research' AND DEPARTMENT.Dnumber=EMPLOYEE.Dno;

FNAME LNAME ADDRESS
------------------------------ ------------------------------ ------------------------------
John Smith 731 Fondren, Houston, TX
Franklin Wong 638 Voss, Houton, TX
Ramesh Narayan 975 Fire Oak, Humble, TX
Joyco English 5631 Rice, Houston, TX

SQL> select e.fname, e.lname, s.fname, s.lname 2 from employee e, employee s 3 where e.super_ssn = s.ssn;

FNAME LNAME FNAME LNAME
------------------------------ ------------------------------ ------------------------------ ------------------------------
Ramesh Narayan Franklin Wong
John Smith Franklin Wong
Joyco English Franklin Wong
Franklin Wong James Borg
Jennifer Wallace James Borg
Alicia Zelaya Jennifer Wallace
Ahmad Jabbar Jennifer Wallace

7 개의 행이 선택되었습니다.

SQL> SELECT E.Fname, E.LName, E.Address 2 FROM EMPLOYEE E, DEPARTMENT D 3 WHERE D.DName='Research' AND D.Dnumber=E.Dno;

FNAME LNAME ADDRESS
------------------------------ ------------------------------ ------------------------------
John Smith 731 Fondren, Houston, TX
Franklin Wong 638 Voss, Houton, TX
Ramesh Narayan 975 Fire Oak, Humble, TX
Joyco English 5631 Rice, Houston, TX

SQL> select ssn 2 from employee;

SSN
------------------
123456789
333445555
453453453
666884444
888665555
987654321
987987987
999887777

8 개의 행이 선택되었습니다.

SQL> select ssn,dname 2 from employee,department;

SSN DNAME
------------------ ------------------------------
123456789 Administration
333445555 Administration
453453453 Administration
666884444 Administration
888665555 Administration
987654321 Administration
987987987 Administration
999887777 Administration
123456789 Headquarters
333445555 Headquarters
453453453 Headquarters
666884444 Headquarters
888665555 Headquarters
987654321 Headquarters
987987987 Headquarters
999887777 Headquarters
123456789 Research
333445555 Research
453453453 Research
666884444 Research
888665555 Research
987654321 Research
987987987 Research
999887777 Research

24 개의 행이 선택되었습니다.

SQL> SELECT * FROM EMPLOYEE WHERE Dno=5;

FNAME MI LNAME SSN BDATE ADDRESS SE SALARY SUPER_SSN DNO
------------------------------ -- ------------------------------ ------------------ -------- ------------------------------------------------------------ -- ---------- ------------------ ----------
John B Smith 123456789 65/01/09 731 Fondren, Houston, TX M 30000 333445555 5
Franklin T Wong 333445555 55/12/08 638 Voss, Houton, TX M 40000 888665555 5
Ramesh K Narayan 666884444 62/09/15 975 Fire Oak, Humble, TX M 38000 333445555 5
Joyco A English 453453453 72/07/31 5631 Rice, Houston, TX F 25000 333445555 5

SQL> SELECT * 2 FROM EMPLOYEE, DEPARTMENT 3 WHERE Dname='Research' AND Dno=Dnumber;

FNAME MI LNAME SSN BDATE ADDRESS SE SALARY SUPER_SSN DNO DNAME DNUMBER MGR_SSN MGR_STAR
------------------------------ -- ------------------------------ ------------------ -------- ------------------------------------------------------------ -- ---------- ------------------ ---------- ------------------------------ ---------- ------------------ --------
John B Smith 123456789 65/01/09 731 Fondren, Houston, TX M 30000 333445555 5 Research 5 333445555 88/05/22
Franklin T Wong 333445555 55/12/08 638 Voss, Houton, TX M 40000 888665555 5 Research 5 333445555 88/05/22
Ramesh K Narayan 666884444 62/09/15 975 Fire Oak, Humble, TX M 38000 333445555 5 Research 5 333445555 88/05/22
Joyco A English 453453453 72/07/31 5631 Rice, Houston, TX F 25000 333445555 5 Research 5 333445555 88/05/22

SQL> SELECT * 2 FROM EMPLOYEE, DEPARTMENT;

FNAME MI LNAME SSN BDATE ADDRESS SE SALARY SUPER_SSN DNO DNAME DNUMBER MGR_SSN MGR_STAR
------------------------------ -- ------------------------------ ------------------ -------- ------------------------------------------------------------ -- ---------- ------------------ ---------- ------------------------------ ---------- ------------------ --------
John B Smith 123456789 65/01/09 731 Fondren, Houston, TX M 30000 333445555 5 Research 5 333445555 88/05/22
Franklin T Wong 333445555 55/12/08 638 Voss, Houton, TX M 40000 888665555 5 Research 5 333445555 88/05/22
Alicia J Zelaya 999887777 68/01/19 3321 Castle, Spring, TX F 25000 987654321 4 Research 5 333445555 88/05/22
Jennifer S Wallace 987654321 41/06/20 291 Berry, Bellaire, TX F 43000 888665555 4 Research 5 333445555 88/05/22
Ramesh K Narayan 666884444 62/09/15 975 Fire Oak, Humble, TX M 38000 333445555 5 Research 5 333445555 88/05/22
Joyco A English 453453453 72/07/31 5631 Rice, Houston, TX F 25000 333445555 5 Research 5 333445555 88/05/22
Ahmad V Jabbar 987987987 69/03/29 980 Dallas, Houston, TX M 25000 987654321 4 Research 5 333445555 88/05/22
James E Borg 888665555 37/11/10 450 Stone, Houston, TX M 55000 1 Research 5 333445555 88/05/22
John B Smith 123456789 65/01/09 731 Fondren, Houston, TX M 30000 333445555 5 Administration 4 987654321 95/01/01
Franklin T Wong 333445555 55/12/08 638 Voss, Houton, TX M 40000 888665555 5 Administration 4 987654321 95/01/01
Alicia J Zelaya 999887777 68/01/19 3321 Castle, Spring, TX F 25000 987654321 4 Administration 4 987654321 95/01/01
Jennifer S Wallace 987654321 41/06/20 291 Berry, Bellaire, TX F 43000 888665555 4 Administration 4 987654321 95/01/01
Ramesh K Narayan 666884444 62/09/15 975 Fire Oak, Humble, TX M 38000 333445555 5 Administration 4 987654321 95/01/01
Joyco A English 453453453 72/07/31 5631 Rice, Houston, TX F 25000 333445555 5 Administration 4 987654321 95/01/01
Ahmad V Jabbar 987987987 69/03/29 980 Dallas, Houston, TX M 25000 987654321 4 Administration 4 987654321 95/01/01
James E Borg 888665555 37/11/10 450 Stone, Houston, TX M 55000 1 Administration 4 987654321 95/01/01
John B Smith 123456789 65/01/09 731 Fondren, Houston, TX M 30000 333445555 5 Headquarters 1 888665555 81/06/19
Franklin T Wong 333445555 55/12/08 638 Voss, Houton, TX M 40000 888665555 5 Headquarters 1 888665555 81/06/19
Alicia J Zelaya 999887777 68/01/19 3321 Castle, Spring, TX F 25000 987654321 4 Headquarters 1 888665555 81/06/19
Jennifer S Wallace 987654321 41/06/20 291 Berry, Bellaire, TX F 43000 888665555 4 Headquarters 1 888665555 81/06/19
Ramesh K Narayan 666884444 62/09/15 975 Fire Oak, Humble, TX M 38000 333445555 5 Headquarters 1 888665555 81/06/19
Joyco A English 453453453 72/07/31 5631 Rice, Houston, TX F 25000 333445555 5 Headquarters 1 888665555 81/06/19
Ahmad V Jabbar 987987987 69/03/29 980 Dallas, Houston, TX M 25000 987654321 4 Headquarters 1 888665555 81/06/19
James E Borg 888665555 37/11/10 450 Stone, Houston, TX M 55000 1 Headquarters 1 888665555 81/06/19

24 개의 행이 선택되었습니다.

SQL> select all salary 2 from employee;

SALARY
----------
30000 40000 25000 43000 38000 25000 25000 55000

8 개의 행이 선택되었습니다.

SQL> SELECT DISTINCT Salary 2 FROM EMPLOYEE;

SALARY
----------
38000 43000 55000 30000 40000 25000

6 개의 행이 선택되었습니다.

SQL> (select distinct pnumber 2 from project,department,employee 3 where dnum=dnumber and mgr_ssn=ssn and lname='Smith') 4 union 5 (select pnumber 6 from project,works_on,employee 7 where pnumber=pno and essn=ssn and lname='Smith');

PNUMBER
----------
1 2

SQL> select fname,lname 2 from employee 3 where address like '%Houston, TX%';

FNAME LNAME
------------------------------ ------------------------------
John Smith
Joyco English
Ahmad Jabbar
James Borg

SQL> SELECT Fname, Lname 2 FROM EMPLOYEE 3 WHERE Bdate LIKE '_ _ 5 _ _ _ _ _ _ _';

선택된 레코드가 없습니다.

SQL> select fname,lname,1.1*salary as increased_sal 2 from employee,works_on,project 3 where ssn=essn and pno=pnumber and pname='ProductX';

FNAME LNAME INCREASED_SAL
------------------------------ ------------------------------ -------------
John Smith 33000
Joyco English 27500

SQL> select * 2 from employee 3 where dno=5 and (salary between 30000 and 40000);

FNAME MI LNAME SSN BDATE ADDRESS SE SALARY SUPER_SSN DNO
------------------------------ -- ------------------------------ ------------------ -------- ------------------------------------------------------------ -- ---------- ------------------ ----------
John B Smith 123456789 65/01/09 731 Fondren, Houston, TX M 30000 333445555 5
Franklin T Wong 333445555 55/12/08 638 Voss, Houton, TX M 40000 888665555 5
Ramesh K Narayan 666884444 62/09/15 975 Fire Oak, Humble, TX M 38000 333445555 5

SQL> select dname,lname,fname,pname 2 from department,employee,works_on,project 3 where dnumber=dno and ssn=essn and pno=pnumber 4 order by dname,lname,fname;

DNAME LNAME FNAME PNAME
------------------------------ ------------------------------ ------------------------------ ------------------------------
Administration Jabbar Ahmad Computerization
Administration Jabbar Ahmad Newbenefits
Administration Wallace Jennifer Reorganization
Administration Wallace Jennifer Newbenefits
Administration Zelaya Alicia Computerization
Administration Zelaya Alicia Newbenefits
Headquarters Borg James Reorganization
Research English Joyco ProductX
Research English Joyco ProductY
Research Narayan Ramesh ProductZ
Research Smith John ProductY
Research Smith John ProductX
Research Wong Franklin Computerization
Research Wong Franklin Reorganization
Research Wong Franklin ProductY
Research Wong Franklin ProductZ

16 개의 행이 선택되었습니다.

SQL> select fname,lname 2 from employee 3 where super_ssn is null;

FNAME LNAME
------------------------------ ------------------------------
James Borg

SQL> SELECT DISTINCT Pnumber 2 FROM PROJECT 3 WHERE Pnumber IN 4 (SELECT Pnumber 5 FROM PROJECT, DEPARTMENT, EMPLOYEE 6 WHERE Dnum=Dnumber AND 7 Mgr_ssn=Ssn AND Lname='Smith') 8 OR Pnumber IN 9 (SELECT Pno 10 FROM WORKS_ON, EMPLOYEE 11 WHERE Essn=Ssn AND Lname='Smith');

PNUMBER
----------
1 2

SQL> select e.fname,e.lname 2 from employee e 3 where e.ssn in (select essn 4 from dependent 5 where e.fname=dependent_name and e.sex=sex);

선택된 레코드가 없습니다.

SQL> SELECT E.Fname, E.Lname 2 FROM EMPLOYEE E, DEPENDENT D 3 WHERE E.Ssn=D.Essn AND E.Sex=D.Sex AND E.Fname=D.Dependent_name;

선택된 레코드가 없습니다.

SQL> SELECT E.Fname, E.Lname 2 FROM EMPLOYEE E 3 WHERE EXISTS (SELECT * FROM DEPENDENT D WHERE E.Ssn=D.Essn AND E.Sex=D.Sex AND E.Fname=D.Dependent_name);

선택된 레코드가 없습니다.

SQL> select fname,lname 2 from employee 3 where not exists (select * from dependent where ssn=essn);

FNAME LNAME
------------------------------ ------------------------------
Joyco English
Ramesh Narayan
James Borg
Ahmad Jabbar
Alicia Zelaya

SQL> select fname,lname 2 from employee 3 where exists (select * from department where ssn=mgr_ssn) and 4 exists (select * from dependent where ssn=essn);

FNAME LNAME
------------------------------ ------------------------------
Franklin Wong
Jennifer Wallace

SQL> SELECT Fname, Lname 2 FROM EMPLOYEE 3 WHERE NOT EXISTS (( 4 SELECT Pnumber 5 FROM PROJECT 6 WHERE Dnum=5) MINUS ( 7 SELECT Pno 8 FROM WORKS_ON 9 WHERE Ssn=Essn));

선택된 레코드가 없습니다.

SQL> SELECT Lname, Fname 2 FROM EMPLOYEE 3 WHERE NOT EXISTS (SELECT * 4 FROM WORKS_ON B 5 WHERE (B.Pno IN ( 6 SELECT Pnumber 7 FROM PROJECT 8 WHERE Dnum=5) AND NOT EXISTS ( 9 SELECT * 10 FROM WORKS_ON C 11 WHERE C.Essn=Ssn AND C.Pno=B.Pno)));

선택된 레코드가 없습니다.

SQL> select distinct essn 2 from works_on 3 where pno in (1,2,3);

ESSN
------------------
123456789
333445555
453453453
666884444

SQL> select e.lname employee_name, s.lname supervisor_name 2 from employee e, employee s 3 where e.super_ssn = s.ssn;

EMPLOYEE_NAME SUPERVISOR_NAME
------------------------------ ------------------------------
Narayan Wong
Smith Wong
English Wong
Wong Borg
Wallace Borg
Zelaya Wallace
Jabbar Wallace

7 개의 행이 선택되었습니다.

SQL> select fname, lname, address 2 from (employee join department on dno=dnumber) 3 where dname='research';

선택된 레코드가 없습니다.

SQL> select fname, lname, address 2 from employee natural join 3 (select dname, dnumber as dno, mgr_ssn as Mssn, mgr_start_date as msdate 4 from department) dept 5 where dname='research';

선택된 레코드가 없습니다.

SQL> select e.lname as employee_name, s.lname as supervisor_name 2 from (employee e left outer join employee s on e.super_ssn=S.Ssn);

EMPLOYEE_NAME SUPERVISOR_NAME
------------------------------ ------------------------------
English Wong
Narayan Wong
Smith Wong
Jabbar Wallace
Zelaya Wallace
Wallace Borg
Wong Borg
Borg

8 개의 행이 선택되었습니다.

SQL> SELECT Pnumber, Dnum, Lname, Address, Bdate 2 FROM ((PROJECT JOIN DEPARTMENT ON Dnum=Dnumber) 3 JOIN EMPLOYEE ON Mgr_ssn=Ssn) 4 WHERE Plocation='Stafford';

PNUMBER DNUM LNAME ADDRESS BDATE
---------- ---------- ------------------------------ ------------------------------------------------------------ -------- 10 4 Wallace 291 Berry, Bellaire, TX 41/06/20 30 4 Wallace 291 Berry, Bellaire, TX 41/06/20

SQL> SELECT E.Lname, S.Lname 2 FROM EMPLOYEE E, EMPLOYEE S 3 WHERE E.Super_ssn = E.Super_ssn + S.Ssn;

선택된 레코드가 없습니다.

SQL> select sum(salary),max(salary),min(salary),avg(salary) 2 from employee;

SUM(SALARY) MAX(SALARY) MIN(SALARY) AVG(SALARY)
----------- ----------- ----------- ----------- 281000 55000 25000 35125

SQL> select sum(salary),max(salary),min(salary),avg(salary) 2 from (employee JOIN department ON dno=dnumber) 3 where dname='Research';

SUM(SALARY) MAX(SALARY) MIN(SALARY) AVG(SALARY)
----------- ----------- ----------- ----------- 133000 40000 25000 33250

SQL> select count(*) 2 from employee;

COUNT(*)
----------
8

SQL> select count(*) 2 from employee,department 3 where dno=dnumber and dname='Research';

COUNT(*)
----------
4

SQL> select count(distinct salary) 2 from employee;

COUNT(DISTINCTSALARY)
---------------------
6

SQL> select lname,fname 2 from employee 3 where (select count(*) from dependent where ssn=essn) >=2;

LNAME FNAME
------------------------------ ------------------------------
Smith John
Wong Franklin

SQL> select dno,count(*),avg(salary) 2 from employee 3 group by dno;

DNO COUNT(*) AVG(SALARY)
---------- ---------- ----------- 1 1 55000 5 4 33250 4 3 31000

SQL> select pnumber,pname,count(*) 2 from project,works_on 3 where pnumber=pno 4 group by pnumber,pname;

PNUMBER PNAME COUNT(*)
---------- ------------------------------ ---------- 20 Reorganization 3 1 ProductX 2 10 Computerization 3 30 Newbenefits 3 2 ProductY 3 3 ProductZ 2

6 개의 행이 선택되었습니다.

SQL> select pnumber,pname,count(*) 2 from project,works_on 3 where pnumber=pno 4 group by pnumber,pname 5 having count(*)>2;

PNUMBER PNAME COUNT(*)
---------- ------------------------------ ---------- 20 Reorganization 3 10 Computerization 3 30 Newbenefits 3 2 ProductY 3

SQL> select pnumber,pname,count(*) 2 from project,works_on,employee 3 where pnumber=pno and ssn=essn and dno=5 4 group by pnumber,pname;

PNUMBER PNAME COUNT(*)
---------- ------------------------------ ---------- 20 Reorganization 1 1 ProductX 2 10 Computerization 1 2 ProductY 3 3 ProductZ 2

SQL> select dnumber,count(*) 2 from department,employee 3 where dnumber=dno and salary>40000 and 4 dno in (select dno from employee group by dno having count(*)>5) 5 group by dnumber;

선택된 레코드가 없습니다.

Similar Documents

Premium Essay

Assignment Week 1 Sql

...1. SQL (Structured Query Language) is a special-purpose programming language designed for managing data in a relational database management system (RDBMS). The scope of SQL includes data insert, query, update and delete, schema creation and modification, and data access control. The SQL standard has gone through a number of revisions: SQL-86, SQL-89, SQL-92, SQL: 1999, SQL: 2003, SQL: 2006, SQL: 2008, SQL: 2011. A few things I was able to find was language enhancements for temporal data definition and manipulation, time Period definitions, temporal primary keys, temporal referential integrity, Syntax for time-sliced and sequenced queries on system time tables. 2. Features for Microsoft SQL Server Express supports most of the features and functionality of SQL Server. The following list some of the major features and components that are supported. Stored Procedures, SQL Server Configuration Manager, Views, Replication (as a subscriber only), Triggers, Advanced Query Optimizer, Cursors, SMO/RMO, sqlcmd and osql utilities, Integration with Visual Studio 2005, Snapshot Isolation Levels, Service Broker (as a client only), Native XML support, including XQuery and XML Schemas, SQL CLR, Transact-SQL language support, Multiple Active Result Sets (MARS), Dedicated Administrator Connection, Import/Export Wizard. Although it does not come without its limitations like Maximum memory utilized by SQL Server Database Engine is 1GB, Maximum size of the each relational database is 10 GB, No SQL...

Words: 869 - Pages: 4

Premium Essay

Week 2 Assigment

...Week 2 Assignment: Understanding Effective Money Management Assessment A, Part 1: Creating a Personal Financial Statement - Assets | 1 point | Car: Bluebook value $1250.00Cash: $378.00Savings Accounts: $826.00 | Assessment A, Part 2: Creating a Personal Financial Statement - Debts | 1 point | Rent: $750.00Electric/ Gas bill: $131.75Cable/ internet/ Phone bill: $80.42Credit Card: $31.00Cell phone bill: $72.37 | Assessment A, Part 3: Identify Money Management Tool | 1 point | Explain to Monica how the money management tools were identified. | Students should explain how they evaluated various cash management products and services. | Assessment A, Part 4: Creating a Personal Financial Statement – Steps | 1 point | Drag the steps listed on the right into their correct sequences on the left. When done click the Send button | Step 1: I got all my financial stuff together – bills, loans, bank statements, etc. | Step 2: I balance my checkbook. | Step 3: I decided what were my assets and what were my debts. | Step 4: I enter my assets in the program. | Step 5: I enter my debts in the program. | Step 6: The program gave me a Net worth figure at the end. | Assessment B: Creating a Monthly Cash Flow Statement ...

Words: 255 - Pages: 2

Free Essay

Misconceptions of Algebra

...Diagnostic Algebra Assessment Definitions Categories Equality Symbol Misconception Graphing Misconception Definition Concept of a Variable Misconception Equality Symbol Misconception As algebra teachers, we all know how frustrating it can be to teach a particular concept and to have a percentage of our students not get it. We try different approaches and activities but to no avail. These students just do not seem to grasp the concept. Often, we blame the students for not trying hard enough. Worse yet, others blame us for not teaching students well enough. Students often learn the equality symbol misconception when they begin learning mathematics. Rather than understanding that the equal sign indicates equivalence between the expressions on the left side and the right side of an equation, students interpret the equal sign as meaning “do something” or the sign before the answer. This problem is exacerbated by many adults solving problems in the following way: 5 × 4 + 3 = ? 5 × 4 = 20 + 3 = 23 Students may also have difficulty understanding statements like 7 = 3 + 4 or 5 = 5, since these do not involve a problem on the left and an answer on the right. Falkner presented the following problem to 6th grade classes: 8 + 4 = [] + 5 All 145 students gave the answer of 12 or 17. It can be assumed that students got 12 since 8 + 4 = 12. The 17 may be from those who continued the problem: 12 + 5 = 17. Students with this misconception may also have difficulty with the idea that adding...

Words: 797 - Pages: 4

Free Essay

Prg/211 Calorie Count Tool

...Team B Calorie Count Tool PRG/211 May 5, 2014 Team B Calorie Count Tool PROBLEM STATEMENT Team B was asked to develop a program which would calculate the user’s daily intake of calories and measure those calories against the overall calories expended. The core purpose of this program will do two primary functions. First, it will record the user intake of calories as acquired through meals throughout the day. Second, the user will record caloric output associated with physical activity. This information will be calculated together to determine the caloric surplus or deficit for the user. In order for the program to execute accurately, and provide customized results, the user will be required to input personal data to include gender, age, weight, and height. This additional information is essential to determine the user’s default caloric burn rate, otherwise known as the basal metabolic rate (BMR). The BMR and the calories burned as a result of physical activity will be calculated against the intake of calories to determine the overall success for the user. As the program is executed it must: * Record user name, age, height, weight to enable more accurate calculations * Record the users specific caloric values entered for each meal * Record the user activity and caloric burn values for that activity * Calculate the basal metabolic rate (BMR) for the individual * Subtotal the total caloric values for the day * Combine the physical activity and...

Words: 1524 - Pages: 7

Premium Essay

Student

...Problem Solving with Computing Homework - WEEK 2 [30 points] This is a review of some of the material from Chapter 2 and lectures from class. No credit for answers that are copies or near verbatim transcripts – please use your own words1 and document sources where appropriate. 1 This will apply to all assignments in this class. Answer the following questions: Chapter 2 1. Short Answers [1 point each, 2 points total] 1. What does a professional programmer usually do first to gain an understanding of a problem? The first thing that a professional programmer usually do first to gain an understanding of a program is to closely relate customer (Interview ) to inquire or gather information about the problem. 2. What two things must you normally specify in a variable declaration? The two things normally specified in a variable declaration are the variable type and identifier. 2. Algorithms / Pseudocode [1 point each, 5 points total] 1. Design an algorithm that prompts the user to enter his or her height and stores the user’s input in a variable named height. Declare height Display “Enter Your Height” Input Height Display “Height” 2. Write assignment statements that perform the following operations with the variables a and b. - Adds 2 to a and stores the result in b. - Subtracts 8 from b and stores the result in a Set b=2+a Set a=b-8 3. Write a pseudocode statement that declares the variable cost so it can hold real numbers. Floating Point-Variable...

Words: 1823 - Pages: 8

Free Essay

Mobile Service Provider

...11108944 Name: ASHWINI KUMAR Roll No. : RE3R02B32 PART- A 1. Ans :- (a) unary and ternary operator Unary operator:- It pecedes an operand . The operand (the value on which the operator operates ) of the unary operator must have arithmetic or pointer type and the result is the value of the argument. Example:- If a=5 then +a means 5 If a=0 then +a means 0. If a=-4 then +a means -4. Ternary operator:- It precedes an operand. The operand of the unary operator must have arithmetic type and the result is the negation of the operand’s value. Example:- If a=5 then –a means -5 If a=0 then –a means 0 If a=-4 then –a means 4. (b) Assignment and equalto operator Assignment operator:- Equal to operator: An assignment operator assigns value In this we put the To a variable. value as it is. Example – Example- a*=5 means a=5*5. Int a; a=5 means a is initialized with 5 if(a==5) { return true; } return false; (c) Expression and statement Expression:- An expression is any valid combination of operators , constants , and variables. Example:- ...

Words: 399 - Pages: 2

Free Essay

Book Report

...Selection statements Selection is used to select which statements are to be performed next based on a condition being true or false. Relational expressions In the solution of many problems, different actions must be taken depending on the value of the data. The if statement in C I used to implement such s decision structure in its simplest form – that of selecting a statement to be executed only if a condition is satisfied. Syntax: if(condtion) statement executed if condition is true When an executing program encounters the if statement, the condition is evaluated to determine its numerical value, which is then interpreted as either true or false. If the condition evaluates to any non-0 value (positive or negative), the condition is considered as a “true” condition and the statement following the if is executed; otherwise this statement is not executed. Relational Operators In C Relational operator | Meaning | Example | < | Less than | age < 30 | > | Greater than | height > 6.2 | <= | Less than or equal to | taxable <= 200000 | >= | Greater than or equal to | temp >= 98.6 | == | Equal to | grade == 100 | != | Not equal to | number !=250 | In creating relational expressions, the relational operators must be typed exactly as given in the above table. Thus, although the following relational expressions are all valid: age > 40 length <= 50 temp >= 98.6 3 < 4 flag == done day != 5 The following are invalid: length =< 50 ...

Words: 1617 - Pages: 7

Free Essay

Study Habits

...STUDY HABITS OF SECOND YEAR BS-AVTECH STUDENTS OF PATTS COLLEGE OF AERONAUTICS S.Y 2013-2014 An Undergraduate Research Presented to The Languages Department of PATTS College of Aeronautics In Partial Fulfillment of the Requirements for the course ENGL 211 – Technical Report Writing By Guevarra, Giorgio Martin C Guevarra, Lorenzo Miguel Jang, Jose, Yosalina, Leo Xander March 2014 ACKNOWLEDGEMENT The researcher would like to express our thanks to the lord. Our God for his guidance towards everything we do In life, including this study that we had made, and for being an inspiration for us all to do our best in life. We give our thanks to Ms. Karen M. Millano, our adviser for ENGL 211, for carefully and patiently guiding us so that we may finish the thesis research, and for supporting us and believing in us, that we can accomplish our task finishing the thesis. To the respondents of this study, we express our gratitude because without them, this thesis research would not have been completed, we thank them for allowing us to conduct a survey during their spare time, and their patience and integrity in answering the survey. To our parents, for their support and everlasting patience and understanding for us. And lastly to our classmates, since they have been with us since the beginning of the semester and they had been our companions in everything we do for the subject ENGL 211. ABSTRACT STUDY HABITS OF...

Words: 413 - Pages: 2

Free Essay

Engeenering

...SCHOOL OF ENGINEERING YEAR 3 MECHATRONICS ASSIGNMENT LAB REPORT Reading an Analogue Voltage from a Potentiometer to turn a Motor on and off with reading of 40 Assignment 2 Owais Jahanzeb BENG Mechanical Engineering with buissness Lecturer: Dr. Tom Shenton Aim & Objectives The aim of this lab is to develop a functioning program for the PICDEM board to read an analogue signal from a potentiometer and turning a motor on or off if the signal exceeds a certain limit. The program should depict the function that it should turn the motor ON and OFF if the potentiometer reading is less than or equal to 40. The practical uses of such program can be seen in automotive , injection moulding machines, wood processing machines, modern temperature controlled plants, speed control torque operations. Developing Program 1 Figure 1. The schematic circuit & PICDEM board configuration for Program Figure 1. The schematic circuit & PICDEM board configuration for Program The objective of program is to read the correspondent voltage analogous to the potentiometer position and switch the motor on if the reading is over 40 and switch it off if the reading is less than or equal to 40, the value can be adjusted by twisting the screw clockwise and anticlockwise. The program works by implementing the following code. PIC program for Test of potentiometer with value less equal to 40 with comments: include <p16f917.inc> extern DisplayDigit1, DisplayDigit2...

Words: 427 - Pages: 2

Premium Essay

Andy Owes Bill a Debt.

...Law Written Assignment 3 Case Study 1 Parks, a 7-foot, 265-pound center for the San Diego Slick, objected when his contract was assigned from the ABC Corporation to the XYZ Corporation, the team’s new owner. The change of owners did not cause a change in the composition of the team although a new coach was hired. Parks’s compensation and his responsibilities remained the same. Was this contract assignable? Facts of the Case: 1) Parks contract was assigned from the ABC Corporation to XYZ Corporation. 2) Parks compensation and his responsibilities remained the same. Issues: 1) The reason why we are in court today is to identify if Park’s contract was assignable. Rules of the Law: 1) Personal Service Contract – The parties agree that a personal service contract may be assigned. This allows the trade of an athlete from one team to another team. 2) Notice of Assignment – Assignee is under a duty to notify the obligor that the assignment has been made and performance must be rendered to the assignee. 3) Anti-Assignment Clause – Prohibits the assignment of rights under the contract. 4) Approval Clause – requires that the obligor approves any assignment of contract. Analysis & Conclusion: Since we do not have all the facts we can assume the following: 1) Parks contract did include the Personal service contract. 2) Notice of assignment was made by XYZ Corporation. 3) Parks contract did NOT include Anti-Assignment Clause. ...

Words: 495 - Pages: 2

Free Essay

Management Accounting

...Management Accounting Individual Assignment 1. Variable manufacturing cost per unit = (323,000,000-160,000,000-24,000,000-100,000,000) 850,000 = $45.88 per unit Fixed manufacturing cost per unit = $100,000,000 850,000units = $117.65 per unit Total manufacturing cost per unit= 45.88+117.65 = $163.53per unit 2. Fixed overhead rate= $100,000,000 800,000units =$125 per unit Production volume variance= (850,000 X 125)-(800,000 X 125) =$106,250,000-$100,000,000 = $6,250,000 Favourable 3. Absorption costing. | $ | $ | SalesLess: Cost of goods soldOpening inventoryProduction(850,000 X (255+125))(-)Ending inventory(30,000 X 405)Gross MarginAdjustments for production variance(850,000-800,000)x125Operating Income | 0323,000,000(11,400,000) | 450,000,000(311,600,000) | | | | | | 138,400,0006,250,000F | | | 144,650,000 | Income Statement for the year ended 31December 2012 4. Variable Costing Income Statement for the year ended 31 December 2012 | $ | $ | SalesOpening inventoryProduction(850,000 X 255)(-)Ending inventoryContribution MarginFixed factory overheadOperating income | 0216,750,000(7650,000) | 450,000,000(209,100,000) | | | 240,900,000(100,000,000) | | | 140,900, 000 | 5. Based on the calculations of absorption costing and variable costing for the year 2012,it would be better to calculate and measure using the absorption costing...

Words: 288 - Pages: 2

Free Essay

Eopp

...Reflection assignment In this assignment I will be using the Gibbs Reflective Model, reference, to reflect on an incident that occurred in placement that demonstrates an understanding of the Outcome : 3.1: Demonstrate that they respect diversity and individual preferences and value differences, regardless of their own personal views. To do this I will first, briefly describe the event, supporting my outline with relevant information. I will then explore the event, and discuss why it is important and how it relates to the learning outcome. I will also be discussing why materials such as law and guidelines say this is important. I will then proceed to analyse the incident by breaking it down and picking out the main features of the experience, discussing why they are important, whilst linking the main points together. I will attempt to think about opposing arguments to what I have explored, and discuss the advantages and disadvantages of the arguments. Finally I will be using SMART goals, to create an action plan for future development. Explain incident with evidence Whilst on a shift, we had an elderly patient arrive on the ward. The patient suffered from a Frank Haematuria, Colovesciular fistula as well as incontinence. It was suggested that the patient received surgery to have this corrected, but the patient refused surgery, stating that at his age he did not want to go through with it, and wanted to put a DNAR in place. I along with the other nurses respected his choice...

Words: 370 - Pages: 2

Premium Essay

Sfds

...ASSIGNMENT - 3 Answers 1 Answer 2 Answer 3 4. For what types of workloads does SJF deliver the same turnaround times as FIFO? ANSWER: - In the above case if the jobs are same in size or the jobs periodically applied (i.e. first shortest job then later second shortest job and continues) then the turnaround time of SJF is same as FIFO. 5. For what types of workloads and quantum lengths does SJF deliver the same response times as RR? ANSWER: - The response time delivered by SJF is equal to the response time of RR but this happens only when all the jobs arrived are at the point when the planning quantum of RR is bigger than the bigger occupation to be administrations in order of increasing size. 6. What happens to response time with SJF as job lengths increase? Can you use the simulator to demonstrate the trend? ANSWER: - If you suppose the length of the job increases then average response time varies (increases).If every job is sorted in increasing job order than the last job response time will be equal to the sum of current job and previous (n-1) jobs. In this way if the size of the job increases the response time will also increases for all larger jobs. 7. What happens to response time with RR as quantum lengths increase? Can you write an equation that gives the worst-case response time, given N jobs? ANSWER: - In the case of RR, the response time increases as the quantum lengths increases. This happens because the waiting time of a process for its turn to...

Words: 286 - Pages: 2

Free Essay

Week 5 Assignment

...Janell Taylor 10/23/12 Implicit Test I found the test to be very interesting and I don’t like timed tests because I need time to think about my answer to be sure and confident about my choice. I don’t agree with the results because they said I made too many errors and I don’t understand that because that was just one part where I was making too many errors. It has helped me out in those areas of different topics, but I just wish I had more time. I guess I would say that the answers wasn’t valid enough for me because it didn’t really give me a score because I made too many errors, so I don’t agree with that too much. I believe prejudice is difficult to measure because I don’t agree with it and don’t like the fact that it’s very big and can get worse if we don’t come together to get in one accord to help each other and make the world better to live in dealing with different people and feelings. I think measuring prejudice can be a tough thing to deal with and handle because of the many people that are prejudice, which are hurting and harming many situations and people that’s trying to make it while being equal to everyone regardless of what. I would have to take the test over to get a better score because I felt that wasn’t fair because I made too many errors to get a...

Words: 252 - Pages: 2

Free Essay

Pay for Eprformance

...Pre course assignment 2: Performance Related Pay The assignment is to write a paper about Performance Related Pay (2000 words) Performance Related Pay is receiving a great deal of attention. On the one hand (collective) labour agreements are increasingly including arrangements that relate to pay-forperformance, at the same time there is also strong resistance. Trade unions have never been enthusiastic proponents subject to certain conditions, but opinions are also divided in employers' circles. Pay-for-performance is even named as a root cause for the crisis of the financial sector and for the collapse of some companies. A number of companies have recently announced that they will abolish or change their pay- for-performance systems. When organizations have performance related pay systems in place, (front line) managers usually play an important role. They make pay decisions, or provide information for these decisions. The paper is also a preparation for a class debate about pay for performance in the fourth lecture. The debate will be about the statement: “The introduction of individual pay for performance contributes to an improvement in a company's (financial) performance” The paper will be written from one of three starting points: 1. You are against the statement: all arguments you discuss should underpin that the statement is false 2. You are in favour of the statement: all arguments you bring forward should underpin that the statements is true 3. You are undecided: find...

Words: 453 - Pages: 2