JustAnswer > Programming
Ask A Question|Register|Login|Help
JustAnswer

Programming

Ask a Programming Question, Get an Answer ASAP!

Have your own Programming question?

Programmers are Online Now
characters left:
Not a Programming Question?

Related Programming Topics:

  • Hot
  • ,
  • Two
  • ,
  • Back
  • ,
  • Code
  • ,
  • Form
  • ,
  • Stop
  • ,
  • Time
  • ,
  • Work
  • ,
  • Basic
  • ,
  • Power
Bookmark and Share

Question

Can you give me an example of a short, structured design (pseudocode only) of a task such as walking your dog, or doing the dishes? In addition, I need to Identify how I can encapsulate the data and processes that were identifed into an object-oriented design.

Submitted: 254 days and 18 hours ago.
Category: Programming
Value: $40
Status: CLOSED
+
Read More

Optional Information

OS: Windows XP; Browser: IE

Posted by ehabtutor 254 days and 18 hours ago.

Info Request

Hi XXXXXXX,

 

welcome back

 

Do you need this for a specific example or i can choose any?

 

 

254 days and 18 hours ago.

Reply

It can be any task that is performed on a regular basis.

Posted by ehabtutor 254 days and 18 hours ago.

Info Request

ok i will work on it and provide you with the answer ASAP

254 days and 18 hours ago.

Reply

Thanks, just so you know I don't need it until tomorrow. If you need more time.

Posted by ehabtutor 254 days and 17 hours ago.

Info Request

ok

Accepted Answer

Well pseudocodes are nothing both the initial phase of developing your program.
It helps you figure the basic logic required in creating this code.
It's a great practise and the outcome is a simplified way of looking at a program/software creation.
As the name suggests, pseudocode generally does not actually obey the syntax rules of any particular language; there is no systematic standard form.
Below is an example as to how a pseudocode is created.
This pseudo code specifies how to make tea.

1. Program: make tea
2. Heat water
3. Warm teapot
4. Put tea in teapot
5. Fill teapot with hot water
6. Leave to stand
7. Pour tea

Making tea: more detail
1. Program: make tea
2. Heat water
1. Fill electric kettle
2. Switch on power
3. Wait until water boils
3. Warm teapot
1. Pour small amount of water from kettle into teapot
2. Wait 1 minute
3. Empty teapot
4. Put two teabags in teapot
5. Fill teapot with hot water
6. Leave to stand for 2 minutes
7. Pour tea


as i previously mentioned that it does not require a specific syntax to be followed.
Pseudocodes are basically used to make programmers understand the very concepts to be used.
Once this pseudocode is made u can easily script this code in any given language.
Hence pseudocodes are universal.

Below i'm providing u very simple mathematical functions that are implemented using pseudocodes:

1:Taking the sum of consecutive nos (Read nos 1 to n and find their sum...1+2+3+...+n)

start
Read n;
initialize sum to 0;
Initialize i to 1;
while(i<=n)do:
   increase sum by i;
   increment i;
end while
write sum;
stop


When it comes to oop(Object Oriented Programming) inorder to encapsulate ur data and processes u need to create objects.
When we say that it contains data and processes we mean that it contains variables and methods/functions (all in technical terms).

Encapsulation is the hiding of the internal mechanisms that is it provides only the essential data without making u deal with the intracacy of it.

The purpose is to achieve potential for change: the internal mechanisms of the component can be improved without impact on other components
   
I'll provide u a simple snippet that gives u an idea as to how are we supposed to create encapsulated data and access it later.

Class Calc_area
{
public:
void area_square(int side); //your processes or methods
void area_triangle(int length, int breadth, int height);
private:
int side;                  //data
int length;
int breadth;
int height;
};

Calc_area::area_square(int side)
{
int area ;
area = side*side;
cout << "the area of the square is :" << area;
}

Calc_area::area_triangle(int length, int breadth, int height)
{
int area ;
area = length*breadth*height;
cout << "the area of the triangle is :" << area;
}


void main()
{
Calc_area o1;              //creating objects
o1.area_triangle(2, 3, 4);
o1.area_square(3);
}



This is just a very simple program which demonstrates the use of objects which are of prime significance.

If u think that the explanation for encapsulation is still not sufficient pls let me know. i'll provide u with more details.


All the above answers have been provided with a good amount of RnD...
Hope u r satisfied with all that is provided to you.


Picture
Expert: Sabertooth
Pos. Feedback: 100.0 %
Accepts: 
Answered: 3/13/2009

Computer Software Engineer

Have knowledge on server side scripts including PHP, Shell & PERL, Knowledge on Linux Administration

+
Read More

Related Programming Questions

  • Is it possible to fill an excel spreadsheet by importing the
  • Is there a faormual to count the total number of entries be...
  • I need help writing a program that calculates gpa. it has to
  • I need help completing the following IF statement: IF(E2>...
  • Offer increased: In the same folder I have an Excel Workbook...
  • I'm pulling data from PLC to excel cell with =ABTCP|ABPLC1!'...
  • well my java was working fine all of suden i can't get in
  • I need some help with VBA in a MS Word document. The docment



Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.
Question List | Become an Expert | Terms of Service | Security & Privacy | About Us
© 2003-2009 JustAnswer Corp.