Bun1
This presentation is the property of its rightful owner.
Sponsored Links
1 / 14

class Bunsu1 PowerPoint PPT Presentation


  • 36 Views
  • Uploaded on
  • Presentation posted in: General

bun1. a. b. bunshi. bunbo. class Bunsu1. class Bunsu { private int bunshi; private int bunbo;. public static void main(String args[]) { Bunsu bun1 = new Bunsu(1,2); Bunsu bun2 = new Bunsu(1,3); Bunsu wa = bun1.plus(bun2); bun1.print(); System.out.print("+");

Download Presentation

class Bunsu1

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Class bunsu1

bun1

a

b

bunshi

bunbo

class Bunsu1

class Bunsu {

private int bunshi;

private int bunbo;

public static void main(String args[]) {

Bunsu bun1 = new Bunsu(1,2);

Bunsu bun2 = new Bunsu(1,3);

Bunsu wa = bun1.plus(bun2);

bun1.print();

System.out.print("+");

bun2.print();

System.out.print("=");

wa.print();

System.out.println();

}

2

1

Bunsu bun1 = new Bunsu(1,2);

Bunsu(int a, int b) { //コンストラクタ

void print() { //分数を表示

Bunsu plus(Bunsu other) { //足し算

コピー

Bunsu オブジェクト

Bunsu(int a, int b) {

void print() {

Bunsu plus(Bunsu other) {

Bunsu(int a, int b) {

if(b < 0) { …}

bunshi = a;

bunbo = b;

}


Class bunsu1

bun1

a

1

b

2

bunbo

bunshi

class Bunsu1

class Bunsu {

private int bunshi;

private int bunbo;

public static void main(String args[]) {

Bunsu bun1 = new Bunsu(1,2);

Bunsu bun2 = new Bunsu(1,3);

Bunsu wa = bun1.plus(bun2);

bun1.print();

System.out.print("+");

bun2.print();

System.out.print("=");

wa.print();

System.out.println();

}

Bunsu bun1 = new Bunsu(1,2);

Bunsu(int a, int b) { //コンストラクタ

void print() { //分数を表示

Bunsu plus(Bunsu other) { //足し算

Bunsu オブジェクト

void print() {

Bunsu plus(Bunsu other) {

Bunsu(int a, int b) {

if(b < 0) { …}

bunshi = a;

bunbo = b;

}

1

bunshi = a;


Class bunsu1

bun1

a

1

b

2

bunbo

bunshi

1

class Bunsu1

class Bunsu {

private int bunshi;

private int bunbo;

public static void main(String args[]) {

Bunsu bun1 = new Bunsu(1,2);

Bunsu bun2 = new Bunsu(1,3);

Bunsu wa = bun1.plus(bun2);

bun1.print();

System.out.print("+");

bun2.print();

System.out.print("=");

wa.print();

System.out.println();

}

Bunsu bun1 = new Bunsu(1,2);

Bunsu(int a, int b) { //コンストラクタ

void print() { //分数を表示

Bunsu plus(Bunsu other) { //足し算

Bunsu オブジェクト

void print() {

Bunsu plus(Bunsu other) {

Bunsu(int a, int b) {

if(b < 0) { …}

bunshi = a;

bunbo = b;

}

2

bunbo = b;


Class bunsu1

bun1

a

1

b

2

bunshi

bunbo

2

1

class Bunsu1

class Bunsu {

private int bunshi;

private int bunbo;

public static void main(String args[]) {

Bunsu bun1 = new Bunsu(1,2);

Bunsu bun2 = new Bunsu(1,3);

Bunsu wa = bun1.plus(bun2);

bun1.print();

System.out.print("+");

bun2.print();

System.out.print("=");

wa.print();

System.out.println();

}

Bunsu bun1 = new Bunsu(1,2);

Bunsu(int a, int b) { //コンストラクタ

void print() { //分数を表示

Bunsu plus(Bunsu other) { //足し算

Bunsu オブジェクト

void print() {

Bunsu plus(Bunsu other) {

Bunsu(int a, int b) {

if(b < 0) { …}

bunshi = a;

bunbo = b;

}


Class bunsu1

bun1

bun2

bunbo

bunshi

bunbo

bunshi

1

3

1

2

class Bunsu1

class Bunsu {

private int bunshi;

private int bunbo;

Bunsu(int a, int b)

public static void main(String args[]) {

Bunsu bun1 = new Bunsu(1,2);

Bunsu bun2 = new Bunsu(1,3);

Bunsu wa = bun1.plus(bun2);

bun1.print();

System.out.print("+");

bun2.print();

System.out.print("=");

wa.print();

System.out.println();

}

void print() {

Bunsu bun2 = new Bunsu(1,3);

Bunsu plus(Bunsu other)

Bunsu オブジェクト

Bunsu(int a, int b)

void print() {

Bunsu plus(Bunsu other)

Bunsu オブジェクト

Bunsu(int a, int b)

void print() {

Bunsu plus(Bunsu other)


Class bunsu1

bun2

bun1

other

wa

bunbo

bunshi

bunshi

bunbo

3

1

2

1

class Bunsu1

class Bunsu {

private int bunshi;

private int bunbo;

Bunsu(int a, int b)

public static void main(String args[]) {

Bunsu bun1 = new Bunsu(1,2);

Bunsu bun2 = new Bunsu(1,3);

Bunsu wa = bun1.plus(bun2);

bun1.print();

System.out.print("+");

bun2.print();

System.out.print("=");

wa.print();

System.out.println();

}

void print() {

Bunsu plus(Bunsu other)

Bunsu wa = bun1.plus(bun2);

Bunsu オブジェクト

Bunsu(int a, int b)

void print() {

Bunsu plus(Bunsu other)

Bunsu plus(Bunsu other) {

int newBunshi = this.bunshi*other.bunbo + ...

int newBunbo = this.bunbo*other.bunbo;

Bunsu p = new Bunsu(newBunshi,…

return p;

}

Bunsu オブジェクト

Bunsu(int a, int b)

void print() {

Bunsu plus(Bunsu other)


Class bunsu1

this

bun2

bun1

other

wa

newBunshi

bunshi

bunbo

bunshi

bunbo

1

2

1

3

class Bunsu {

private int bunshi;

private int bunbo;

Bunsu(int a, int b)

class Bunsu1

void print() {

Bunsu plus(Bunsu other)

Bunsu オブジェクト

1

2

Bunsu plus(Bunsu other) {

int newBunshi =

this.bunshi*other.bunbo +

other.bunshi+this.bunbo;

int newBunbo = this.bunbo*other.bunbo;

Bunsu p =

new Bunsu(newBunshi,newBunbo);

return p;

}

int newBunshi =

1 × 3 = 3

this.bunshi * other.bunbo +

1 × 2 = 2

other.bunshi * this.bunbo;

3 + 2 = 5

5

Bunsu オブジェクト

1

3


Class bunsu1

this

other

bun1

bun2

wa

newBunbo

newBunshi

5

bunbo

bunshi

bunshi

bunbo

1

1

3

2

class Bunsu {

private int bunshi;

private int bunbo;

Bunsu(int a, int b)

class Bunsu1

void print() {

Bunsu plus(Bunsu other)

Bunsu オブジェクト

2

Bunsu plus(Bunsu other) {

int newBunshi =

this.bunshi*other.bunbo +

other.bunshi+this.bunbo;

int newBunbo = this.bunbo*other.bunbo;

Bunsu p =

new Bunsu(newBunshi,newBunbo);

return p;

}

2 × 3 = 6

int newBunbo = this.bunbo * other.bunbo;

6

Bunsu オブジェクト

3


Class bunsu1

this

bun2

other

bun1

wa

newBunshi

newBunbo

p

5

6

bunshi

bunshi

bunshi

bunbo

bunbo

bunbo

1

3

2

1

class Bunsu {

private int bunshi;

private int bunbo;

Bunsu(int a, int b)

class Bunsu1

void print() {

Bunsu plus(Bunsu other)

Bunsu オブジェクト

Bunsu plus(Bunsu other) {

int newBunshi =

this.bunshi*other.bunbo +

other.bunshi+this.bunbo;

int newBunbo = this.bunbo*other.bunbo;

Bunsu p =

new Bunsu(newBunshi,newBunbo);

return p;

}

Bunsu p =

new Bunsu(newBunshi,newBunbo);

Bunsu オブジェクト

5

6

Bunsu オブジェクト


Class bunsu1

bun1

bun2

other

wa

newBunbo

newBunshi

p

6

5

bunbo

bunshi

bunbo

bunbo

bunshi

bunshi

1

2

1

5

3

6

class Bunsu1

Bunsu オブジェクト

public static void main(String args[]) {

Bunsu bun1 = new Bunsu(1,2);

Bunsu bun2 = new Bunsu(1,3);

Bunsu wa = bun1.plus(bun2);

bun1.print();

System.out.print("+");

bun2.print();

System.out.print("=");

wa.print();

System.out.println();

}

Bunsu wa = bun1.plus(bun2);

Bunsu plus(Bunsu other) {

int newBunshi =

this.bunshi*other.bunbo +

other.bunshi+this.bunbo;

int newBunbo = this.bunbo*other.bunbo;

Bunsu p =

new Bunsu(newBunshi,newBunbo);

return p;

}

return p;

Bunsu オブジェクト

Bunsu オブジェクト


Class bunsu1

bun1

bun2

wa

bunbo

bunshi

bunshi

bunbo

bunbo

bunshi

3

2

5

6

1

1

class Bunsu1

Bunsu オブジェクト

Bunsu(int a, int b)

public static void main(String args[]) {

Bunsu bun1 = new Bunsu(1,2);

Bunsu bun2 = new Bunsu(1,3);

Bunsu wa = bun1.plus(bun2);

bun1.print();

System.out.print("+");

bun2.print();

System.out.print("=");

wa.print();

System.out.println();

}

void print() {

Bunsu plus(Bunsu other)

void print() {

if(bunbo==1) { … }

else {

System.out.print(“(“+bunshi+”/”+bunbo+”)”);

}

}

bun1.print();

System.out.print(“(“+bunshi+”/”+bunbo+”)”);

Bunsu オブジェクト

Bunsu オブジェクト

(1/2)


Class bunsu1

bun2

bun1

wa

bunshi

bunshi

bunbo

bunbo

bunbo

bunshi

1

3

5

1

6

2

class Bunsu1

Bunsu オブジェクト

Bunsu(int a, int b)

public static void main(String args[]) {

Bunsu bun1 = new Bunsu(1,2);

Bunsu bun2 = new Bunsu(1,3);

Bunsu wa = bun1.plus(bun2);

bun1.print();

System.out.print("+");

bun2.print();

System.out.print("=");

wa.print();

System.out.println();

}

void print() {

Bunsu plus(Bunsu other)

System.out.print(“+”);

Bunsu オブジェクト

Bunsu オブジェクト

(1/2)

+


Class bunsu1

bun2

bun1

wa

bunshi

bunshi

bunbo

bunbo

bunbo

bunshi

1

3

5

1

6

2

class Bunsu1

Bunsu オブジェクト

Bunsu(int a, int b)

public static void main(String args[]) {

Bunsu bun1 = new Bunsu(1,2);

Bunsu bun2 = new Bunsu(1,3);

Bunsu wa = bun1.plus(bun2);

bun1.print();

System.out.print("+");

bun2.print();

System.out.print("=");

wa.print();

System.out.println();

}

void print() {

Bunsu plus(Bunsu other)

bun2.print();

System.out.print(“=”);

Bunsu オブジェクト

Bunsu オブジェクト

(1/2)+

(1/3)=


Class bunsu1

bun2

bun1

wa

bunshi

bunshi

bunbo

bunbo

bunbo

bunshi

1

3

5

1

6

2

class Bunsu1

Bunsu オブジェクト

Bunsu(int a, int b)

public static void main(String args[]) {

Bunsu bun1 = new Bunsu(1,2);

Bunsu bun2 = new Bunsu(1,3);

Bunsu wa = bun1.plus(bun2);

bun1.print();

System.out.print("+");

bun2.print();

System.out.print("=");

wa.print();

System.out.println();

}

void print() {

Bunsu plus(Bunsu other)

wa.print();

System.out.println();

Bunsu オブジェクト

Bunsu オブジェクト

(1/2)+(1/3)=

(5/6)


  • Login