MCSL-25 Lab Course – 2008

  JHARKHAND BOARD You are here
Course Code : MCSL-025

Course Title : Lab Course

Assignment Number : MCA(2)/025/Assign/08

Maximum Marks : 100

Weightage : 25%

Last Dates for Submission : 31st October, 2008 ( for July,08 session)

30th April, 2009 (for Jan, 09 session) This assignment has four parts. Answer all questions of each part. Each part is of 10

marks. Lab Records of each part will carry 10 Marks. Rest 20 marks are for viva

voce. You may use illustrations and diagrams to enhance the explanations. Please

go through the guidelines regarding assignments given in the Programme Guide for

the format of presentation.

PART-I: MCS-021 Companies and people often buy and sell stocks. Often they buy the same stock for different

prices at different times. For example a person owns 1000 shares a certain stock (such as

Reliance), s/he may have bought the stock in amounts of 100 shares over 10 different times with

10 different prices.

We will analyze two different methods of accounting -- FIFO and LIFO accounting used for

determining the “cost” of a stock. This information is typically calculated when a stock is sold to

determined if a profit / loss was made.

In our version of FIFO accounting, the price of a commodity is averaged starting with the first

purchase of that item. Say, we sell 250 shares of a stock, according to this method; the purchase

price is determined by averaging the prices on the first 250 shares bought.

In our version of LIFO accounting, the price of a commodity is averaged starting with the last

purchase of that item. Say we sell 250 shares of a stock, according to this method; the purchase

price is determined by averaging the prices on the last 250 shares bought.

In this lab assignment, you will be using a queue for storing data for FIFO accounting, and a stack

for LIFO accounting. You should use an array based implementation for your stack and a linked

list for implementing your queue.

Both your stack and queue should have records with the following fields:

• The name of the stock (a string or int)

• The number of shares of a stock (an int)

• The purchase price (can be a decimal)

You can assume that the first element of the structure is the security bought first, the second was

bought second, etc.

Your program should have the user able to enter information about various stocks, the amount of

shares, and the price. The user can then enter a query about a certain stock and the cost according

to the LIFO and FIFO accounting methods for a certain number of shares.

The following could be your menu:

Press 1 to enter a new stock

Press 2 to find the LIFO and FIFO price for a stock.

If 1 is pressed, the user needs to enter the stock symbol, and the number of shares, and the price.

If 2 is pressed, the user needs to enter the stock symbol being queried and the number of shares in

question.

Note: You must execute the program and submit the program logic, sample inputs and outputs

along with the necessary documentation for this question. Assumptions can be made wherever

necessary.

PART-II: MCS-022 Question 1:

Write a shell script to compute factorial for a given number n. (2 Marks)

Question 2:

(i) Connect and configure your computer with a local network printer. (2 Marks)

(ii) How would you set the IP address of a LAN card in Linux? (2 Marks)

Question 3:

(i) Enable and configure IPSec Policy on a local computer. (2 Marks)

(ii) Configure Windows 2000 client to use DHCP, DNS and WINS. (2 Marks)

PART-III: MCS-023 Question 1:

Below given is a database underlying the operations of a XYZ company that manages multiple

automobile dealerships throughout the United States.

The following are the data requirements of the company:

• A car is described by a vehicle identification number (VIN), make (Example: Toyota),

model (Example: Prius), year, mileage, and two prices: the asking price (how much the

dealership would like to sell the car for) and the invoice price (how much the dealership

paid for the car). This information is maintained for every car currently in any

dealership's inventory, and also for every car that has ever been sold by one of the

dealerships.

• A dealership is a single location where the company sells cars. The company manages

many dealerships, each one being described by a unique dealership ID, a name (Example:

Irvine Toyota Sales), street address, city, and state.

• The company employs a number of salespeople. Each salesperson is assigned a unique

salesperson ID.

• Salespeople work at one or more dealerships each month, and are paid a monthly base

salary at each, regardless of how many cars they sell. Additionally, they are paid a

commission on each car they sell.

• Information is maintained about all salespeople who ever worked for any dealership.

• The following information is kept about each customer: Social Security Number

(necessary for the purposes of performing a credit check), name, street address, city, and

state.

• Salespeople are arranged in a strict hierarchy, with each salesperson reporting to a

“managing salesperson”.

• It is necessary to keep track of the inventory of cars currently available at each

dealership. Of course, a particular car can only be in the inventory of one dealership at

any given time.

• A long-term record of all car sales is maintained. For each sale, the company tracks what

car was bought, what customer bought it, what salesperson sold it, what dealership it was

sold by, what price it was sold for, and what date it was sold. (It is assumed that no car

will ever be sold by the company more than once, though this is a possibility in a real car

dealership.)

Keeping in mind the data requirements described above, create the database as shown below,

with the attributes making up the primary key of each relation underlined.

car(vin, make, model, year, mileage, asking_price, invoice_price)

dealership(dealership_id, dealership_name, dealership_street_address, dealership_city,

dealership_state)

salesperson(salesperson_id, salesperson_name)

customer(social_security_number, customer_name, customer_street_address, customer_city,

customer_state)

reports_to(salesperson_id, managing_salesperson_id)

works_at(salesperson_id, dealership_id, month_worked, base_salary_for_month)

inventory(vin, dealership_id)

sale(vin, social_security_number, salesperson_id, dealership_id, sale_price, sale_date)

Add some meaningful data for each of the tables of the database created. Write and run the SQL statements for each of the following:

i. Find the names of all salespeople who have ever worked for the company at any

dealership.

ii. Find the names of all salespeople who are managed by a salesperson named “Joe

Jones”.

iii. List the VIN, make, model, year, and mileage of all cars in the inventory of the

dealership named “Irvine Toyota Sales”.

iv. List the VIN, year, and mileage of all Toyota Camrys in the inventory of the

dealership named “Irvine Toyota Sales”. (Note that a Toyota Camry is indicated by

the make being “Toyota” and the model being “Camry”).

v. Find the name and Social Security Number of all customers who bought a car at a

dealership located in a state other than the state in which they live.

vi. Find the names of all salespeople who do not have a manager.

vii. Find the name of the salesperson that made the largest base salary working at the

dealership named "Irvine Toyota Sales" during January 2008.

viii. Find the salesperson ID and name of all salespeople who have worked at each one of

the company's dealerships at some point in time.

ix. List the name, salesperson ID, and total sales amount for each salesperson who has

ever sold at least one car. The total sales amount for a salesperson is the sum of the

sale prices of all cars ever sold by that salesperson.

x. Find the name and salesperson ID of the salesperson who sold the most cars for the

company at dealerships located in California between April1, 2007 and March 31,

2008.

PART-IV: MCS-024

Question 1:

(i) Write a Java program to demonstrate how Exceptions are handled in Java. (2 Marks)

(ii) Write a Java program, which create variable size array in Java. (1 Mark)

Question 2:

(i) Write a Java to demonstrate the advantage of Inheritance in Object Oriented

Programming. (2 Marks)

(ii) Write a Java program to check whether a given thread is alive or not. (1 Mark)

Question 3:

(i) Write a java program to check whether a given file is existing or not and if the file is not

existing create a file of that name. (2 Marks)

(ii) Create an Applet program, which takes keeps different GUI components in

BorderLayout. (2 Marks)

Note: You must execute the program and submit the program logic, sample inputs and outputs

along with the necessary documentation for this question. Assumptions can be made wherever

necessary.