Posts

Showing posts with the label classes

Practice Programs of Lab

Image
Program- 1 Write an application that defines a circle class with 2 constructors-the first form expects a double value that represents the radius of a circle, this constructor assumes that circle is centered at the origin. The second form accepts 3 double values, the first 2 arguments define the coordinates of the center and 3rd argument defines the radius. Also declare one member function, which calculates an area of the circle. Program 2 Create a program that defines a cube class with a constructor which accepts a double value that represent The length of edge of a cube and It will calculate the surface area and volume of that cube using the methods CubeArea and CubeVolume. Also make a display method which will display all the values related to that cube. Was that helpful? Let me know if it is.

Example Programs using Real world Classes and Objects

Image
this post contains example programs of real world classes and objects. Comments in these code will help you more to relate programs with real world conditions. It is advised to go through comments. In Last two examples you will notice that two output are almost same but the code of both of them is different. one of them uses constructor to initialize the class and other uses method to do the same work This comparision will help you to understand constructors 1. Example program of initializing Watch objects using constructors. 2. Program of initializing Car objects without using constructor 3. Program of Initializing Car objects using constructor You can also create many such programs just by getting the idea of real-world examples. If you don't know real world examples just go through my post. 10 real-world examples of classes Now create your own programs

Introduction to classes with real-world Examples

10. Real world examples of classes, methods and Objects in Comparision with Object Oriented Programming A class is like a blueprint for creating similar objects. Let's take a real-world example A car company has a blueprint of any car model and based on that they create similar kind of cars. Here, every car is an object and the blueprint of car is like a class.  every car object has it's own attributes such as weight, color, seating capacity, etc. and methods such as driving, applying breaks, turning on headlights, etc. A class defines a new data type. Once defined, this new type can be used to create objects of that type. Means a class is a template for an object, and an object is an instance of an class. In other terms an Object is a specific case of a class. The General form of a class When we define a class we declare its exact form and nature. This is done by specifying the data that it contains and the code that operates...

An overview of Java

The creation of Java It was developed by James Gosling, Patrick Naughton, Chris Warth, Ed Frank, and Mike Sheridan at Sun Microsystems. ➡ Initially named as Oak but then it was renamed "Java" in 1995. from Java coffee, the coffee from Indonesia. How Java changed the Internet It simplified the web programming, Java innovated a new type of networked program called Applet that changed the way the online world thought about content. Java solved the issues like  portability  and  security  associated with the internet. What is java Applets? An applet is a special kind of Java program that is designed to be transmitted over the Internet and automatically executed by a Java-compatible web browser. If the user clicks a link that contains an applet, the applet will be automatically downloaded and run in the browser. It allows some functionality to be moved from the server to the client. It is dynamic and self-exec...

Introduction to Java, classes and objects

Image
What is flow chart? ➡     A flowchart is a type of diagram that represents a workflow or process. Also It can be defined as a diagrammatic representation of  any process. Advantages of C language ➡ Speed of compilation is comparatively high ➡ Powerful and efficient language Problems with C programming ➡ It is a structured Programming Language ➡ C is middle level language ➡ Does not offers the concept of Object oriented programming ➡ We have to write too long code for simple programs ➡ It is complex to understand. ➡ It is also complex to code. Introduction to Java It is a programming language created by James Gosling from Sun Microsystems(SUN). It is object oriented programming language. Creator of java :- James Gosling Where Java can be used? ➡ Mobile applications ( mainly android apps) ➡ Desktop applications ➡ Web servers and application servers ➡ Web applications and much more.... Advantages of using Ja...

YouTube