Давно ещё робота рисовал,код правда можно раз в 100 упростить,но мне лень.Может пригодится.
uses crt,graph; var gd,gm:integer; begin gd:=vga; gm:=vgahi; initgraph (gd,gm,''); if graphresult <> 0 then closegraph else begin setcolor (7); rectangle (300,60,340,100); line (312,60,312,45); line (327,60,327,45); circle (312,40,5); circle (327,40,5); setcolor (10); rectangle (295,65,300,90); rectangle (340,65,345,90); rectangle (310,75,315,70); rectangle (325,75,330,70); rectangle (310,85,330,90); line (320,70,320,80); line (297,67,297,88); line (342,67,342,88); line (314,85,314,90); line (326,85,326,90); putpixel (312,72,white); putpixel (327,72,white); line (310,100,310,110); line (330,100,330,110); line (310,110,275,110); line (330,110,365,110); setcolor (6); line (275,110,275,175); line (275,175,280,185); line (280,185,285,175); line (285,175,285,122); line (285,122,294,122); line (365,110,365,185); line (365,185,362,185); line (362,185,362,178); line (362,178,360,178); line (360,178,360,185); line (360,185,356,185); line (356,185,356,122); line (356,122,347,122); setcolor (3); rectangle (294,122,347,200); line (360,110,360,95); circle (360,92,3); line (280,110,280,95); circle (280,92,3); rectangle (310,122,330,200); line (310,140,330,140); line (310,180,330,180); setcolor (darkgray); circle (302,140,3); circle (302,180,3); circle (338,140,3); circle (338,180,3); setcolor (lightgray); rectangle (278,122,280,160); line (338,112,338,119); line (340,112,340,119); line (342,112,342,119); line (363,140,363,160); line (358,140,358,160); line (347,200,347,210); line (294,200,294,210); line (294,210,220,240); line (347,210,421,240); line (220,240,220,258); line (421,240,421,258); line (220,240,421,240); line (220,242,421,242); arc (225,256,180,270,5); arc (416,256,270,360,5); line (225,261,416,261); setcolor (brown); circle (231,252,8); circle (231,252,2); circle (252,252,8); circle (252,252,2); circle (272,252,8); circle (272,252,2); circle (292,252,8); circle (292,252,2); circle (312,252,8); circle (312,252,2); circle (332,252,8); circle (332,252,2); circle (352,252,8); circle (352,252,2); circle (372,252,8); circle (372,252,2); circle (392,252,8); circle (392,252,2); circle (411,252,8); circle (411,252,2); setlinestyle (0,0,3); line (300,202,300,210); line (341,202,341,210); setlinestyle (0,0,0); setcolor (white); line (302,204,339,204); line (302,206,339,206); line (302,208,339,208); end; readkey; end.
чу-чуть запутался с условием, но вроде-как всё правильно работает :D
import java.util.Scanner;
class Main {
public static class Phone {
public int number;
public String model;
public int weight;
String name = "John"; // Имя звонящего
public void receiveCall() {
System.out.println("Звонит " + name);
}
public void receiveCall(String name, int num) {
System.out.println("Звонит " + name + "\n" + num);
}
public void getNumber() {
System.out.println(number);
}
public void sendMessage(int num1, int num2) {
System.out.println(num1 + "\n" + num2);
}
public Phone(int a, String b, int c) {
number = a;
model = b;
weight = c;
Phone ph = new Phone(1, "model");
}
public Phone(int a, String b) {
number = a;
model = b;
}
public Phone() {}
}
static int getNum() {
Scanner num = new Scanner(System.in);
return num.nextInt();
}
static String getStr() {
Scanner str = new Scanner(System.in);
return str.nextLine();
}
public static void main(String [ ] args) {
Phone ph1 = new Phone();
Phone ph2 = new Phone();
Phone ph3 = new Phone();
Phone ph = new Phone();
System.out.print("Введите номер 1-го телефона: ");
ph1.number = getNum();
System.out.print("Введите его модель: ");
ph1.model = getStr();
System.out.print("Вес: ");
ph1.weight = getNum();
System.out.print("Введите номер 2-го телефона: ");
ph2.number = getNum();
System.out.print("Введите его модель: ");
ph2.model = getStr();
System.out.print("Вес: ");
ph2.weight = getNum();
System.out.print("Введите номер 3-го телефона: ");
ph3.number = getNum();
System.out.print("Введите его модель: ");
ph3.model = getStr();
System.out.print("Вес: ");
ph3.weight = getNum();
System.out.println(ph1.number + " " + ph1.model + " " + ph1.weight);
System.out.println(ph2.number + " " + ph2.model + " " + ph2.weight);
System.out.println(ph3.number + " " + ph3.model + " " + ph3.weight);
System.out.println();
ph1.receiveCall();
ph1.getNumber();
System.out.println();
ph2.receiveCall();
ph2.getNumber();
System.out.println();
ph3.receiveCall();
ph3.getNumber();
ph1 = new Phone(ph1.number, ph1.model, ph1.weight);
ph2 = new Phone(ph2.number, ph2.model);
ph.receiveCall(ph1.name, ph2.number);
ph.sendMessage(ph1.number, ph2.number);
}
}
Давно ещё робота рисовал,код правда можно раз в 100 упростить,но мне лень.Может пригодится.
uses crt,graph;
var
gd,gm:integer;
begin
gd:=vga;
gm:=vgahi;
initgraph (gd,gm,'');
if graphresult <> 0 then closegraph else
begin
setcolor (7);
rectangle (300,60,340,100);
line (312,60,312,45);
line (327,60,327,45);
circle (312,40,5);
circle (327,40,5);
setcolor (10);
rectangle (295,65,300,90);
rectangle (340,65,345,90);
rectangle (310,75,315,70);
rectangle (325,75,330,70);
rectangle (310,85,330,90);
line (320,70,320,80);
line (297,67,297,88);
line (342,67,342,88);
line (314,85,314,90);
line (326,85,326,90);
putpixel (312,72,white);
putpixel (327,72,white);
line (310,100,310,110);
line (330,100,330,110);
line (310,110,275,110);
line (330,110,365,110);
setcolor (6);
line (275,110,275,175);
line (275,175,280,185);
line (280,185,285,175);
line (285,175,285,122);
line (285,122,294,122);
line (365,110,365,185);
line (365,185,362,185);
line (362,185,362,178);
line (362,178,360,178);
line (360,178,360,185);
line (360,185,356,185);
line (356,185,356,122);
line (356,122,347,122);
setcolor (3);
rectangle (294,122,347,200);
line (360,110,360,95);
circle (360,92,3);
line (280,110,280,95);
circle (280,92,3);
rectangle (310,122,330,200);
line (310,140,330,140);
line (310,180,330,180);
setcolor (darkgray);
circle (302,140,3);
circle (302,180,3);
circle (338,140,3);
circle (338,180,3);
setcolor (lightgray);
rectangle (278,122,280,160);
line (338,112,338,119);
line (340,112,340,119);
line (342,112,342,119);
line (363,140,363,160);
line (358,140,358,160);
line (347,200,347,210);
line (294,200,294,210);
line (294,210,220,240);
line (347,210,421,240);
line (220,240,220,258);
line (421,240,421,258);
line (220,240,421,240);
line (220,242,421,242);
arc (225,256,180,270,5);
arc (416,256,270,360,5);
line (225,261,416,261);
setcolor (brown);
circle (231,252,8);
circle (231,252,2);
circle (252,252,8);
circle (252,252,2);
circle (272,252,8);
circle (272,252,2);
circle (292,252,8);
circle (292,252,2);
circle (312,252,8);
circle (312,252,2);
circle (332,252,8);
circle (332,252,2);
circle (352,252,8);
circle (352,252,2);
circle (372,252,8);
circle (372,252,2);
circle (392,252,8);
circle (392,252,2);
circle (411,252,8);
circle (411,252,2);
setlinestyle (0,0,3);
line (300,202,300,210);
line (341,202,341,210);
setlinestyle (0,0,0);
setcolor (white);
line (302,204,339,204);
line (302,206,339,206);
line (302,208,339,208);
end;
readkey;
end.