Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
eb2046f
Merge pull request #180 from ResilientSpring/SP7
ResilientSpring Aug 16, 2023
71bf06a
Merge pull request #181 from ResilientSpring/SP7
ResilientSpring Aug 16, 2023
a6608ff
Merge pull request #182 from ResilientSpring/master
ResilientSpring Aug 16, 2023
7e69611
Merge pull request #183 from ResilientSpring/SP7
ResilientSpring Aug 18, 2023
d351e74
Merge pull request #184 from ResilientSpring/SP7
ResilientSpring Aug 18, 2023
a4ebc96
Merge pull request #185 from ResilientSpring/SP7
ResilientSpring Aug 19, 2023
100d8d3
Merge pull request #186 from ResilientSpring/SP7
ResilientSpring Aug 27, 2023
48093ae
Committed on or around 2023/09/23
ResilientSpring Sep 23, 2023
96aa10c
Committed on or around 2023/09/23
ResilientSpring Sep 23, 2023
d73ba2f
Committed on or around 2023/09/23
ResilientSpring Sep 23, 2023
f3c9491
Committed on or around 2023/09/23
ResilientSpring Sep 23, 2023
075903c
Committed on or around 2023/09/23
ResilientSpring Sep 23, 2023
24092ca
Committed on or around 2023/09/23
ResilientSpring Sep 23, 2023
2a8ab0b
Commmitted on or around 2023/09/23
ResilientSpring Sep 23, 2023
cedd526
Committed on or around 2023/09/23
ResilientSpring Sep 23, 2023
60db255
Merge branch 'Laptop' of https://github.com/ResilientSpring/Example.g…
ResilientSpring Sep 23, 2023
4394f4c
Merge pull request #187 from ResilientSpring/Laptop
ResilientSpring Sep 23, 2023
8cd5b59
Committed on or around 2023/09/23
ResilientSpring Sep 23, 2023
34756d5
Committed on or around 2023/09/23
ResilientSpring Sep 23, 2023
7449ce5
Committed on or around 2023/09/23
ResilientSpring Sep 23, 2023
673c26a
Committed on or around 2023/09/23
ResilientSpring Sep 23, 2023
26bb2d0
Committed on or around 2023/09/23
ResilientSpring Sep 23, 2023
2a0483d
Committed on or around 2023/09/24
ResilientSpring Sep 23, 2023
7e4a4bf
Committed on or around 2023/09/24
ResilientSpring Sep 23, 2023
2781ec9
Committed on or around 2023/09/24
ResilientSpring Sep 23, 2023
f503208
Committed on or around 2023/09/24
ResilientSpring Sep 23, 2023
c910642
Committed on or around 2023/09/24
ResilientSpring Sep 23, 2023
e8028e0
Merge pull request #188 from ResilientSpring/Laptop
ResilientSpring Sep 23, 2023
0414f83
Committed on or around 2023/09/25
ResilientSpring Sep 25, 2023
f0fca0d
Merge pull request #189 from ResilientSpring/Laptop
ResilientSpring Sep 25, 2023
2194b0a
Committed on or around 2023/09/25
ResilientSpring Sep 25, 2023
d61a6bc
Committed on or around 2023/09/25
ResilientSpring Sep 25, 2023
28f88a7
Committed on or around 2023/09/25
ResilientSpring Sep 25, 2023
9ee09df
Committed on or around 2023/09/25
ResilientSpring Sep 25, 2023
46d42ee
Committed on or around 2023/09/25
ResilientSpring Sep 25, 2023
83e6682
Committed on or around 2023/09/25
ResilientSpring Sep 25, 2023
c216b38
Merge pull request #190 from ResilientSpring/Laptop
ResilientSpring Sep 25, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions 73 Chapter7/theoretical/Using_abstract_classes_2.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
package theoretical;

