Instruction Types Computer Organization and Architecture by Ravinder Nath Rajotiya - May 17, 2021December 11, 20220 Computer Instructions: A digital system such as a processor or CPU accepts binary data as input, processes that data, and then provides output based on the instructions stored in the memory. The processor has an ALU to process the data, registers for temporary data transfer and the control unit manages the flow of instructions and data through the system. It requires the user to store the program (set of instructions) in memory. Format of the instruction When the execute command is given, the instruction from the memory is read into the instruction register (IR). The instruction is basically divided in two parts, the instruction code and the address part of the instruction. Format of the instruction is given below: Instruction Code Address part of instruction Mode
Level of Programming Languages Computer Organization and Architecture by Ravinder Nath Rajotiya - April 29, 2021May 21, 20210 Levels of programming languages: A computer system is composed of hardware and the software. At the lowest level is the hardware layer and above it are the software layers. A computer is an electronic programmable machine. To make the hardware work, it can be programmed using the programming languages. These languages are divided into various levels, these are described below: Machine Level Language: It is a language of 0’s and 1’s, which is a binary language. Writing in binary format is very difficult. But is very easy machine, bcs m/c works on binary. Therefor m/c can directly execute such code without conversion. Assembly Level Language : In thi level mnemonic or symbols are used for the binary code. Thus making it convenient for the
Simple Project use of classes, copy constructor and aggregation JAVA by Ravinder Nath Rajotiya - April 20, 20210 A simple project Following Classes: 1. Student Class 2. Subject Class 3. ExamPaper Class Aggregation example: when you have field in one class that are also the object in another class, there comes a concept what is called aggregation. We can access those object members from this class object using aggregation concept. See code in main method for aggregation: System.out.println(paper.getSubject().getSubjectCode()); //similarily if you want to extract only the student number, see how you can System.out.println("Student number:"+paper.getStudent().getStudentNumber()); Let us see the complete project involving all the above classes in intellij package com.example; public class classAndObjects { public static void main(String[] args) { Subject subject1 = new Subject ("ETEE 310", "MP&MC"); Student std1=new Student("Ravinder", 1234); Exampaper paper = new Exampaper(std1, subject1, 100); //System.out.println(paper); //we can extract more information from paper object, say we want to know the subject code. //See the
Copy Constructor in JAVA JAVA by Ravinder Nath Rajotiya - April 19, 2021May 10, 20210 Copy Constructor in JAVA A copy constructor i a constructor that creates a copy of an existing object of the same class. It creates an object using another object of the same Java class. That's helpful when we want to copy a complex object that has several fields, or when we want to make a deep copy of an existing object. Example copy complex number, subject detail. Here are example code in JAVA
Classes and Objects in JAVA JAVA by Ravinder Nath Rajotiya - April 18, 2021April 18, 20210 Classes and Objects in JAVA Everything that we see around us are objects for example people, metals, car, tree, bike, animals and so on. Every object belong to certain class. So, we have to understand their classification to differentiate among them. Class is way of describing some properities, functionality or behaviour of an objects. It is a template or blueprint for an object. For example a house class will have four properties- windows, doors, roof, walls. so we can create the following properties of one house and their number or type may differ from hour=se to house. House Object-1 House Object-2 House Object-3 Property Numbers or type Property Numbers or type Property Numbers or type Windows 20 Windows 10 Windows 8 Doors 4 Doors 3 Doors 2 Type of roof Tiles Type of roof Grass Type of roof Wood Walls Bricks with plaster Walls Bricks Walls plaster As seen in above table all house have same