File tree Expand file tree Collapse file tree 4 files changed +71
-0
lines changed
39.Chapter_8_Practice_Set Expand file tree Collapse file tree 4 files changed +71
-0
lines changed Original file line number Diff line number Diff line change 1+ class Employee {
2+ int salary ;
3+ String name ;
4+
5+ public int getSalary () {
6+ return salary ;
7+ }
8+
9+ public String getName () {
10+ return name ;
11+ }
12+
13+ public void setName (String n ) {
14+ name = n ;
15+ }
16+ }
17+
18+ public class cwh_39_ps_pr_01 {
19+ public static void main (String args []) {
20+ Employee kishan = new Employee ();
21+ kishan .setName ("Let's Code Together" );
22+ kishan .salary = 50000 ;
23+
24+ //kishan.name = "Kishan";
25+
26+ System .out .println (kishan .getSalary ());
27+ System .out .println (kishan .getName ());
28+ }
29+ }
Original file line number Diff line number Diff line change 1+ class Cellphone {
2+ public void ring () {
3+ System .out .println ("ringing..." );
4+ }
5+
6+ public void vibrate () {
7+ System .out .println ("vibrating..." );
8+ }
9+
10+ public void call () {
11+ System .out .println ("calling your friend..." );
12+ }
13+ }
14+
15+ public class cwh_39_ps_pr_02 {
16+ public static void main (String args []) {
17+ Cellphone apple = new Cellphone ();
18+ apple .ring ();
19+ apple .vibrate ();
20+ apple .call ();
21+ }
22+ }
Original file line number Diff line number Diff line change 1+ class Circle {
2+ double radius ;
3+
4+ public double perimeter () {
5+ return (2 * radius * Math .PI );
6+ }
7+
8+ public double area () {
9+ return (Math .PI * radius * radius );
10+ }
11+ }
12+
13+ public class cwh_39_ps_pr_06 {
14+ public static void main (String args []) {
15+ Circle cir = new Circle ();
16+ cir .radius = 5.5 ;
17+ System .out .println (cir .perimeter ());
18+ System .out .println (cir .area ());
19+ }
20+ }
You can’t perform that action at this time.
0 commit comments