abstract class TwoDShapes{

private double width;
private double height;
private String name;

public TwoDShapes() {

width = height = 0.0;
name = "none";
}

TwoDShapes(double w, double h, String n){
width = w;
height = h;
name = n;
}

TwoDShapes(double x, String n){
width = height = x;
name = n;
}

// Construct an object from an object.
TwoDShapes(TwoDShapes ob){
width = ob.width;
height = ob.height;
name = ob.name;
}


double getWidth() {
return width;
}

double getHeight() {return height;}
void setWidth(double w) { width = w;}
void setHeight(double h) {height = h;}
String getName() {return name;}
void showDimension() {
System.out.println("Width and height are " + width + " and " + height);
}

// Now, area() is abstract.
abstract double area();
}


class Triangle extends TwoDShapes{

private String style;

public Triangle() {
// TODO Auto-generated constructor stub
super();
style = "none";
}

}


public class Using_abstract_classes_2 {

public static void main(String[] args) {
// TODO Auto-generated method stub



}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
package theoretical;

class TwoDShaper{

private double width;
private double height;

public TwoDShaper(double w, double h) {
// TODO Auto-generated constructor stub
}

double getWidth() {
return width;
}

double getHeight() {
return height;
}

void setWidth(double w) {
width = w;
}

void setHeight(double h) {
height = h;
}

void showDim() {

System.out.println("Width and height are " + width + " and " + height);
}

}


class Triangular extends TwoDShaper{

private String style;

public Triangular(String s, double w, double h) {
super(w, h);

style = s;
}

double area() {
return getWidth() * getHeight() / 2;
}

void showStyle() {
System.out.println("Triangle is " + style);
}
}

public class Using_super_to_call_superclass_constructor {

public static void main(String[] args) {

Triangular t1 = new Triangular("filled", 4.0, 4.0);
Triangular t2 = new Triangular("outlined", 8.0, 12.0);

System.out.println("Info for t1: ");
t1.showStyle();
t1.showDim();
System.out.println("Area is " + t1.area());

System.out.println();

System.out.println("Info for t2: ");
t2.showStyle();
t2.showDim();
System.out.println("Area is " + t2.area());

System.out.println();

System.out.println("Info for t2: ");
t2.showStyle();
t2.showDim();
System.out.println("Area is " + t2.area());

}

}
122 changes: 122 additions & 0 deletions 122 Chapter7/theoretical/Using_super_to_call_superclass_constructor_2.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
package theoretical;

class TwoDShaper_2{

private double width;
private double height;
private String title;

public TwoDShaper_2(double w, double h) {
// TODO Auto-generated constructor stub
}

public TwoDShaper_2() {
// TODO Auto-generated constructor stub
}

TwoDShaper_2(double width, double height, String title){

this.width = width;
this.height = height;
this.title = title;

}


double getWidth() {
return width;
}

double getHeight() {
return height;
}

void setWidth(double w) {
width = w;
}

void setHeight(double h) {
height = h;
}

void showDim() {

System.out.println("Width and height are " + width + " and " + height);
}

String showTitle() {
return title;
}

}


class Triangular_2 extends TwoDShaper_2{

private String style;

public Triangular_2() {
// TODO Auto-generated constructor stub
}

public Triangular_2(String s, double w, double h) {
super(w, h);

style = s;
}

Triangular_2(String style, String title, double width, double height){

super(width, height, title);

this.style = style;

}

double area() {
return getWidth() * getHeight() / 2;
}

void showStyle() {
System.out.println("Triangle is " + style);
}

String showTitle() {

return showTitle();

}

}


public class Using_super_to_call_superclass_constructor_2 {

public static void main(String[] args) {
// TODO Auto-generated method stub
Triangular_2 t1 = new Triangular_2("filled", 4.0, 4.0);
Triangular_2 t2 = new Triangular_2("outlined", 8.0, 12.0);
Triangular_2 t3 = new Triangular_2("Slovenly", "Classy", 8.0, 9.0);

System.out.println("Info for t1: ");
t1.showStyle();
t1.showDim();
System.out.println("Area is " + t1.area());

System.out.println();

System.out.println("Info for t2: ");
t2.showStyle();
t2.showDim();
System.out.println("Area is " + t2.area());

System.out.println();

System.out.println("Info for t3: ");
t3.showStyle();
t3.showDim();
t3.showTitle();
System.out.println("Area is " + t3.area());
}

}
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.