Question

For this discussion in your first post, provide answers to the following question: What would you...

For this discussion in your first post, provide answers to the following question:

  • What would you need to do to turn your program into an Object Orientated program?

You should write a detailed answer for the question including your reasoning and providing code and examples to support your statements. Make sure you defend your position. At the minimum you should describe your position and findings in at least three fully formed scholarly paragraphs that include what you did to research the question (you should have spent some reasonable time searching for an answer) and your answer to the question.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

IF YOU HAVE ANY DOUBTS COMMENT BELOW I WILL BE THERE TO HELP YOU

ANSWER:

EXPLANATION:

HERE I AM EXPLAINING EVERYTHING PLEASE RATE THUMBSUP

There are many paradigms that we can write our code into. There is Procedural, functional, object oriented, structural, imperative etc. Out of all this, the most used till now is Procedural and Object Oriented(Functional programming has been gaining popularity lately).

So, here we will talk about Object Oriented Programming and what we can do to refactor our program to an Object Oriented Program. As the name suggests, this programming paradigm is more focused onObjects rather than logic. An object is a real life entity that has some feature and also, method/function. OOPs has four main concepts: Abstraction, Encapsulation, Inheritance and Polymorphism.

Abstraction is the hiding of the complexity of the data and showing only the relevant details. You can use a fridge, but does it show how it functions from the inside? That's Abstraction.

Encapsulation is the wrapping up of data in a single unit. A picnic basket encapsulates and protects the food that is inside.

Inheritance is a way in which the child classes can use features and functions of the parent classes. Just like family hierarchy.

Polymorphism is the ability of an object to take many forms, or respond to the same message in different ways. Method overloading is an example.

Understand the fact that object oriented programming is more about binding the data and then using it. It increases modularity and organisation and helps in good and efficient use of objects when needed.

Now, when we turn a program into OOP, we need to make sure that it uses any of these concepts and also, follows classes and objects.

Here are some ways in which we can do it:

1) In case the program has structs, change them to classes. To use them, access them by making objects of classes(structs have similar concept of usage).

For eg: Let's take this program in C++, written with structs.

#include <iostream>

using namespace std;

struct Class1{

int data1;

float d1;

};

struct Class2{

int data2;

float f2;

};

int main(){

Class1 c1;

Class2 c2;

cout<<"Enter data 1:";

cin>>c1.data1;

cout<<"Enter data 2:";

cin>>c2.data2;

return 0;

}

Now, let us remake the same program with classes:

#include <iostream>

using namespace std;

class Class1{

public:

int data1;

float d1;

};

class Class2{

public:

int data2;

float f2;

};

int main(){

Class1 c1;

Class2 c2;

cout<<"Enter data 1:";

cin>>c1.data1;

cout<<"Enter data 2:";

cin>>c2.data2;

return 0;

}

2) Bind all similar data and functions into relatable/relevant classes. For example, in case there is a program for getting employee and student details, keep employee variables and functions in a single class and student variables and functions in another class. This will make the program modular and organized.

3) Try to implement the OOPs concepts.

4) Use access specifiers. There are three of them: public, private and protected. The default one is public.

RATE THUMBSUP PLEASE

Add a comment
Know the answer?
Add Answer to:
For this discussion in your first post, provide answers to the following question: What would you...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • In this discussion, post your answer to the question in this thread. Your post should be...

    In this discussion, post your answer to the question in this thread. Your post should be a minimum of 300 words. Be sure to read any follow-ups to your post and reply to any questions or requests for clarification. Also, post a reply to one of your classmates’ posts. Your required follow-up post to your classmate should be a minimum of 150 words. Thanks! For this Discussion, answer the following question. Distinguish between primary & secondary storage Compare hardware interfaces...

  • Question: This is a small discussion post please help this is discussion question What do you...

    Question: This is a small discussion post please help this is discussion question What do you think about t... this is a small discussion post please help this is discussion question What do you think about the “language acquistion device?” Do you think we learn to speak based on reinforcement or is there a neurological device? Most psycholinguistics today, would agree that it's a combination of both. Share your opinions as well as your experiences with children learning verbal behavior...

  • Be sure to address each of the following in your discussion post: Fifty years from now,...

    Be sure to address each of the following in your discussion post: Fifty years from now, will the family unit be weaker or stronger than it is today? What research and trends are you using for a scholarly basis of your opinion? Describe how peers and the media can influence socioemotional development? Describe how peers and the media can influence family relationships? What is your opinion of the current trends relating to social media and relationships? Reflect back on your...

  • What would be a scholarly definition for the term, public goods? Can you provide some source"s...

    What would be a scholarly definition for the term, public goods? Can you provide some source"s of public goods, possibly two examples? Can public goods be offered by the private sector? Public sector? How could you defend this or your  answer to the questions above?

  • (Must Post First) For your main Discussion post, describe at least two typical adjusting entries a...

    (Must Post First) For your main Discussion post, describe at least two typical adjusting entries a service-type business would need to record to bring account balances up-to-date. For your examples, one of the adjusting entries should be an accrual and another a deferral. You may use similar examples as those in your textbook and you may also research other typical adjusting entries for service-type companies. Be sure to address the following questions: • What are the purposes of each of...

  • Please answer the first two questions mplete your Week 2 required discussion prompt. • In your...

    Please answer the first two questions mplete your Week 2 required discussion prompt. • In your own words, describe the difference between euthanasia and physician-assisted suicide. • Select an argument for or against either euthanasia or physician-assisted suicide. How would you defend your argument? • In addition to your main response, you must also post substantive responses to at least two of your classmates' posts in this thread. Your response should include elements such as follow up questions, further exploration...

  • Discussion Question 1.2: what are the six attributes of a successful project? What do you think...

    Discussion Question 1.2: what are the six attributes of a successful project? What do you think about the CHAOS study’s definition of a successful project? Do you think there are better definitions of success besides meeting scope, time, and cost goals? Defend your position.

  • Could someone please help me with this discussion post. Thanks. For this week discussion you will...

    Could someone please help me with this discussion post. Thanks. For this week discussion you will be using http://www.barrons.com/public/page/bonds.html?mod=BOL_Nav_INV_hps Choose one company from the list of “Most Active Investment Grade Bonds” or “Most Active High Yield Bonds”. Do not choose from “Most Active Convertible Bonds” In your initial response you should answer the question: If you are an investor who is looking for a bond to invest to, are you going to buy a bond that you chose? You should...

  • 3.1 Discussion question Initial post due Wednesday, 2 replies by Sunday No unread replies. No replies....

    3.1 Discussion question Initial post due Wednesday, 2 replies by Sunday No unread replies. No replies. After reading about Classical Conditioning, Operant Conditioning and observational learning use the information to explain what you learned and how you can apply each of these principlesto the following situation.   Distracted driving is a serious problem on our roadways. After reading the chapter on Learning explain how you could use the information to change drivers' behavior. Give specific examples of how you might use...

  • Post your most burning question on this discussion board and link your question to a current...

    Post your most burning question on this discussion board and link your question to a current psychological perspective(s) that may serve in answering your question. Be sure to expand on why you chose the perspective(s) over others. For instance, have you ever wondered why you have the same mannerisms or reactions to situations that your mom or dad does, no matter how hard you tried to avoid it? You may consider reading more into the Behavior Genetics perspective to answer...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT