Question

In: Computer Science

Create a new post where you provide guidance on Java installation and discuss the concepts and...

Create a new post where you provide guidance on Java installation and discuss the concepts and features of the object-oriented design principles.

Solutions

Expert Solution

Since it is question and answer portal, so java installation and object oriented designs and principles are explained below:-

JAVA INSTALLATION

  1. Initially download JDK (Java Development Kit) installer from oracle website. Prefer to download 8 or above version of JDK for required operating system.
  2. If your pc has an older version of JRE or JDK then first uninstall it by navigating to control panel -> Program and Features -> Java SE
  3. After downloading JDK installer (for windows .exe file), run .exe file to install JDK
  4. Click on Next.
  5. Select destination folder where Java must be installed. By default it is in C:\Program Files\Java. Prefer not to change this location.
  6. Once installation is complete click on Close.
  7. After JDK is installed, environment variable is set.
  8. Path variable is used to give the location of executables like java , javac for executing java program.
  9. Right click on My Computer
  10. Select properties.
  11. Click on Advanced System Properties -> Environment Variables
  12. For windows 10, edit PATH variable and new value. For below versions, edit and separate value with semicolon.
  13. For variable value navigate to bin folder of currently installed JDK. For default location, C:\Program Files\Java\jdk1.8.0_261 (or other version which was installed)\bin. Copy and paste this path location as value of path variable.
  14. Click on OK button.
  15. Navigate to command prompt and type javac.
  16. If able to see list of different possible options then java is installed and is running successfully.
  17. Now install required IDE i.e. Eclipse, Netbeans etc. as per the requirement. Provide appropriate path for its workspace where you want to save all java projects.

OBJECT ORIENTED DESIGN

Object oriented design is used to overcome drawbacks of procedural programming approach. Before this approach, all programs and principles were not close to real world applications.

In this approach, we define a state and its behaviour. Taking an example of real world, mobile phones is a state and it has different behaviours. Customers are only interested with its features, applications and handy look. They are not interested with the working of its internal softwares or hardwares used inside it. So in mobile phones, customers has access to few functionalities or behaviours, rest others are hidden from them.

In similar manner, we can use object oriented programming to achieve this task easily. State i.e. mobile phone is taken as a class which has different objects i.e. mobile phone which a particular customer is using. Now class will have different behaviours i.e. data attributes and methods. Now each instance of this class can only access only few behvaiours from all behaviours defined in the class.

Different principles of object oriented programming is as follows:-

ENCAPSULATION :-

It is a mechanism of wrapping data attributes and methods in a class. Each class can have some variables known as data attributes and functions known as methods to provide all relevant behaviours for that class.

Example :-

class MobilePhones {

    private : 
      int number;
      char brand[100];
      char processor[100];
      char storage[100];

    public :
       void powerON();
       void powerOFF();
       void openApp(char appName[100]);
       void install(char appName[100]);
       void openApp(char appName[100]);

}

INHERITANCE:-

It is a mechanism where one class can inherit few properties from a class and can change its implementation as per its own requirement. For Example, if car is a class then it has the functionality that every car will have 4 wheels, will drive and have sitting space. But each model of car will have different appearance, mileage, price etc. Still those different models will have all functionalities of car. So these all models will inherit all properties from parent class and will then change if required or will add there own new functionalities or behaviour.

class Parent {

  public : 
    void fun();

}

// Child class that is inheriting parent class
class Child : public Parent {

}

ABSTRACTION:-

It is a mechanism of showing only essential or relevant details to user and ignoring the explanation or irrelevant details from them. It is used to reduce the complexity of program. It helps to provide only the behaviour of a particular state and separates its explanation so that code is understoodable and is less complex.

In java, Abstract Classes are used to implement this principle. In abstract classes, it can have abstract methods. Abstract methods only has the function declaration and defination is provided by child classes i.e. which has inherited this class. So its explanation is provided in other class and abstract class will only have name of all relevant behaviours required.

DATA HIDING :-

It means to hide data from some part of component. It is used to achieve encapsulation i.e. private data is not accessible outside class or objects of that class. It is used to achieve the functionality that few behaviour is hidden and few is only accessible to user.

POLYMORPHISM :-

It is the mechanism to process same functionality or task in different ways as per its usage. For Example:- sum method is used to add 2 numbers and also to add 3 number. So the name of functionality is same i.e. sum but is performing different operations.

class adding {

   public :
     void sum(int a, int b) {
       return a+b;
     }

     void sum(int a, int b, int c) {
       return a+b+c;
     }

}

Related Solutions

Discuss the nature of new drug development that may necessitate specific accounting guidance, explaining where clarity...
Discuss the nature of new drug development that may necessitate specific accounting guidance, explaining where clarity is most needed.
where can you create a new payroll schedule?
where can you create a new payroll schedule?
9) Create a java programming where you will enter two numbers and create only one method,...
9) Create a java programming where you will enter two numbers and create only one method, which will return or display addition, substraction, multiplication, division, average and check which number is greater than the other. Everything in one method and call it in main method.
JAVA Program: You are a developer for a company that wants to create a new payroll...
JAVA Program: You are a developer for a company that wants to create a new payroll system. Write a program that can be used to calculate an employee’s take home pay. Example - rmckanryProgram1. Creating a flow chart or using stump code to outline your program first may help. Include the following features in the program: Enter employee’s name Enter employee’s base hourly pay Enter the number of hours worked for the week Error if the hours worked exceeds 168...
Create a Class with Data Fields and Methods in Java. Provide a Java coding solution for...
Create a Class with Data Fields and Methods in Java. Provide a Java coding solution for the following: 1. Name the class SalonServices 2. Add private data fields: a. salonServiceDescription – This field is a String type b. price - This field is a double type 3. Create two methods that will set the field values. a. The first method setSalonServiceDescription() accepts a String parameter defined as service and assigns it to the salonServiceDescription. The method is not static b....
For this coding exercise, you need to create a new Java project in Eclipse and finish...
For this coding exercise, you need to create a new Java project in Eclipse and finish all the coding in Eclipse. Run and debug your Eclipse project to make sure it works. Then you can just copy and paste the java source code of each file from Eclipse into the answer area of the corresponding box below. The boxes will expand once you paste your code into them, so don’t worry about how it looks J All data members are...
Create a Java application that will exhibit concurrency concepts. Your application should create two threads that will act as counters.
JAVACreate a Java application that will exhibit concurrency concepts. Your application should create two threads that will act as counters. One thread should count up to 20. Once thread one reaches 20, then a second thread should be used to count down to 0.
QUESTION 17 Members of a business development team work together to create a new hardware installation...
QUESTION 17 Members of a business development team work together to create a new hardware installation device. The team is worried that by the time the finished product hits the market, customers' needs might change and the device would become a failure. Which of the following risks does this scenario best exemplify? Strategic risk Market risk Credit risk Internal risk QUESTION 18 Which of the following stages of the new product development process involves expanding viable ideas into full product...
Step 1: Create a new Java project called Lab5.5. Step 2: Now create a new class...
Step 1: Create a new Java project called Lab5.5. Step 2: Now create a new class called aDLLNode. class aDLLNode { aDLLNode prev;    char data;    aDLLNode next; aDLLNode(char mydata) { // Constructor data = mydata; next = null;    prev = null;    } }; Step 3: In the main() function of the driver class (Lab5.5), instantiate an object of type aDLLNode and print the content of its class public static void main(String[] args) { System.out.println("-----------------------------------------");    System.out.println("--------Create...
10) Create a java program that will ask for name and age with method age where...
10) Create a java program that will ask for name and age with method age where it will check the condition that id you are greater than 18 you can vote.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT