Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Graph {
- Axis Ox=new Axis();
- Axis Oy=new Axis();
- Grid grid=new Grid();
- Legend legend=new Legend();
- void CreateGraph(Curve curve,int a,int b){
- Legend legend1=new Legend();
- legend1.AddLegend(curve);
- this.legend=legend1;
- Ox.ChangeAxis(0,10,1);
- Oy.ChangeAxis(0,10,1);
- Ox.show();
- Oy.show();
- curve.Tab(a,b);
- grid.CreateGrid(Ox,Oy);
- grid.show();
- }
- void addCurve(Curve curve,int a,int b){
- Legend legend2=new Legend();
- legend2.AddLegend(curve);
- curve.Tab(a,b);
- }
- }
- class Axis{
- private double a;
- private double b;
- private double step;
- double getA(){
- return a;
- }
- double getB(){
- return b;
- }
- double getStep(){
- return step;
- }
- Axis(){}
- Axis(double start,double end,double mystep){
- this.a=start;
- this.b=end;
- this.step=mystep;
- }
- void ChangeAxis(double start,double end,double mystep){
- this.a=start;
- this.b=end;
- this.step=mystep;
- }
- void show(){
- System.out.println("Начало оси: "+a);
- System.out.println("Конец оси: "+b);
- System.out.println("Шаг оси: "+step);
- System.out.println();
- }
- }
- public class Curve {
- double[] x;
- double[] y;
- private String name;
- private String color;
- String getName(){
- return name;
- }
- String getColor(){
- return color;
- }
- Curve(double x1[],double y1[],String name1,String color1){
- this.x=x1;
- this.y=y1;
- this.name=name1;
- this.color=color1;
- }
- void Tab(int a,int b){
- for(int i=a;i<b;i++){
- System.out.println("x: "+x[i]+" "+"y: "+y[i]);
- }
- System.out.println();
- }
- }
- import java.sql.SQLOutput;
- public class Grid {
- private double step1=0;
- private double step2=0;
- private double step3=0;
- double getStep1(){
- return step1;
- }
- double getStep2(){
- return step2;
- }
- double getStep3(){
- return step3;
- }
- void CreateGrid(Axis Ox, Axis Oy) {
- this.step1=Ox.getStep();
- this.step2=Oy.getStep();
- }
- void show(){
- System.out.println("Шаг 1: "+getStep1());
- System.out.println("Шаг 2: "+getStep2());
- System.out.println("Шаг 3: "+getStep3());
- System.out.println();
- }
- }
- public class Legend {
- void AddLegend(Curve curve){
- System.out.println("Легенда: ");
- System.out.println("----- "+curve.getName());
- System.out.println();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment