Thursday , 21 November 2024

CS508 Assignment no 4 fall 2012

 Modern Programming Languages (CS508)

Assignment No. 4 

Total Marks: 20                                                                   Dead line: 15th January, 2013

 

Purpose of Assignment:


Intended purpose of this assignment is to give students an exercise that can facilitate them while working  in  any  professional  software  development  environments.  After  attempting  this assignment students will be able to:

•   Familiarize with the core concepts of a declarative programming language ‘Prolog’ and object oriented language ‘Java’.

•   Learn basic syntax of both languages.

•   Students  will  get  comprehensive  understanding  of  important  concepts  of  Prolog (Inference mechanism, facts, rules and queries) and Java (Arrays).

Application:

IdevSpot-Solutions for Software Companies IdevSpot  provides  a  range  of  innovative  and  reliable  e Business  software  for companies intending to start their own online business and earn profits by offering membership services.

IdevSpot is specifically designed for software markets, It’s scalable and integrated solution includes a full-featured, modular and secure eCommerce platform, a partner order and revenue management system, as well as a constantly expanding worldwide affiliate network.

IdevSpot market-proven eCommerce solution enables software companies to rapidly embrace industry shifts, reach customers effectively, and adopt new business models with a view to optimizing profitable revenue across online and offline channels.

 Scenario:

IdevSpot-RoadWeather-Application

IdevSpot-RoadWeather is a  24-hour weather prediction system for snow and ice control on highways. RoadWeather Pro consists of four components.

1.  The first component is a numerical weather prediction system that forecasts from specified initial (radio sound and surface observations) and boundary conditions (detailed terrain effects) using a system of hydrodynamic and thermodynamic differential equations. This part of the system is written in FORTAN.

2.  The second component is a graphical user interface (GUI) written in Prolog, which the developers say is fully interactive and displays predicted weather phenomena as symbolic objects.

3.  The third component is an Expert Weather Advisor, written in Prolog, which permits mouse  point  and  click  manipulation  of  weather  “objects”  thereby  allowing  forecast upgrades based of recent observational data received from sensors or human observers.

4.  The final component is an Expert GIS system, written in Java, which detects the presence of rain or snow from an image. Based on their physical properties and the type of visual effects they produce, weather conditions can be identified.

Evaluation:

Suppose you received the following observational data about weather.

ƒ    It’s raining in Islamabad.

ƒ    It’s raining in Sturt.
ƒ    It’s raining in Newell.
ƒ    It’s raining in Mansehra.
ƒ    It’s raining in Peshawar.
ƒ    It’s cold in Strut.

ƒ    It’s cold in Newell.

ƒ    It’s cold in Mansehra.
ƒ    It’s cold in Quetta.
ƒ    It’s cold in Chaman.
ƒ    It’s cold in Karakoram.

ƒ    It’s sunny in Quetta.

ƒ    It’s sunny in Larsi.
ƒ    It’s sunny in Chaman.
ƒ    It’s sunny in Multan.

1.  Now being a prolog programmer answer the following questions:

A. Write the prolog rules for the followings.                                                                 [5]

a.  If it’s raining and cold then it’s snowy.

b.  If it’s cold and sunny then it’s pleasant.

c.  If it’s only sunny then it’s hot.

d.  If it’s raining and sunny it’s rainbow.

e.  If it’s raining only it’s lovely.

 

B.  Write the prolog queries for the followings. These queries will be executed according to the facts and rules defined for the above given data and perform all steps to write the output of the given queries.   [10]

a.  Is it snowy in Y?

b.  Is it pleasant in X?

c.  Is it hot in Z?

d.  Is it raining in Islamabad?

e.  Is it sunny in Larsi?

f.  Is it cold in W?

Note: In queries where variables are used along with answer write all the possible matches either they are true or not.

2.  Considering yourself as a Java programmer who is working on fourth component of this application, write a small program in Java that copies contents from data array into result array without using loops or conditionals. It should start copying from position 4 of data array into result array.                [5]


Hint:

a.  Use proper API function available in Java to perform this operation.

b.  Data array is of length 9

c.  Starting position in result array is 0

d.  Result array is of length 5

Uploading Instructions:

•   Your assignment must be in MS Word format.

•   Use this compiler http://ideone.com/ , to compile your code section.

•   Paste screen shot of your compiled code after the code.

•   No assignment will be accepted through email.

Rules for Marking:

It should be clear that your assignment will not get any credit if:

•   The assignment is submitted after due date.

•   The submitted assignment does not open or file is corrupted.

•   Your assignment is copied from internet, or from any other student (Strict disciplinary action will be taken in this case).

Note:

•   You should consult recommended books to clarify your concepts.

•   It’s better for you to submit the assignment well before the deadline.

•   If you have any query about assignment then email at cs508@vu.edu.pk.

Check Also

CS508 Assignment no 03 fall 2013 idea Solution

  Assignment No. 03 Semester: Fall 2013 Modern Programming Languages  (CS508)  Total Marks: 15   …

Leave a Reply

Your email address will not be published. Required fields are marked *

*