├── Animal_Class_Input_Practice.java ├── Animal_Class_Practice.java ├── Animal_O.java ├── Args_Input_Practice.java ├── Auto_genreted_Table.java ├── Calculator_Program.java ├── Cattle_Animal_O.java ├── Control_Statement_Input.java ├── Control_Statement_Program.java ├── Do_While_Practice.java ├── Do_While_Task.java ├── Employ_p.java ├── Employ_polymorphism.java ├── Female_Faculty2.java ├── Final Project Demo of the Second semester.docx ├── Final Project Report Of The 2nd Semester.docx ├── FinalSemester_Project.java ├── Lab_Task.java ├── Labtasks.java ├── Lat_TASk.java ├── Lower_Staff2.java ├── Lower_Staff_uni.java ├── MainClass_Animal_O.java ├── MainClass_Final_Semester.java ├── MainClass_Ploymorphism.java ├── MainClass_Uni.java ├── MainClass_p.java ├── Main_Class.java ├── Male_Faculty2.java ├── Marks_Sheet.java ├── Maths.java ├── Nested_Class.java ├── Nested_classes.java ├── One_DArray1.java ├── One_D_Array1.java ├── One_Dimension.java ├── One_d_Input.java ├── One_dim.java ├── One_dinput_user.java ├── Oned_Arrayloop.java ├── Oned_input.java ├── Output_Two_array.java ├── Overloading.java ├── Overloading_program.java ├── Person_Employ.java ├── Person_Employ_Admin.java ├── Person_Employ_Faculty.java ├── Person_Inheritance.java ├── Person_Student.java ├── Person_poly.java ├── Poly_Morphism.java ├── README.md ├── Report of the project.docx ├── Rombous_Fun.java ├── Rombous_Program.java ├── Rombous_Shape.java ├── Semseter_Project_Write.java ├── Student_Class.java ├── Student_p.java ├── Student_polymorphism.java ├── Table.java ├── TdArray.java ├── Td_Array.java ├── Triange_challenged.java ├── Triangle_Program_logic.java ├── Triangle_logic.java ├── Two_DArray1.java ├── Two_D_Array.java ├── Two_D_input.java ├── Two_Darray_userinput.java ├── Two_Dim_Input.java ├── Two_Dimension.java ├── Two_Input.java ├── Two_dim.java ├── Twodarray_vertical.java ├── University.java ├── University_polymorphism.java ├── Uper_Staff_uni.java ├── Uper_staff_p.java ├── Wild_Animal_O.java ├── labtasks.jar └── onedimension_userinput.java /Animal_Class_Input_Practice.java: -------------------------------------------------------------------------------- 1 | package Practice; 2 | import java.util.Scanner; 3 | import static java.lang.System.out; 4 | public class Animal_Class_Input_Practice 5 | { 6 | 7 | void Input_user(String name,String Class,int age,int semester) 8 | { 9 | out.println("Student Name:-\t" + name); 10 | out.println("Student Class:-\t" + Class); 11 | out.println("Student Age:-\t" + age); 12 | out.println("Student Semester:-\t" + semester); 13 | } 14 | public static void main(String[] args) 15 | { 16 | Scanner obj = new Scanner(System.in); 17 | String name = obj.nextLine(); 18 | String Class = obj.nextLine(); 19 | int age = obj.nextInt(); 20 | int semester = obj.nextInt(); 21 | 22 | Animal_Class_Input_Practice input = new Animal_Class_Input_Practice(); 23 | input.Input_user(name, Class, age, semester); 24 | 25 | } 26 | 27 | 28 | } 29 | -------------------------------------------------------------------------------- /Animal_Class_Practice.java: -------------------------------------------------------------------------------- 1 | package Practice; 2 | import static java.lang.System.out; 3 | public class Animal_Class_Practice 4 | { 5 | public String name; 6 | public String Class; 7 | public int age; 8 | public int semester; 9 | 10 | public Animal_Class_Practice(String name,String Class,int age,int semester) 11 | { 12 | this.name = name; 13 | this.Class = Class; 14 | this.age = age; 15 | this.semester = semester; 16 | 17 | } 18 | public void ShowFile() 19 | { 20 | out.println("Student Name:-\t" + name); 21 | out.println("Student Class:-\t" + Class); 22 | out.println("Student Age:-\t" + age); 23 | out.println("Student Semester:-\t" + semester); 24 | } 25 | public static void main(String[] args) 26 | { 27 | Animal_Class_Practice output = new Animal_Class_Practice("Dilbar" , "CS-II" , 19 , 4); 28 | output.ShowFile(); 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Animal_O.java: -------------------------------------------------------------------------------- 1 | package Practice.poly_morphism; 2 | import static java.lang.System.out; 3 | public class Animal_O 4 | { 5 | 6 | public String gender,color,food; 7 | public int legs,age; 8 | 9 | 10 | public Animal_O() 11 | { 12 | this.gender = null; 13 | this.color = null; 14 | this.food = null; 15 | this.legs = 0; 16 | this.age = 0; 17 | } 18 | 19 | public void Show_Result() 20 | { 21 | out.println("Gender:-\t" + "Gender"); 22 | out.println("Color:-\t" + "Color"); 23 | out.println("Food:-\t" + "Food"); 24 | out.println("Legs:-\t" + "legs"); 25 | out.println("Age:-\t" + "Age"); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /Args_Input_Practice.java: -------------------------------------------------------------------------------- 1 | package Practice; 2 | import java.util.Scanner; 3 | import static java.lang.System.out; 4 | 5 | public class Args_Input_Practice 6 | { 7 | String Inputuser(String a, String b) 8 | { 9 | return a + b; 10 | } 11 | 12 | public static void main(String[] args) 13 | { 14 | Scanner scan = new Scanner(System.in); 15 | String a = scan.nextLine(); 16 | String b = scan.nextLine(); 17 | 18 | Args_Input_Practice practice = new Args_Input_Practice(); 19 | out.println("Answar is:-\t" + practice.Inputuser(a, b)); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /Auto_genreted_Table.java: -------------------------------------------------------------------------------- 1 | package Practice; 2 | import static java.lang.System.out; 3 | import java.util.Scanner; 4 | public class Auto_genreted_Table 5 | { 6 | 7 | public static void main(String[] args) 8 | { 9 | Scanner input = new Scanner(System.in); 10 | int a,b,c; 11 | int table = input.nextInt(); 12 | //int u = input.nextInt(); 13 | 14 | for(a=1;a<=table;a++) 15 | { 16 | for(b=1;b<=10;b++) 17 | { 18 | c=a*b; 19 | out.println("Output is:- \t" + a +"*"+b+ "=" + c); 20 | //out.println(table); 21 | 22 | } 23 | } 24 | 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /Calculator_Program.java: -------------------------------------------------------------------------------- 1 | package Practice; 2 | import java.util.Scanner; 3 | import static java.lang.System.out; 4 | 5 | public class Calculator_Program 6 | { 7 | int a; 8 | int b; 9 | 10 | public int Sum(int a,int b) 11 | { 12 | return a+b; 13 | } 14 | public int Subtarct(int a,int b) 15 | { 16 | return a-b; 17 | } 18 | public int Multiply(int a,int b) 19 | { 20 | return a*b; 21 | } 22 | public int Divide(int a,int b) 23 | { 24 | return a/b; 25 | } 26 | 27 | public static void main(String[] args) 28 | { 29 | Scanner scan = new Scanner(System.in); 30 | out.println("Please Enter First Number:-\t"); 31 | int a = scan.nextInt(); 32 | out.println("Please Enter Second Number:-\t"); 33 | int b = scan.nextInt(); 34 | 35 | out.println("Enter Number 1 for Addition"); 36 | out.println("Enter Number 2 for Subtraction"); 37 | out.println("Enter Number 3 for Multiplication"); 38 | out.println("Enter Number 4 for Division"); 39 | 40 | int num = scan.nextInt(); 41 | 42 | Calculator_Program obj = new Calculator_Program(); 43 | obj.Sum(a, b); 44 | obj.Subtarct(a, b); 45 | obj.Multiply(a, b); 46 | obj.Divide(a, b); 47 | 48 | if(num == 1) 49 | { 50 | out.println("Adition is:-\t" + obj.Sum(a, b)); 51 | } 52 | if(num == 2) 53 | { 54 | out.println("Subtraction is:-\t" + obj.Subtarct(a, b)); 55 | } 56 | if(num == 3) 57 | { 58 | out.println("Multiplication is:-\t" + obj.Multiply(a, b)); 59 | } 60 | if(num == 4) 61 | { 62 | out.println("Division is:-\t" + obj.Divide(a, b)); 63 | } 64 | else 65 | { 66 | out.println("Desired Value is not here..........????"); 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /Cattle_Animal_O.java: -------------------------------------------------------------------------------- 1 | package Practice.poly_morphism; 2 | import static java.lang.System.out; 3 | public class Cattle_Animal_O extends Animal_O 4 | { 5 | public String name,liveplace,identity; 6 | public int horons; 7 | 8 | 9 | public Cattle_Animal_O() 10 | { 11 | this.name = null; 12 | this.liveplace = null; 13 | this.identity = null; 14 | this.horons = 0; 15 | } 16 | 17 | public void Show_Result() 18 | { 19 | out.println("Name:-\t" + "Cow"); 20 | out.println("Live Place:-\t" + "Home"); 21 | out.println("Identity:-\t" + "As Animal"); 22 | out.println("Horons:-\t" + "Two"); 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /Control_Statement_Input.java: -------------------------------------------------------------------------------- 1 | package Practice; 2 | import static java.lang.System.out; 3 | import java.util.Scanner; 4 | public class Control_Statement_Input 5 | { 6 | public String name; 7 | public String caste; 8 | public int age; 9 | 10 | public Control_Statement_Input() 11 | { 12 | this.name = null; 13 | this.caste = null; 14 | this.age = 0; 15 | } 16 | 17 | public Control_Statement_Input(String name) 18 | { 19 | this.name = name; 20 | this.caste = null; 21 | this.age = 0; 22 | } 23 | 24 | public Control_Statement_Input(String name,String caste) 25 | { 26 | this.name = name; 27 | this.caste = caste; 28 | this.age = 0; 29 | } 30 | 31 | public Control_Statement_Input(String name, String caste,int age) 32 | { 33 | this.name = name; 34 | this.caste = caste; 35 | this.age = age; 36 | } 37 | 38 | public void Showfile() 39 | { 40 | out.println("Name:-\t" + name); 41 | out.println("Caste:-\t" + caste); 42 | out.println("Age:-\t" + age); 43 | } 44 | 45 | public static void main(String[] args) 46 | { 47 | Scanner input = new Scanner(System.in); 48 | 49 | out.println("Please Enter First String...."); 50 | String name = input.nextLine(); 51 | 52 | out.println("Please Enter Second String...."); 53 | String caste = input.nextLine(); 54 | 55 | out.println("Please Enter Third Integer...."); 56 | int age = input.nextInt(); 57 | 58 | Control_Statement_Input obj = new Control_Statement_Input(); 59 | Control_Statement_Input obj1 = new Control_Statement_Input(name); 60 | Control_Statement_Input obj2 = new Control_Statement_Input(name,caste); 61 | Control_Statement_Input obj3 = new Control_Statement_Input(name,caste,age); 62 | 63 | obj.Showfile(); 64 | obj1.Showfile(); 65 | obj2.Showfile(); 66 | obj3.Showfile(); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /Control_Statement_Program.java: -------------------------------------------------------------------------------- 1 | package Practice; 2 | import static java.lang.System.out; 3 | public class Control_Statement_Program 4 | { 5 | public String name; 6 | public String Cms_id; 7 | public String Class; 8 | public int R_no; 9 | 10 | public Control_Statement_Program() 11 | { 12 | this.name = null; 13 | this.Class = null; 14 | this.Cms_id = null; 15 | this.R_no = 0; 16 | } 17 | 18 | public Control_Statement_Program(String name) 19 | { 20 | this.name = name; 21 | this.Class = null; 22 | this.Cms_id = null; 23 | this.R_no = 0; 24 | } 25 | 26 | public Control_Statement_Program(String name, String Class) 27 | { 28 | this.name = name; 29 | this.Class = Class; 30 | this.Cms_id = null; 31 | this.R_no = 0; 32 | } 33 | 34 | public Control_Statement_Program(String name,String Class,String Cms_id) 35 | { 36 | this.name = name; 37 | this.Class = Class; 38 | this.Cms_id = Cms_id; 39 | this.R_no = 0; 40 | } 41 | 42 | public Control_Statement_Program(String name,String Class,String Cms_id,int R_no) 43 | { 44 | this.name = name; 45 | this.Class = Class; 46 | this.Cms_id = Cms_id; 47 | this.R_no = R_no; 48 | } 49 | 50 | public void Showinfo() 51 | { 52 | out.println("Student Name:-\t" + name); 53 | out.println("Student Class:-\t" + Class); 54 | out.println("Student Cms_Id:-\t" + Cms_id); 55 | out.println("Student Roll Number:-\t" + R_no); 56 | } 57 | 58 | public static void main(String[] args) 59 | { 60 | Control_Statement_Program control = new Control_Statement_Program(); 61 | Control_Statement_Program control2 = new Control_Statement_Program("Dilbar"); 62 | Control_Statement_Program control3 = new Control_Statement_Program("Dilbar","CS-II"); 63 | Control_Statement_Program control4 = new Control_Statement_Program("Dilbar","CS-II","023-20-0155"); 64 | Control_Statement_Program control5 = new Control_Statement_Program("Dilbar","CS-II","023-20-0155",103); 65 | control.Showinfo(); 66 | control2.Showinfo(); 67 | control3.Showinfo(); 68 | control4.Showinfo(); 69 | control5.Showinfo(); 70 | 71 | } 72 | 73 | 74 | } 75 | -------------------------------------------------------------------------------- /Do_While_Practice.java: -------------------------------------------------------------------------------- 1 | 2 | package Practice; 3 | import static java.lang.System.out; 4 | import java.util.Scanner; 5 | 6 | public class Do_While_Practice 7 | { 8 | 9 | public int x; 10 | public int y; 11 | 12 | public int Sum(int x,int y) 13 | { 14 | return x+y; 15 | } 16 | 17 | public int Subtract(int x, int y) 18 | { 19 | return x-y; 20 | } 21 | 22 | public int Multiply(int x, int y) 23 | { 24 | return x*y; 25 | } 26 | 27 | public int Divide(int x,int y) 28 | { 29 | return x/y; 30 | } 31 | 32 | public static void main(String[] args) 33 | { 34 | Scanner scan = new Scanner(System.in); 35 | Do_While_Practice practice = new Do_While_Practice(); 36 | 37 | char Character = 'C'; 38 | 39 | do 40 | { 41 | out.println("Please Enter First integer..??"); 42 | int x = scan.nextInt(); 43 | out.println("Please Enetr Second Interger..??"); 44 | int y = scan.nextInt(); 45 | out.println("Please Enetr Any One Character For Desired Result..??"); 46 | out.println("S For Sum....."); 47 | out.println("T For Subtract....."); 48 | out.println("M For Multiply....."); 49 | out.println("D For Division....."); 50 | char num = scan.next().charAt(0); 51 | practice.Sum(x, y); 52 | practice.Subtract(x, y); 53 | practice.Multiply(x, y); 54 | practice.Divide(x, y); 55 | 56 | switch(num) 57 | { 58 | case 'S': 59 | out.println("Addition of two numbers:-\t" + practice.Sum(x, y)); 60 | break; 61 | case 'T': 62 | out.println("Subtraction of two numbers:-\t" + practice.Subtract(x, y)); 63 | break; 64 | case 'M': 65 | out.println("Multiplication of two numbers:-\t" + practice.Multiply(x, y)); 66 | break; 67 | case 'D': 68 | out.println("Division of two numbers:-\t" + practice.Divide(x, y)); 69 | break; 70 | default : 71 | out.println("The Character You Have Input Has No Values Here..??/ "); 72 | } 73 | out.println("Enter C for Continue Your Project Work...??"); 74 | Character = scan.next().charAt(0); 75 | 76 | } 77 | while(Character == 'C'); 78 | 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /Do_While_Task.java: -------------------------------------------------------------------------------- 1 | package Practice; 2 | import static java.lang.System.out; 3 | import java.util.Scanner; 4 | public class Do_While_Task 5 | { 6 | 7 | public int a; 8 | public int b; 9 | 10 | public int Sum(int a,int b) 11 | { 12 | return a+b; 13 | } 14 | public int Subtract(int a, int b) 15 | { 16 | return a-b; 17 | } 18 | 19 | public int Multiply(int a, int b) 20 | { 21 | return a*b; 22 | } 23 | 24 | public int Divide(int a,int b) 25 | { 26 | return a/b; 27 | } 28 | 29 | public static void main(String[] args) 30 | { 31 | Scanner scan = new Scanner(System.in); 32 | Do_While_Task obj = new Do_While_Task(); 33 | 34 | char character = 'c'; 35 | 36 | do 37 | { 38 | int a = scan.nextInt(); 39 | int b = scan.nextInt(); 40 | char Char = scan.next().charAt(0); 41 | 42 | obj.Sum(a, b); 43 | obj.Subtract(a, b); 44 | obj.Multiply(a, b); 45 | obj.Divide(a, b); 46 | 47 | switch(Char) 48 | { 49 | case 'S': 50 | out.println("Sum of two numbers:-\t" + obj.Sum(a, b)); 51 | break; 52 | 53 | case 'T': 54 | out.println("Subtact of two numbers:-\t" + obj.Subtract(a, b)); 55 | break; 56 | case 'M': 57 | out.println("Multiply of two numbers:-\t" + obj.Multiply(a, b)); 58 | break; 59 | case 'D': 60 | out.println("Divide of two numbers:-\t"+ obj.Divide(a, b)); 61 | break; 62 | default : 63 | out.println("The Character You Put Has No Values Here"); 64 | 65 | } 66 | out.println("Input Character For Continue:-\t"); 67 | character = scan.next().charAt(0); 68 | } 69 | while(character=='c'); 70 | } 71 | 72 | 73 | } 74 | -------------------------------------------------------------------------------- /Employ_p.java: -------------------------------------------------------------------------------- 1 | package Practice.poly_morphism; 2 | import static java.lang.System.out; 3 | public class Employ_p extends Person_poly 4 | { 5 | public String work,status,departement; 6 | 7 | 8 | public Employ_p() 9 | { 10 | work = null; 11 | status = null; 12 | departement = null; 13 | } 14 | 15 | public void Showinfo() 16 | { 17 | out.println("Work:-\t" + "As Teaching"); 18 | out.println("Status:-\t" + "Assistant Professor"); 19 | out.println("Depatement:-\t" + "Computer Science"); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /Employ_polymorphism.java: -------------------------------------------------------------------------------- 1 | package Practice.poly_morphism; 2 | import static java.lang.System.out; 3 | public class Employ_polymorphism extends Poly_Morphism 4 | { 5 | public String employeeId,departement; 6 | public double salary; 7 | 8 | public Employ_polymorphism() 9 | { 10 | employeeId = null; 11 | departement = null; 12 | salary = 0.0; 13 | 14 | } 15 | 16 | public void Show_info() 17 | { 18 | out.println("Emploee Id:-" + "104"); 19 | out.println("Deparetement:-" + "CS"); 20 | out.println("Salary:-" + 17283737 ); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Female_Faculty2.java: -------------------------------------------------------------------------------- 1 | package Projects; 2 | 3 | 4 | import static java.lang.System.out; 5 | import java.util.Scanner; 6 | 7 | class Female_Faculty2 extends Semseter_Project_Write 8 | { 9 | private String FM_firstname; 10 | private String FM_lastname; 11 | private int FM_gradeYear; 12 | private String MF_madamID; 13 | private String FM_courses = ""; 14 | private int FM_salary = 0; 15 | private static int FM_costofSubject = 5000; 16 | private static int FM_id = 11100; 17 | 18 | public Female_Faculty2() 19 | { 20 | Scanner scan = new Scanner(System.in); 21 | out.println("\t\t\t<-------Here Is The Details Of Female-Faculty------->"); 22 | out.print("\t\t\tEnter First Name: ----> "); 23 | this.FM_firstname = scan.nextLine(); 24 | 25 | out.print("\t\t\tEnter Last Name: ----> "); 26 | this.FM_lastname = scan.nextLine(); 27 | 28 | out.print("\t\t\tPlease Enter Any One Option That Which Faculty Member Belongs:- " 29 | + "\n\t\t\t1-For New Member\n\t\t\t2-For-Senior\n\t\t\t3-For Junior" 30 | + "\n\t\t\tThe Desired result:---->"); 31 | this.FM_gradeYear = scan.nextInt(); 32 | setFM_teacherID(); 33 | out.println("\t\t\tMadam ID: " + MF_madamID); 34 | 35 | 36 | } 37 | private void setFM_teacherID() 38 | { 39 | FM_id++; 40 | this.MF_madamID = FM_gradeYear + "" + FM_id; 41 | } 42 | public void tech() 43 | { 44 | out.print("\t\t\tEnter The Courses That Female Teach:" 45 | + "\n \t\t\tQ to Quit\n\t\t\t"); 46 | do 47 | { 48 | Scanner scan = new Scanner(System.in); 49 | String course = scan.nextLine(); 50 | out.print("\t\t\t"); 51 | if(!course.equals("Q")) 52 | { 53 | FM_courses = FM_courses + "\n" + "\t\t\t"+ course; 54 | FM_salary = FM_salary + FM_costofSubject; 55 | } 56 | else 57 | { 58 | break; 59 | } 60 | 61 | } 62 | while(1 != 0); 63 | out.println("Subjects teach:----> " + FM_courses); 64 | out.println("\t\t\tTutior balance:----> " + FM_salary); 65 | 66 | } 67 | 68 | public void viewSalary() 69 | { 70 | out.println("\t\t\tYour Salary is:----> " + FM_salary); 71 | } 72 | public void payTuitor() 73 | { 74 | viewSalary(); 75 | out.print("\t\t\tEnter Your amount to transist:----> $"); 76 | Scanner scan = new Scanner(System.in); 77 | int pyment = scan.nextInt(); 78 | FM_salary = FM_salary - pyment; 79 | out.println("\t\t\tThank You For Your pyment transist:----> $" + pyment); 80 | viewSalary(); 81 | } 82 | public String toString() 83 | { 84 | return " \t\t\tName :----> " + FM_firstname + " " + FM_lastname+ 85 | "\n \t\t\tGrade level:----> " + FM_gradeYear + 86 | "\n\t\t\tTeacher ID :----> " + MF_madamID + 87 | "\n\t\t\tCourses Tech:----> " + FM_courses + 88 | "\n\t\t\tSalary :----> " + FM_salary; 89 | 90 | 91 | } 92 | 93 | 94 | 95 | 96 | } -------------------------------------------------------------------------------- /Final Project Demo of the Second semester.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dilbarhussainmalik12345/Object_Oriented_Programming-with-JAVA/3dc4f3300e2ac04228878ed52698c1a88978028d/Final Project Demo of the Second semester.docx -------------------------------------------------------------------------------- /Final Project Report Of The 2nd Semester.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dilbarhussainmalik12345/Object_Oriented_Programming-with-JAVA/3dc4f3300e2ac04228878ed52698c1a88978028d/Final Project Report Of The 2nd Semester.docx -------------------------------------------------------------------------------- /FinalSemester_Project.java: -------------------------------------------------------------------------------- 1 | package Projects; 2 | import java.io.File; 3 | import java.io.FileNotFoundException; 4 | import java.io.FileWriter; 5 | import static java.lang.System.out; 6 | import java.util.Scanner; 7 | import javafx.scene.control.Button; 8 | import javax.swing.JButton; 9 | import javax.swing.JFrame; 10 | public class FinalSemester_Project 11 | { 12 | 13 | public static void main(String[] args) 14 | { 15 | out.println("\t\t\tWelcome To Sukkur IBA University\n\n" 16 | + "\t\t\tOnline Registration Form For Spring 2021\n\n"); 17 | FinalSemester_Project obj = new FinalSemester_Project(); 18 | 19 | 20 | try 21 | { 22 | FileWriter myWriter = new FileWriter("C:\\Users\\Agha\\Documents\\NetBeansProjects\\Lab_Tasks\\src\\Projects\\FinalSemester_Project.txt"); 23 | myWriter.write("\t\t\tFinal Semester Project\n"); 24 | 25 | MainClass_Final_Semester obj1 = new MainClass_Final_Semester(); 26 | obj1.FirstPhase(); 27 | obj1.SecondPhase(); 28 | obj1.ThirdPhase(); 29 | 30 | 31 | String fc; 32 | fc = obj1.toString(); 33 | myWriter.write(fc); 34 | myWriter.close(); 35 | 36 | try 37 | { 38 | File myObj = new File("C:\\Users\\Agha\\Documents\\NetBeansProjects\\Lab_Tasks\\src\\Projects\\FinalSemester_Project.txt"); 39 | Scanner myReader = new Scanner(myObj); 40 | while(myReader.hasNextLine()) 41 | { 42 | String data = myReader.nextLine(); 43 | out.println(data); 44 | } 45 | myReader.close(); 46 | } 47 | catch(FileNotFoundException e) 48 | { 49 | out.println("Error Occured"); 50 | e.printStackTrace(); 51 | } 52 | 53 | out.println("\t\t\tSuccessFully We Have Submitted Our Form"); 54 | } 55 | catch(Exception e) 56 | { 57 | out.println("An Error Occured"); 58 | e.printStackTrace(); 59 | 60 | 61 | 62 | } 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | /* JFrame f = new JFrame("Button Example"); 73 | JButton b = new JButton("Click Me"); 74 | b.setBounds(50, 100, 95, 30); 75 | f.add(b); 76 | f.setSize(400,400); 77 | f.setLayout(null); 78 | f.setVisible(true); 79 | */ 80 | } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /Lab_Task.java: -------------------------------------------------------------------------------- 1 | package Practice.Lab_Task; 2 | import static java.lang.System.out; 3 | import java.util.Scanner; 4 | public class Lab_Task 5 | { 6 | public double x; 7 | public double y; 8 | 9 | public double Sum(double x,double y) 10 | { 11 | return x + y; 12 | } 13 | public double Subtraction(double x ,double y) 14 | { 15 | return x-y; 16 | } 17 | public double Multiply(double x,double y) 18 | { 19 | return x*y; 20 | } 21 | public double Divide(double x,double y) 22 | { 23 | return x/y; 24 | } 25 | public int Compute_Exponent(int base,int power) 26 | { 27 | return base*base*base; 28 | } 29 | 30 | 31 | public static void main(String[] args) 32 | { 33 | Scanner scan = new Scanner(System.in); 34 | 35 | double x = scan.nextDouble(); 36 | double y = scan.nextDouble(); 37 | int base = scan.nextInt(); 38 | int power = scan.nextInt(); 39 | 40 | 41 | Lab_Task obj = new Lab_Task(); 42 | obj.Sum(x, y); 43 | obj.Subtraction(x, y); 44 | obj.Multiply(x, y); 45 | obj.Divide(x, y); 46 | obj.Compute_Exponent(base, power); 47 | 48 | 49 | out.println("Sum:-\t" + obj.Sum(x, y)); 50 | out.println("Subtarct:-" + obj.Subtraction(x, y)); 51 | out.println("Multiply:-" + obj.Multiply(x, y)); 52 | out.println("Divide:-" + obj.Divide(x, y)); 53 | out.println("Output is:-" + obj.Compute_Exponent(base, power)); 54 | 55 | 56 | 57 | 58 | 59 | 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /Labtasks.java: -------------------------------------------------------------------------------- 1 | 2 | package labtasks; 3 | 4 | 5 | public class Labtasks { 6 | 7 | 8 | public static void main(String[] args) { 9 | System.out.println("Hello"); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /Lat_TASk.java: -------------------------------------------------------------------------------- 1 | package Lab_Tasks_SIBA; 2 | import static java.lang.System.out; 3 | import java.util.Scanner; 4 | public class Lat_TASk 5 | { 6 | public String faculty; 7 | public String lowrstaff; 8 | protected String classes; 9 | private String computer; 10 | int age; 11 | String labs; 12 | 13 | 14 | 15 | 16 | 17 | void Stringto(String faculty,String lowrstaff,String classes,String computer,String labs) 18 | { 19 | out.println("Faculty:-" +faculty); 20 | out.println("Lower staff:-" +lowrstaff); 21 | out.println("Class:-" + classes); 22 | out.println("No:of computer:-" +computer); 23 | out.println("Labs:-" + labs); 24 | } 25 | 26 | 27 | public static void main(String[] args) 28 | { 29 | Scanner scan = new Scanner(System.in); 30 | String faculty =scan.nextLine(); 31 | String lowrstaff = scan.nextLine(); 32 | String classes = scan.nextLine(); 33 | String computer = scan.nextLine(); 34 | String labs = scan.nextLine(); 35 | Lat_TASk input = new Lat_TASk(); 36 | 37 | input.Stringto(faculty,lowrstaff,classes,computer,labs); 38 | 39 | 40 | 41 | 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /Lower_Staff2.java: -------------------------------------------------------------------------------- 1 | package Projects; 2 | 3 | import static java.lang.System.out; 4 | import java.util.Scanner; 5 | 6 | class Lower_Staff2 extends Semseter_Project_Write 7 | { 8 | private String LS_firstname; 9 | private String LS_lastname; 10 | private int LS_gradeYear; 11 | private String LS_peonID; 12 | private String LS_works = ""; 13 | private int LS_salary = 0; 14 | private static int LS_costofwork = 1500; 15 | private static int LS_id = 1000; 16 | 17 | 18 | public Lower_Staff2() 19 | { 20 | Scanner scan = new Scanner(System.in); 21 | out.println("\t\t\t<-------Here Is The Details Of Lower-Staff------->"); 22 | out.print("\t\t\tEnter First Name: ----> "); 23 | this.LS_firstname = scan.nextLine(); 24 | 25 | out.print("\t\t\tEnter Last Name: ----> "); 26 | this.LS_lastname = scan.nextLine(); 27 | 28 | out.print("\t\t\tPlease Enetr any one option that which faculty member belongs:- " 29 | + "\n\t\t\t1-For Freshmen\n \t\t\t2-For-Senior\n\t\t\t 3-For Junior" 30 | + "\n\t\t\tThe Desired result:----> "); 31 | this.LS_gradeYear = scan.nextInt(); 32 | setLS_PeonID(); 33 | out.println("\t\t\tTeacher ID:-----> " + LS_peonID); 34 | 35 | } 36 | 37 | private void setLS_PeonID() 38 | { 39 | LS_id++; 40 | this.LS_peonID = LS_gradeYear + "" + LS_id; 41 | } 42 | 43 | public void Works() 44 | { 45 | out.print("\t\t\tEnter The Works That Lower-Staff :----->" 46 | + "\n\t\t\t Q to Quit\n\t\t\t"); 47 | do 48 | { 49 | Scanner scan = new Scanner(System.in); 50 | String course = scan.nextLine(); 51 | out.print("\t\t\t"); 52 | 53 | if(!course.equals("Q")) 54 | { 55 | LS_works = LS_works + "\n" + "\t\t\t" + course; 56 | LS_salary = LS_salary + LS_costofwork; 57 | } 58 | else 59 | { 60 | break; 61 | } 62 | 63 | } 64 | while(1 != 0); 65 | out.println("Works Performs:----> " + LS_works); 66 | out.println("\t\t\tWorker Balance:----> " + LS_salary); 67 | 68 | } 69 | public void viewSalary() 70 | { 71 | out.println("\t\t\tYour Salary is:---->" + LS_salary); 72 | } 73 | 74 | public void payWork() 75 | { 76 | viewSalary(); 77 | out.print("\t\t\tEnter Your amount to transist:----> $"); 78 | Scanner scan = new Scanner(System.in); 79 | int pyment = scan.nextInt(); 80 | LS_salary = LS_salary - pyment; 81 | out.println("\t\t\tThank You For Your pyment transist:----> $" + pyment); 82 | viewSalary(); 83 | } 84 | 85 | public String toString() 86 | { 87 | return "\n\t\t\tName :----> " + LS_firstname + " " + LS_lastname+ 88 | "\n \t\t\tGrade level :----> " + LS_gradeYear + 89 | "\n\t\t\tLower-Staff ID:----> " + LS_peonID + 90 | "\n\t\t\tWorks perform :----> " + LS_works + 91 | "\n\t\t\tSalary :----> " + LS_salary; 92 | 93 | 94 | } 95 | 96 | 97 | } 98 | -------------------------------------------------------------------------------- /Lower_Staff_uni.java: -------------------------------------------------------------------------------- 1 | package Practice.poly_morphism; 2 | import static java.lang.System.out; 3 | public class Lower_Staff_uni extends University_polymorphism 4 | { 5 | public String Peon,Sweeper,electrician; 6 | 7 | public Lower_Staff_uni() 8 | { 9 | this.Peon = null; 10 | this.Sweeper =null; 11 | this.electrician = null; 12 | } 13 | 14 | public void Show_File() 15 | { 16 | out.println("Peon:-\t" + "some body"); 17 | out.println("Sweeper:-\t" + "Some body Else"); 18 | out.println("Electrician:-\t" + "some body in campus"); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /MainClass_Animal_O.java: -------------------------------------------------------------------------------- 1 | package Practice.poly_morphism; 2 | import static java.lang.System.out; 3 | public class MainClass_Animal_O 4 | { 5 | 6 | public static void main(String[] args) 7 | { 8 | Animal_O obj = new Animal_O(); 9 | Animal_O catle = new Cattle_Animal_O(); 10 | Animal_O wild = new Wild_Animal_O(); 11 | 12 | 13 | 14 | obj.Show_Result(); 15 | out.println("\n\n"); 16 | catle.Show_Result(); 17 | out.println("\n\n"); 18 | wild.Show_Result(); 19 | 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /MainClass_Final_Semester.java: -------------------------------------------------------------------------------- 1 | package Projects; 2 | import static java.lang.System.out; 3 | import java.util.Scanner; 4 | public class MainClass_Final_Semester extends FinalSemester_Project 5 | { 6 | Scanner scan = new Scanner(System.in); 7 | 8 | String name, fathername, email, number, address; 9 | double matricmrks, intermrks, percentage, percentage_inter; 10 | double matric_totalmrks = 850; 11 | double intertotalmrks = 1100; 12 | char grade; 13 | int enroll; 14 | public String Stdent_Seatnumber; 15 | public int Student_grdyear; 16 | public int Stdent_Id = 1000; 17 | 18 | 19 | public void FirstPhase() 20 | { 21 | 22 | 23 | System.out.println("\t\t\tPlease Enter Your Peronal Details\n"); 24 | 25 | out.print("\t\t\tPlease Enter Your Name: "); 26 | name = scan.nextLine(); 27 | 28 | out.print("\t\t\tPlease Enter Father Name: "); 29 | fathername = scan.nextLine(); 30 | 31 | out.print("\t\t\tPlease Enter Email: "); 32 | email = scan.nextLine(); 33 | 34 | out.print("\t\t\tPlease Enter Your Number: "); 35 | number = scan.nextLine(); 36 | 37 | out.print("\t\t\tPlease Enter Address:"); 38 | address = scan.nextLine(); 39 | 40 | if(address.equals(address)) 41 | { 42 | out.println("\t\t\tFirst Phase has Completed\n"); 43 | out.println("\t\t\tStep Towards Second Phase"); 44 | } 45 | 46 | 47 | 48 | out.println(); 49 | 50 | } 51 | 52 | public void SecondPhase() 53 | { 54 | out.println("\t\t\tPlease Enter Education Details\n"); 55 | 56 | out.print("\t\t\tPlease Enter Your Matric Marks: "); 57 | matricmrks = scan.nextDouble(); 58 | out.println(); 59 | 60 | percentage = (matricmrks*100)/matric_totalmrks ; 61 | 62 | if(percentage <= 100 && percentage >= 50 ) 63 | { 64 | if(percentage < 100 && percentage > 92.9) 65 | { 66 | out.println("\t\t\tA1 Grade"); 67 | } 68 | 69 | if(percentage < 92.9 && percentage > 85.8) 70 | { 71 | out.println("\t\t\tA Grade"); 72 | } 73 | if(percentage < 85.5 && percentage > 78.8) 74 | { 75 | out.println("\t\t\tB Grade"); 76 | } 77 | if(percentage < 78.8 && percentage > 71.7) 78 | { 79 | out.println("\t\t\tC Grade"); 80 | } 81 | if(percentage < 71.7 && percentage > 64.7) 82 | { 83 | out.println("\t\t\tD Grade"); 84 | } 85 | if(percentage < 64.7 && percentage > 57.6) 86 | { 87 | out.println("\t\t\tE Grade"); 88 | } 89 | if(percentage < 57.6 && percentage > 50) 90 | { 91 | out.println("\t\t\tF Grade"); 92 | } 93 | 94 | 95 | } 96 | else 97 | { 98 | out.println("\t\t\tYou are not elligible"); 99 | 100 | } 101 | out.println(); 102 | 103 | out.print("\t\t\tPlease Enter Your Inter Marks: "); 104 | 105 | intermrks = scan.nextDouble(); 106 | out.println(); 107 | 108 | percentage_inter = (intermrks*100)/intertotalmrks; 109 | 110 | if(percentage_inter <= 100 && percentage_inter >= 50) 111 | { 112 | if(percentage_inter < 100 && percentage_inter > 92.9) 113 | { 114 | out.println("\t\t\tA1 Grade"); 115 | } 116 | 117 | if(percentage_inter < 92.9 && percentage_inter > 85.8) 118 | { 119 | out.println("\t\t\tA Grade"); 120 | } 121 | if(percentage_inter < 85.5 && percentage_inter > 78.8) 122 | { 123 | out.println("\t\t\tB Grade"); 124 | } 125 | if(percentage_inter < 78.8 && percentage_inter > 71.7) 126 | { 127 | out.println("\t\t\tC Grade"); 128 | } 129 | if(percentage_inter < 71.7 && percentage_inter > 64.7) 130 | { 131 | out.println("\t\t\tD Grade"); 132 | } 133 | if(percentage_inter < 64.7 && percentage_inter > 57.6) 134 | { 135 | out.println("\t\t\tE Grade"); 136 | } 137 | if(percentage_inter < 57.6 && percentage_inter > 50) 138 | { 139 | out.println("\t\t\tF Grade"); 140 | } 141 | 142 | 143 | 144 | } 145 | else 146 | { 147 | out.println("\t\t\tYou are not elligible"); 148 | System.exit(0); 149 | } 150 | if(intermrks == (intermrks)) 151 | { 152 | out.println("\t\t\tSecond Phase has Completed\n"); 153 | out.println("\t\t\tStep Towards Third Phase"); 154 | } 155 | 156 | } 157 | 158 | public void ThirdPhase() 159 | { 160 | out.println("\t\t\tPlease Choose Any One Departement From The Following Which You Want"); 161 | out.println("\t\t\t--> BS Computer Science" 162 | + "\t\t\t\t Press 1 For Enroll"); 163 | out.println("\t\t\t--> BS Software Engineering" 164 | + "\t\t\t Press 2 For Enroll"); 165 | out.println("\t\t\t--> B Bussiness Admintration" 166 | + "\t\t\t Press 3 For Enroll"); 167 | out.println("\t\t\t--> B Elctrical Engineering" 168 | + "\t\t\t Press 4 For Enroll"); 169 | out.println("\t\t\t--> B Education Departement" 170 | + "\t\t\t Press 5 For Enroll"); 171 | out.println("\t\t\t--> (CA)Chartered Accountant" 172 | + "\t\t\t Press 6 For Enroll"); 173 | out.print("\t\t\tIf You Want To Cancel Press 7: "); 174 | enroll = scan.nextInt(); 175 | if(enroll == 1) 176 | { 177 | out.println("\t\t\tEnrolled Successfully In Computer Sceience"); 178 | } 179 | if(enroll == 2) 180 | { 181 | out.println("\t\t\tEnrolled Successfully In Software Engineering"); 182 | } 183 | if(enroll == 3) 184 | { 185 | out.println("\t\t\tEnrolled Successfully In B Bussiness Addministration"); 186 | } 187 | if(enroll == 4) 188 | { 189 | out.println("\t\t\tEnrolled Successfully In B Electrical Engineering"); 190 | } 191 | if(enroll == 5) 192 | { 193 | out.println("\t\t\tEnrolled Successfully In B Education Departement"); 194 | } 195 | if(enroll == 6) 196 | { 197 | out.println("\t\t\tEnrolled Successfully In Chartered Accountant"); 198 | } 199 | if(enroll == 7) 200 | { 201 | System.exit(enroll); 202 | } 203 | 204 | 205 | set_StudentSeatnumber(); 206 | out.println("\t\t\tStudent Seat Number: " + Stdent_Seatnumber); 207 | out.println(); 208 | 209 | } 210 | 211 | public void set_StudentSeatnumber() 212 | { 213 | Stdent_Id ++; 214 | this.Stdent_Seatnumber = Student_grdyear + " " + Stdent_Id; 215 | } 216 | 217 | 218 | 219 | 220 | 221 | 222 | public String toString() 223 | { 224 | // out.println("\t\t\t<-----Bio-Data----->"); 225 | // 226 | // out.println("\t\t\t Name: " + name); 227 | // out.println("\t\t\t Father Name: " + fathername); 228 | // out.println("\t\t\t Email-Id: " + email); 229 | // out.println("\t\t\t Number: " + number); 230 | // out.println("\t\t\tAddress: " + address); 231 | // 232 | // out.println("\t\t\t<-----Education Details----->"); 233 | // 234 | // out.println("\t\t\tMatric Marks: " + matricmrks); 235 | // out.println("\t\t\tInter Marks : " + intertotalmrks); 236 | // out.println("\t\t\tMatric Class Percentage: " + percentage + "%" ); 237 | // out.println("\t\t\tInter Class Percentage: " + percentage_inter + "%"); 238 | 239 | return "\t\t\t<-----Bio-Data----->\n" + 240 | "\n\t\t\tName:-----> " + name + 241 | "\n\t\t\tFatherName:-----> " + fathername + 242 | "\n\t\t\tEmail-Id:-----> " + email + 243 | "\n\t\t\tNumber:-----> " + number + 244 | "\n\t\t\tAddress:----->" + address + 245 | "\n" + 246 | "\n\t\t\t<-----Education Details----->\n" + 247 | "\n\t\t\tMatric Marks:-----> " + matricmrks + 248 | "\n\t\t\tInterMarks:-----> " + intermrks + 249 | "\n\t\t\tMatric Class Parcentage:-----> " + percentage + "%" + 250 | "\n\t\t\tInter Class Parcentage:-----> " + percentage_inter + "%" + 251 | "\n\t\t\tDepartement:----->" + enroll + 252 | "\n\t\t\tSeat Number:----->" + Stdent_Seatnumber + 253 | "\n\t\t\tFinally Form Submitted Successfully"; 254 | 255 | 256 | 257 | 258 | 259 | } 260 | } 261 | -------------------------------------------------------------------------------- /MainClass_Ploymorphism.java: -------------------------------------------------------------------------------- 1 | package Practice.poly_morphism; 2 | import static java.lang.System.out; 3 | public class MainClass_Ploymorphism 4 | { 5 | 6 | public static void main(String[] args) 7 | { 8 | 9 | Poly_Morphism p = new Poly_Morphism(); 10 | //Student_polymorphism student = new Student_polymorphism(); 11 | // Employ_polymorphism employee = new Employ_polymorphism(); 12 | Poly_Morphism obj = new Student_polymorphism(); 13 | 14 | //student.Show_info(); 15 | //p.Show_info(); 16 | //employee.Show_info(); 17 | 18 | 19 | p.name = "Dilbar"; 20 | p.Surname = "Malik"; 21 | p.Cnic = "43103-9024655-5"; 22 | p.age = 17; 23 | p.Show_info(); 24 | obj.Show_info(); 25 | obj.Show_info2(); 26 | 27 | 28 | out.println("Output is:-\n\n\n\n\n\n"); 29 | // student.cmsid= "023-20-0155"; 30 | // student.departement = "Computer Science"; 31 | //student.gpa = 3.4; 32 | // student.Surname = "Malik"; 33 | //// student.name = "Dilbar"; 34 | // student.Show_info2(); 35 | // out.println("\n\n\n\n\n\n"); 36 | // student.Show_info(); 37 | 38 | 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /MainClass_Uni.java: -------------------------------------------------------------------------------- 1 | package Practice.poly_morphism; 2 | 3 | public class MainClass_Uni 4 | { 5 | 6 | 7 | public static void main(String[] args) 8 | { 9 | University_polymorphism obj = new University_polymorphism(); 10 | Uper_Staff_uni obj1 = new Uper_Staff_uni(); 11 | Lower_Staff_uni obj2 = new Lower_Staff_uni(); 12 | 13 | obj.Show_File(); 14 | obj1.Show_File(); 15 | obj2.Show_File(); 16 | 17 | } 18 | 19 | 20 | } 21 | -------------------------------------------------------------------------------- /MainClass_p.java: -------------------------------------------------------------------------------- 1 | package Practice.poly_morphism; 2 | import static java.lang.System.out; 3 | public class MainClass_p 4 | { 5 | public static void main(String[] args) 6 | { 7 | Person_poly obj = new Person_poly(); 8 | Person_poly student = new Student_p(); 9 | Person_poly employee = new Employ_p(); 10 | Person_poly uperstaf = new Uper_staff_p(); 11 | Employ_p uperstafff = new Uper_staff_p(); 12 | 13 | 14 | obj.Showinfo(); 15 | out.println("\n\n"); 16 | student.Showinfo(); 17 | out.println("\n\n\n"); 18 | employee.Showinfo(); 19 | out.println("\n\n\n"); 20 | uperstaf.Showinfo(); 21 | uperstafff.Showinfo(); 22 | 23 | 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /Main_Class.java: -------------------------------------------------------------------------------- 1 | package Practice; 2 | 3 | public class Main_Class 4 | { 5 | 6 | public static void main(String args[]){ 7 | 8 | University uni = new University("Sukkur IBA University"); 9 | University.Students st = uni.new Students(); 10 | 11 | System.out.println("Number of Employees"+ uni.getter_nEmp()); 12 | uni.setter_nEmp(10); 13 | System.out.println(uni.getter_nEmp()); 14 | uni.showInfo_OuterClass(); 15 | st.showInfo_InnerClass(); 16 | } 17 | 18 | 19 | } 20 | -------------------------------------------------------------------------------- /Male_Faculty2.java: -------------------------------------------------------------------------------- 1 | package Projects; 2 | 3 | import static java.lang.System.out; 4 | import java.util.Scanner; 5 | 6 | class Male_Faculty2 extends Semseter_Project_Write 7 | { 8 | private String MF_firstname; 9 | private String MF_lastname; 10 | private int MF_gradeYear; 11 | private String MF_teacherID; 12 | private String MF_courses = ""; 13 | private int MF_salary = 0; 14 | private static int MF_costofSubject = 2500; 15 | private static int MF_id = 1000; 16 | 17 | 18 | public Male_Faculty2() 19 | { 20 | Scanner scan = new Scanner(System.in); 21 | out.println("\t\t\t<-------Here Is The Details Of Male-Faculty------->"); 22 | out.print("\t\t\tEnter First Name: ----> "); 23 | this.MF_firstname = scan.nextLine(); 24 | 25 | out.print("\t\t\tEnter Last Name: ----> "); 26 | this.MF_lastname = scan.nextLine(); 27 | 28 | out.print("\t\t\tPlease Enetr Any One Option That Which Faculty Member Belongs: " 29 | + "\n\t\t\t1-For Freshmen: \n\t\t\t2-For-Senior: \n\t\t\t3-For Junior:" 30 | + "\n\t\t\tThe Desired result:----> "); 31 | this.MF_gradeYear = scan.nextInt(); 32 | 33 | setMF_TeacherID(); 34 | out.println("\t\t\tTeacher ID:-----> " + MF_teacherID); 35 | 36 | } 37 | 38 | private void setMF_TeacherID() 39 | { 40 | MF_id++; 41 | this.MF_teacherID = MF_gradeYear + "" + MF_id; 42 | } 43 | 44 | public void tech() 45 | { 46 | out.print("\t\t\tEnter The Courses That Faculty Teacher Teach:---->" 47 | + "\n \t\t\tQ to Quit\n\t\t\t"); 48 | 49 | do 50 | { 51 | Scanner scan = new Scanner(System.in); 52 | String course = scan.nextLine(); 53 | out.print("\t\t\t"); 54 | if(!course.equals("Q")) 55 | { 56 | 57 | MF_courses = MF_courses + "\n"+ "\t\t\t" + course; 58 | MF_salary = MF_salary + MF_costofSubject; 59 | } 60 | else 61 | { 62 | break; 63 | } 64 | 65 | } 66 | while(1 != 0); 67 | out.println("Subjects teach:----> " +MF_courses); 68 | out.println("\t\t\tTutior Balance:----> " + MF_salary); 69 | 70 | } 71 | public void viewSalary() 72 | { 73 | out.println("\t\t\tYour Salary is:----> " + MF_salary); 74 | } 75 | 76 | public void payTuitor() 77 | { 78 | viewSalary(); 79 | out.print("\t\t\tEnter Your amount to transist:----> $"); 80 | Scanner scan = new Scanner(System.in); 81 | int pyment = scan.nextInt(); 82 | MF_salary = MF_salary - pyment; 83 | out.println("\t\t\tThank You For Your pyment transist:----> $" + pyment); 84 | viewSalary(); 85 | } 86 | 87 | public String toString() 88 | { 89 | return " \t\t\tName :----> " + MF_firstname + " " + MF_lastname+ 90 | "\n \t\t\tGrade level:----> " + MF_gradeYear + 91 | "\n\t\t\tTeacher ID :----> " + MF_teacherID + 92 | "\n\t\t\tCourses Tech:----> " + MF_courses + 93 | "\n\t\t\tSalary :----> " + MF_salary; 94 | 95 | 96 | } 97 | 98 | 99 | } 100 | -------------------------------------------------------------------------------- /Marks_Sheet.java: -------------------------------------------------------------------------------- 1 | package Practice; 2 | import static java.lang.System.out; 3 | import java.util.Scanner; 4 | public class Marks_Sheet 5 | { 6 | 7 | public static void main(String[] args) 8 | { 9 | int s1,s2,s3,r_number,Ob_m,Total_All,Ob_All; 10 | float Percentage = 0; 11 | String grade; 12 | int Tm = 100; 13 | String name; 14 | 15 | 16 | Scanner scan = new Scanner(System.in); 17 | out.println("\t\t Marks Sheet"); 18 | out.println(".........................................................."); 19 | out.print("Student Name:-\t"); name = scan.nextLine(); 20 | 21 | out.println("Enter The Roll Number Of the Student:-\t"); 22 | r_number = scan.nextInt(); 23 | out.println(".........................................................."); 24 | 25 | out.print("Enetr The S1 Marks:-\t"); 26 | s1 = scan.nextInt(); 27 | 28 | out.print("Enter The S2 Marks:-\t"); 29 | s2 = scan.nextInt(); 30 | out.print("Enter the S3 Marks:-\t"); 31 | s3 = scan.nextInt(); 32 | out.println(".........................................................."); 33 | out.println("Subject"+"\t\t Total Marks in"+"\t\tObtained Marks"); 34 | out.println(".........................................................."); 35 | out.println("S1"+"\t\t"+Tm+"\t\t\t"+s1); 36 | out.println("S2"+"\t\t"+Tm+"\t\t\t"+s2); 37 | out.println("S3"+"\t\t"+Tm+"\t\t\t"+s3); 38 | out.println(".........................................................."); 39 | Total_All = Tm+Tm+Tm; 40 | Ob_All = s1+s2+s3; 41 | out.println("Total Marks\t"+Total_All+"\tT_Obt: Marks\t"+Ob_All); 42 | out.println(".........................................................."); 43 | Percentage = (Ob_All*100)/Total_All; 44 | out.println("Percentage is:-"+Percentage+"%"); 45 | 46 | if(Percentage > 95 && Percentage <= 100) 47 | { 48 | grade = "A+"; 49 | out.println("Grade:-\t" + grade); 50 | } 51 | if(Percentage > 80 && Percentage <= 95) 52 | { 53 | grade = "B"; 54 | out.println("Grade:-\t" + grade); 55 | } 56 | if(Percentage > 70 && Percentage <= 80) 57 | { 58 | grade = "C"; 59 | out.println("Grade:-\t" + grade); 60 | } 61 | if(Percentage > 50 && Percentage <= 70) 62 | { 63 | grade = "D"; 64 | out.println("Grade:-" + grade); 65 | } 66 | if(Percentage > 40 && Percentage <=50) 67 | { 68 | grade = "E"; 69 | out.println("Grade:-\t" + grade); 70 | } 71 | if(Percentage < 40) 72 | { 73 | grade = "Fail"; 74 | out.println("Grade:-\t" + grade); 75 | } 76 | 77 | 78 | 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /Maths.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package maths; 7 | 8 | /** 9 | * 10 | * @author muzam 11 | */ 12 | public class Maths { 13 | 14 | /** 15 | * @param args the command line arguments 16 | */ 17 | 18 | 19 | public int sum(int a, int b){ 20 | 21 | return a+b; 22 | } 23 | public double sum(double a, double b){ 24 | 25 | return a + b; 26 | } 27 | public int sum(int a , int b, int c){ 28 | 29 | return a+b+c; 30 | 31 | } 32 | public static void main(String[] args) { 33 | // TODO code application logic here 34 | 35 | Maths math = new Maths(); 36 | 37 | int sum_of_two = math.sum(5,6); 38 | System.out.println("Sum of Two is :"+ sum_of_two); 39 | int sum_of_three = math.sum(5, 5,5); 40 | 41 | System.out.println("Sum of Three is :"+ sum_of_three); 42 | double double_sum = math.sum(2.0, 1); 43 | System.out.println("Double Sum is : "+double_sum); 44 | 45 | 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /Nested_Class.java: -------------------------------------------------------------------------------- 1 | package Lab_Tasks; 2 | import static java.lang.System.out; 3 | import java.util.Scanner; 4 | public class Nested_Class 5 | { 6 | public String name; 7 | public String Cms_id; 8 | public String university; 9 | public int semester; 10 | Student st; 11 | 12 | public Nested_Class(String name,String Cms_id,String university,int semester) 13 | { 14 | this.name = name; 15 | this.Cms_id = Cms_id; 16 | this.university = university; 17 | this.semester = semester; 18 | st = new Student(); 19 | } 20 | 21 | public String getter_Cms_id() 22 | { 23 | return this.Cms_id; 24 | } 25 | public void setter_Cms_id(String Cms_id) 26 | { 27 | this.Cms_id = Cms_id; 28 | 29 | } 30 | 31 | public void ShowInfo_outerClass() 32 | { 33 | out.println("Name:-\t" + name); 34 | out.println("Cms-Id:-" + Cms_id); 35 | out.println("University Name:-\t" + university); 36 | out.println("Semester Number:-\t"+ semester); 37 | out.println("Student age:-\t" + st.age); 38 | out.println("Student Gr Number:-\t" + st.gr_number); 39 | } 40 | public class Student 41 | { 42 | public int age = 19; 43 | public int gr_number = 102; 44 | 45 | public void ShowInfo_inner() 46 | { 47 | out.println("Name:-\t" + name); 48 | out.println("Cms-Id:-" + Cms_id); 49 | out.println("University Name:-\t" + university); 50 | out.println("Semester Number:-\t"+ semester); 51 | out.println("Age of Student:-\t" + age); 52 | out.println("Gr Number Student:-\t" + gr_number); 53 | } 54 | } 55 | public static void main(String[] args) 56 | { 57 | //Scanner scan = new Scanner(System.in); 58 | Nested_Class nested = new Nested_Class("Dilbar","023-20-0155","Sukkur Iba",'2'); 59 | Nested_Class.Student st = nested.new Student(); 60 | /* 61 | String name = scan.nextLine(); 62 | String Cms_id = scan.nextLine(); 63 | String university = scan.nextLine(); 64 | int semester = scan.nextInt(); 65 | int age = scan.nextInt(); 66 | int gr_number = scan.nextInt(); 67 | */ 68 | out.println("Cms_id:-\t" + nested.getter_Cms_id()); 69 | nested.setter_Cms_id("023-20-156"); 70 | 71 | out.println("Setter value is here:-\t" + nested.getter_Cms_id()); 72 | nested.ShowInfo_outerClass(); 73 | st.ShowInfo_inner(); 74 | 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /Nested_classes.java: -------------------------------------------------------------------------------- 1 | package Lab_Tasks; 2 | import java.util.Scanner; 3 | import static java.lang.System.out; 4 | public class Nested_classes 5 | { 6 | public String Class; 7 | private int stu; 8 | Students st; 9 | 10 | public Nested_classes(String Class) 11 | { 12 | this.Class = Class; 13 | this.stu = 110; 14 | st = new Students(); 15 | 16 | } 17 | 18 | public int getter_stu() 19 | { 20 | return this.stu; 21 | } 22 | 23 | public void setter_stu(int stu) 24 | { 25 | this.stu = stu; 26 | } 27 | 28 | public void ShowInfo_Outer() 29 | { 30 | out.println("Class Name is:-\t" + Class); 31 | out.println("Cms Id's:-\t" + stu); 32 | out.println("Students Name:-\t" + st.name); 33 | out.println("Students id:-\t" + st.id); 34 | 35 | } 36 | 37 | public class Students 38 | { 39 | public String name = "Ali"; 40 | public String id; 41 | 42 | public void ShowInfo_Inner() 43 | { 44 | out.println("Class Name:-\t" + Class); 45 | out.println("Cms-Id:-\t" + stu); 46 | out.println("Student Name:-\t"+ name); 47 | out.println("Student Id:-\t" + id); 48 | } 49 | } 50 | 51 | 52 | public static void main(String[] args) 53 | { 54 | 55 | Nested_classes user = new Nested_classes("BS/CS/SE-II"); 56 | Nested_classes.Students st = user.new Students(); 57 | 58 | out.println("Numbers Of Students:-\t" + user.getter_stu()); 59 | user.setter_stu(10); 60 | out.println(user.getter_stu()); 61 | user.ShowInfo_Outer(); 62 | st.ShowInfo_Inner(); 63 | 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /One_DArray1.java: -------------------------------------------------------------------------------- 1 | public class One_DArray1 2 | { 3 | 4 | public int [] array; 5 | 6 | 7 | 8 | 9 | public One_DArray1(int [] array) 10 | { 11 | 12 | this.array = array; 13 | //System.out.println(array[0]+""+array[1]); 14 | for(int i = 0; i=1;c--) 16 | { 17 | out.print("+"); 18 | } 19 | for(d=1;d<=2*b-1;d++) 20 | { 21 | out.print(" "); 22 | } 23 | for(c=a-b;c>=1;c--) 24 | { 25 | out.print("-"); 26 | } 27 | out.print("\n"); 28 | } 29 | 30 | for(b=a-1;b>=1;b--) 31 | { 32 | for(c=1;c<=a-b;c++) 33 | { 34 | out.print("-"); 35 | 36 | } 37 | for(d=1;d<=2*b-1;d++) 38 | { 39 | out.print(" "); 40 | } 41 | for(c=a-b;c>=1;c--) 42 | { 43 | out.print("+"); 44 | } 45 | out.print("\n"); 46 | } 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /Rombous_Program.java: -------------------------------------------------------------------------------- 1 | package Practice; 2 | import java.util.Scanner; 3 | import static java.lang.System.out; 4 | public class Rombous_Program 5 | { 6 | 7 | 8 | 9 | public static void main(String[] args) 10 | { 11 | int a = 15; 12 | int b,c,d; 13 | 14 | for(b=1; b<=a;b++) 15 | { 16 | for(c= a-b; c>=1; c--) 17 | { 18 | out.print("@"); 19 | } 20 | for(d = 1; d<=2*b-1;d++) 21 | { 22 | out.print(" "); 23 | } 24 | for(c = a-b;c>=1;c--) 25 | { 26 | out.print("$"); 27 | } 28 | out.print("\n"); 29 | } 30 | 31 | for(b= a-1;b >=1; b--) 32 | { 33 | for(c=1;c<=a-b;c++) 34 | { 35 | out.print("$"); 36 | } 37 | for(d =1 ;d<=2*b-1;d++) 38 | { 39 | out.print(" "); 40 | } 41 | for(c=a-b;c>=1;c--) 42 | { 43 | out.print("@"); 44 | } 45 | out.print("\n"); 46 | } 47 | 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /Rombous_Shape.java: -------------------------------------------------------------------------------- 1 | package Practice; 2 | import java.util.Scanner; 3 | import static java.lang.System.out; 4 | public class Rombous_Shape 5 | { 6 | 7 | public static void main(String[] args) 8 | { 9 | int a = 15; 10 | int b,c,d; 11 | for(b = 1;b<=a;b++) 12 | { 13 | for(c=a-b;c>=1;c--) 14 | { 15 | out.print("%"); 16 | } 17 | for(d=1;d<=2*b-1;d++) 18 | { 19 | out.print(" "); 20 | } 21 | for(c = a-b;c>=1;c--) 22 | { 23 | out.print("&"); 24 | } 25 | out.print("\n"); 26 | 27 | } 28 | for(b = a-1; b>=1;b--) 29 | { 30 | for(c = 1;c<=a-b;c++) 31 | { 32 | out.print("&"); 33 | } 34 | for(d =1;d<=2*b-1;d++) 35 | { 36 | out.print(" "); 37 | } 38 | for(c = a-b;c >=1;c--) 39 | { 40 | out.print("$"); 41 | } 42 | out.print("\n"); 43 | } 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /Semseter_Project_Write.java: -------------------------------------------------------------------------------- 1 | package Projects; 2 | import java.io.FileWriter; 3 | import static java.lang.System.out; 4 | import java.io.File; // Import the File class 5 | import java.io.FileNotFoundException; // Import this class to handle errors 6 | import java.util.Scanner; // Import the Scanner class to read text files 7 | 8 | public class Semseter_Project_Write 9 | { 10 | public static void main(String[] args) 11 | { 12 | int num; 13 | 14 | Scanner scan = new Scanner(System.in); 15 | out.println("\t\t\t<-------Wlcome to School Management System------->"); 16 | out.println("\t\t\t---------------------------------------------------"); 17 | out.print("\t\t\t Please Enter any one option for desired result: " 18 | + "\n \t\t\t1 For Male-Faculty: " 19 | + "\n \t\t\t2 For Female-Faculty: " 20 | + "\n \t\t\tand \n\t\t\t3 For For Lower Staff: " 21 | + "\n \t\t\tThe Desired option:----> "); num = scan.nextInt(); 22 | 23 | try 24 | { 25 | FileWriter myWriter = new FileWriter( "C:\\Users\\Agha\\Documents\\NetBeansProjects\\Lab_Tasks\\src\\Projects\\Semester_Project_Write.txt" ); 26 | myWriter.write("\t\t\tSecond Semester Mini_Project\n"); 27 | 28 | // //Main2 main2 = new Main2(); 29 | // Male_Faculty2 faculty = new Male_Faculty2(); 30 | // 31 | // faculty.tech(); 32 | // faculty.payTuitor(); /// For Single program 33 | // String fc; 34 | // fc = faculty.toString(); 35 | // 36 | // myWriter.write(fc); 37 | // myWriter.close(); 38 | if(num < 4 || num < 1) 39 | { 40 | if(num == 1) 41 | { 42 | Male_Faculty2 faculty = new Male_Faculty2(); 43 | 44 | faculty.tech(); 45 | faculty.payTuitor(); 46 | String fc; 47 | fc = faculty.toString(); 48 | myWriter.write(fc); 49 | myWriter.close(); 50 | 51 | } 52 | if(num == 2) 53 | { 54 | Female_Faculty2 Faculty = new Female_Faculty2(); 55 | Faculty.tech(); 56 | Faculty.payTuitor(); 57 | String fc; 58 | fc = Faculty.toString(); 59 | myWriter.write(fc); 60 | myWriter.close(); 61 | } 62 | if(num == 3) 63 | { 64 | Lower_Staff2 l_staff = new Lower_Staff2(); 65 | l_staff.Works(); 66 | l_staff.payWork(); 67 | String fc; 68 | fc = l_staff.toString(); 69 | myWriter.write(fc); 70 | myWriter.close(); 71 | } 72 | if(num == 4) 73 | { 74 | System.exit(num); 75 | } 76 | } 77 | 78 | try { 79 | File myObj = new File("C:\\Users\\Agha\\Documents\\NetBeansProjects\\Lab_Tasks\\src\\Projects\\Semester_Project_Write.txt"); 80 | Scanner myReader = new Scanner(myObj); 81 | while (myReader.hasNextLine()) 82 | { 83 | String data = myReader.nextLine(); 84 | System.out.println(data); 85 | } 86 | myReader.close(); 87 | } 88 | catch (FileNotFoundException e) 89 | { 90 | System.out.println("An error occurred."); 91 | e.printStackTrace(); 92 | } 93 | 94 | 95 | 96 | 97 | out.println("\t\t\t<-------Successfully we have written program------->"); 98 | 99 | 100 | } 101 | catch(Exception e) 102 | { 103 | out.println("An Error Occured"); 104 | e.printStackTrace(); 105 | } 106 | 107 | 108 | 109 | 110 | } 111 | 112 | 113 | } 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /Student_Class.java: -------------------------------------------------------------------------------- 1 | package Practice; 2 | import static java.lang.System.out; 3 | public class Student_Class 4 | { 5 | boolean name; 6 | int age; 7 | 8 | void ClassMate() 9 | { 10 | name = true; 11 | age = 10; 12 | } 13 | void Uni_Mate() 14 | { 15 | name = false; 16 | age = 20; 17 | } 18 | void MakeStudent(int newage) 19 | { 20 | age = newage; 21 | } 22 | void PrintState() 23 | { 24 | out.println("Current State:-"); 25 | out.println("Name:-" + name); 26 | out.println("Age:-" + age); 27 | 28 | } 29 | 30 | public static void main(String[] args) 31 | { 32 | Student_Class obj1 , obj2; 33 | obj1 = new Student_Class(); 34 | obj2 = new Student_Class(); 35 | 36 | obj1.ClassMate(); 37 | obj2.ClassMate(); 38 | 39 | obj1.Uni_Mate(); 40 | obj2.Uni_Mate(); 41 | 42 | obj1.MakeStudent(30); 43 | 44 | obj1.PrintState(); 45 | obj1.PrintState(); 46 | } 47 | 48 | 49 | } 50 | -------------------------------------------------------------------------------- /Student_p.java: -------------------------------------------------------------------------------- 1 | package Practice.poly_morphism; 2 | import static java.lang.System.out; 3 | public class Student_p extends Person_poly 4 | { 5 | public String Cmsid,surname; 6 | 7 | 8 | public Student_p() 9 | { 10 | //name = null; 11 | Cmsid = null; 12 | surname = null; 13 | } 14 | 15 | public void Showinfo() 16 | { 17 | //out.println("Name:-\t" + "Dilbar"); 18 | out.println("CMSID:-\t" + "023-20-0155"); 19 | out.println("Surname:-\t" + "Malik"); 20 | } 21 | 22 | 23 | } 24 | -------------------------------------------------------------------------------- /Student_polymorphism.java: -------------------------------------------------------------------------------- 1 | package Practice.poly_morphism; 2 | import static java.lang.System.out; 3 | public class Student_polymorphism extends Poly_Morphism 4 | { 5 | public String cmsid,departement; 6 | public double gpa; 7 | 8 | 9 | public Student_polymorphism() 10 | { 11 | cmsid = null; 12 | departement = null; 13 | gpa = 0.0; 14 | } 15 | 16 | @Override 17 | public void Show_info() 18 | { 19 | super.Show_info(); 20 | out.println("CMSid" + " 23894432"); 21 | 22 | out.println("Departement:-" + "Computer Science"); 23 | out.println("Gpa:-" + "3.4"); 24 | 25 | } 26 | 27 | 28 | 29 | } 30 | -------------------------------------------------------------------------------- /Table.java: -------------------------------------------------------------------------------- 1 | package Practice; 2 | import static java.lang.System.out; 3 | import java.util.Scanner; 4 | public class Table 5 | { 6 | 7 | 8 | 9 | public static void main(String[] args) 10 | { 11 | Scanner input = new Scanner(System.in); 12 | int number = input.nextInt(); 13 | int multiplier; 14 | // int num = number*multiplier; 15 | out.println("Inter The Number For Desired Result:- \t" + number); 16 | 17 | for(multiplier = 1; multiplier <=10;multiplier++) 18 | { 19 | out.println("Output is:- \t" + multiplier*number); 20 | 21 | } 22 | 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /TdArray.java: -------------------------------------------------------------------------------- 1 | public class TdArray 2 | { 3 | 4 | 5 | public int [][] array; 6 | 7 | public TdArray(int [][] array) 8 | { 9 | 10 | this.array = array; 11 | 12 | for(int i = 0; i<2;i++) 13 | { 14 | 15 | 16 | for(int j= 0;j<2;j++) 17 | { 18 | 19 | System.out.println(array[i][j]); 20 | 21 | } 22 | } 23 | 24 | } 25 | 26 | public static void main(String [] args) 27 | { 28 | int [][] array = new int [2][2]; 29 | 30 | array [0][0] = 500; 31 | array [0][1] = 1000; 32 | array [1][0] = 1500; 33 | array [1][1] = 2000; 34 | 35 | TdArray obj = new TdArray(array); 36 | 37 | 38 | } 39 | 40 | } -------------------------------------------------------------------------------- /Td_Array.java: -------------------------------------------------------------------------------- 1 | public class Td_Array 2 | { 3 | 4 | public int [][] array; 5 | 6 | 7 | 8 | 9 | public Td_Array(int [][] array) 10 | { 11 | 12 | this.array = array; 13 | //System.out.println(array[0]+""+ array[1]); 14 | //for(int i = 0; i=1;c--) 17 | { 18 | out.print("#"); 19 | } 20 | for(d = 1; d <= 2*b-1;d++) 21 | { 22 | out.print(" "); 23 | } 24 | for(c = a-b; c>=1;c--) 25 | { 26 | out.print("*"); 27 | } 28 | out.print("\n"); 29 | } 30 | 31 | for(b = a-1; b >= 1; b-- ) 32 | { 33 | for(c = 1; c <= a-b; c++) 34 | { 35 | out.print("*"); 36 | } 37 | for(d = 1; d<=2*b-1;d++) 38 | { 39 | out.print(" "); 40 | } 41 | for(c = a-b;c >=1;c--) 42 | { 43 | out.print("#"); 44 | 45 | } 46 | out.print("\n"); 47 | 48 | } 49 | 50 | 51 | 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /Triangle_Program_logic.java: -------------------------------------------------------------------------------- 1 | package Practice; 2 | import java.util.Scanner; 3 | import static java.lang.System.out; 4 | public class Triangle_Program_logic 5 | { 6 | 7 | 8 | public static void main(String[] args) 9 | { 10 | Scanner input = new Scanner(System.in); 11 | int a,b; 12 | 13 | for(a = 10; a >= 1;a--) 14 | 15 | { 16 | b = 1; 17 | while(b<=a) 18 | { 19 | out.print("#"); 20 | b++; 21 | } 22 | out.print("\n"); 23 | } 24 | 25 | 26 | for(int f=1;f <=10;f++) 27 | { 28 | int d = 1; 29 | while(d<=f) 30 | { 31 | out.print("*"); 32 | d++; 33 | } 34 | out.print("\n"); 35 | } 36 | 37 | } 38 | 39 | 40 | } 41 | -------------------------------------------------------------------------------- /Triangle_logic.java: -------------------------------------------------------------------------------- 1 | package Practice; 2 | import java.util.Scanner; 3 | import static java.lang.System.out; 4 | 5 | public class Triangle_logic 6 | { 7 | 8 | 9 | 10 | public static void main(String[] args) 11 | { 12 | Scanner input = new Scanner(System.in); 13 | int a,b; 14 | 15 | for(a = 1; a<=20;a++) 16 | { 17 | b = 1; 18 | while(b<=a) 19 | { 20 | out.print("*"); 21 | b++; 22 | 23 | } 24 | out.print("\n"); 25 | 26 | } 27 | 28 | 29 | } 30 | 31 | 32 | } 33 | -------------------------------------------------------------------------------- /Two_DArray1.java: -------------------------------------------------------------------------------- 1 | public class Two_DArray1 2 | { 3 | 4 | public int [][] array; 5 | 6 | 7 | 8 | 9 | public Two_DArray1(int [][] array) 10 | { 11 | 12 | this.array = array; 13 | //System.out.println(array[0]+""+ array[1]); 14 | //for(int i = 0; i