/*
import java.util.*;
class student {
// 1. field
private String name;
int korScore, mathScore, engScore;
float mean;
int ranking;
//2. constructor
student() {
}
student(String name, int korScore, int mathScore, int engScore) {
this.name = name;
this.korScore = korScore;
this.mathScore = mathScore;
this.engScore = engScore;
this.mean = (float)((this.korScore + this.mathScore + this.engScore) / 3.0);
System.out.println(this.mean);
this.ranking=1;
}
// 3. method
String getName() {
return this.name;
}
void setName(String name) {
this.name=name;
}
}
public class Main {
public static void main(String[] args) {
Scanner t = new Scanner(System.in);
student []x = new student[5];
for(int i=0; i<5; i++) {
String name = t.next();
int kor = t.nextInt();
int math = t.nextInt();
int eng = t.nextInt();
x[i] = new student(name, kor, math, eng);
}
float max = -1;
float min = 2147483647;
String getName = "";
int rank = 1;
//x[3].name = "hi";
x[3].setName("hi");
//x[0] ~ x[4]
for(int i=0; i<x.length; i++) {
System.out.println(x[i].getName());
}
// System.out.println( getName.toString()+"is on the podium");
// descending sort ver1.
// for(int i=0; i<x.length; i++) {
// int max_index = 0;
// for(int j=0; j<x.length; j++) {
// if(x[max_index].mean < x[j].mean) {
// max_index=j;
// }
// }
// System.out.println(x[max_index].name + x[max_index].mean);
// x[max_index].mean=0;
// }
//descending sort ver2.
// for(int i=0; i<x.length; i++) {
// // x[i].mean의 랭킹 구하기
// for(int j=0; j<x.length; j++) {
// if(x[i].mean < x[j].mean) {
// x[i].ranking++;
// }
// }
// System.out.println(x[i].name+"은/는 "+x[i].ranking+"등 입네다");
// }
}
}
*/
//import java.util.*;
//class Person{
// String name;
// int age;
//
// public Person() {
// this.name = "name";
// this.age = 100;
// System.out.println("Person Constructer 1");
// }
// public Person(String name, int age) {
// System.out.println("Person Constructer 2");
// this.name = name;
// this.age = age;
// }
//
// void speak() {
// System.out.println("My name is "+ name+" and my age is "+age);
// }
//}
//
//// Class Inheritance ( super class, sub class)
//class Student extends Person{
// String school;
// int grade;
// public Student() {
// super("noname",100); // explicit call
// System.out.println("Student Constructer1");
// }
// public Student(String school, int grade) {
// super();
// System.out.println("Student Constructer2");
// }
//
// void speak() { //재정의 re-define overriding
// super.speak();
// System.out.println("hello");
// }
//
//}
//// 1. Teacher class 생성 ( + subject field)
//// 2. speak method overriding -> super.speak() + subject도 함께 소개하기
//class teacher extends Person{
// String subject;
// public teacher(String subject) {
//
// this.subject= "Individuals and Society";
// }
// void speak() {
// super.speak();
// System.out.println(subject);
// }
//}
//
//
////Object Oriented Programming -> 객체 지향 프로그래밍
//class Mid_Stu extends Student{
//
//}
//
//public class Main {
// public static void main(String[] args) {
// Student x = new Student("hello",7);
// x.speak();
//
// teacher y = new teacher("Individuals and Society");
// y.speak();
// }
//}
/*
class Circle {
private int radius;
public Circle(int radius) {
this.radius = radius;
}
public int getRadius() {
return radius;
}
}
class NamedCircle extends Circle {
String name;
public NamedCircle(int a, String name) {
super(a);
this.name = name;
}
void show() {
System.out.println(name+","+"반지름은"+getRadius());
}
}
public class Main {
public static void main(String[] args) {
NamedCircle w = new NamedCircle(5, "waffle");
w.show();
}
}
*/
//class point {
// private int x, y;
//
// public point(int x, int y) {
// this.x = x;
// this.y = y;
// }
// public int getX() {
// return x;
// }
// public int getY() {
// return y;
// }
// protected void move(int x, int y) {
// this.x = x;
// this.y = y;
// }
//}
//class Colorpoint extends point {
// String color;
// public Colorpoint (int x, int y, String color) {
// super(x, y);
// this.color = color;
// }
// void setpoint(int x, int y) {
// move(x, y);
// }
// void setColor(String color) {
// this.color = color;
// }
// void show() {
// System.out.println(color+"색으로"+"("+getX()+","+ getY()+")");
// }
//}
//public class Main {
// public static void main(String[] args) {
// Colorpoint cp = new Colorpoint(5, 5, "YELLOW");
// cp.setpoint(10, 20);
// cp.setColor("GREEN");
// cp.show();
//
// }
//}
//
//class Pen{
// private int amount;
//
// public int getAmount() {
// return amount;
// }
//
// public void setAmount(int amount) {
// this.amount = amount;
// }
//}
//class SharpPencil extends Pen{
// int width;
//}
//
//class BallPen extends Pen {
// private String color;
//
// public String getColor() {
// return color;
// }
//
// public void setColor(String color) {
// this.color = color;
// }
//}
//
//class FountainPen extends BallPen {
// public void refil(int n) {
// setAmount(n);
// }
//}
//class TV {
// private int size;
// public TV(int size) {
// this.size = size;
// }
// protected int getSize() {
// return size;
// }
//}
//class ColorTV extends TV {
// private int color;
// public ColorTV(int size,int color) {
// super(size);
// this.color = color;
// }
// protected int getColor() {
// return color;
// }
// void printproperty() {
// System.out.println(getSize()+"인치 "+color+"컬러");
// }
//}
//class IPTV extends ColorTV {
// private String IP;
// public IPTV(String IP, int size, int color) {
// super(size, color);
// this.IP = IP;
// }
// void printproperty() {
// System.out.println("나의 IPTV는 "+IP+" 주소의 "+ getSize()+"인치"+getColor()+"컬러");
// }
//}
//public class Main {
// public static void main(String[] args) {
// ColorTV myTV = new ColorTV(32, 1024);
// myTV.printproperty();
// IPTV iptv = new IPTV("192.1.1.2", 32, 2048);
// iptv.printproperty();
// }
//}
//
import java.util.Scanner;
abstract class Converter {
abstract protected double converter(double src);
abstract protected String getSrcString();
abstract protected String getDestString();
protected double ratio;
public void run() {
Scanner t = new Scanner(System.in);
System.out.println(getSrcString() + "을 " + getDestString() + "로 바꿉니다.");
System.out.println(getSrcString() + "을 입력하세요>> ");
double va1 = t.nextDouble();
double res = converter(va1);
System.out.println("변환 결과: " + res + getDestString() + "입니다");
t.close();
}
}
class Won2Dollar extends Converter {
public Won2Dollar(double ratio) {
this.ratio = ratio;
}
protected double converter(double src) {
return src/ratio;
}
protected String getSrcString() {
return "원";
}
protected String getDestString() {
return "달러";
}
}
public class Main {
public static void main(String[] args) {
Won2Dollar toDollar = new Won2Dollar(1200);
toDollar.run();
}
}