This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Lab32 { | |
public static int fac(int n){ | |
if(n == 0) | |
return 1; | |
else | |
return n * fac(n - 1); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package oot.lab5.group1.jacket; | |
public class Arm { | |
private String color; | |
public Arm(String color){ | |
this.color = color; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class No1 { | |
public static void main(String[] args) { | |
Robot r = new Robot(); | |
r.calculate(2); | |
r.calculate(5); | |
r.calculate(8); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class No2 { | |
public static void main(String[] args) { | |
People p1 = new People("John"); | |
People p2 = new People("Jack", 30); | |
System.out.println(p1.getName() + " is " + p1.getAge() + " years old."); | |
System.out.println(p2.getName() + " is " + p2.getAge() + " years old."); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Dog { | |
private String name; | |
Dog(String name) { | |
this.name = name; | |
} | |
public void bite(Student s) { | |
System.out.println(this.name + " bites " + s.getName()); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Cat{ | |
Cat() { | |
System.out.println("I'm a cat"); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Collar { | |
private String color; | |
private int price; | |
Collar(String color) { | |
this.color = color; | |
this.price = 200; | |
} | |
public String getColor() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package oot.lab5.group2.bike; | |
public class Bike { | |
private String brand; | |
private Wheel frontWheel; | |
private Wheel rearWheel; | |
public void setBrand(String brand){ | |
this.brand = brand; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class No1 { | |
public static void main(String[] args){ | |
Scanner sc = new Scanner(System.in); | |
System.out.print("Enter size: "); | |
int size = sc.nextInt(); | |
int i = 0, n = 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package labtest.no2; | |
import java.util.Scanner; | |
public class No2 { | |
public static void main(String[] args){ | |
Scanner sc = new Scanner(System.in); | |
System.out.print("Enter gen : "); | |
char ch = sc.next().charAt(0); |
OlderNewer