public class Car {
private String carNumber, carModel, carOwner;
private Date lastRepairDate, repairedDate;
// Constructors
public Car() {}
public Car(String carNumber, String carModel, String carOwner, Date lastRepairDate, Date repairedDate) {
this.carNumber = carNumber;
this.carModel = carModel;
this.carOwner = carOwner;
this.lastRepairDate = lastRepairDate;
this.repairedDate = repairedDate;
}
// Getters & Setters
// toString()
}
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_address = ('localhost', 9090)
print('starting up on {} port {}'.format(*server_address))
sock.bind(server_address)
sock.listen(1)
while True:
print('waiting for a connection')
connection, client_address = sock.accept()
try:
print('connection from', client_address)
while True:
data = connection.recv(1024)
print('received {!r}'.format(data))
if data:
print('sending data back to the client')
input_data = (data.decode())
expression = input_data[0] + input_data[2] + input_data[1]
result = eval(expression)
connection.sendall(str(result).encode())
else:
print('no data from', client_address)
break
finally:
connection.close()
import socket
sock = socket.socket()
sock.connect(('localhost', 9090))
a = input("a= ")
b = input("b= ")
do = input("+ - / * ")
message = a + b + do
sock.send(message.encode())
data = sock.recv(1024)
res = data.decode()
print(res)
sock.close()
def create_user():
print('создание пользователя, введите: [логин] [пароль] [права]')
my_file = open("logbase.txt", "a")
inp = input()
my_file.write(inp + "\n")
my_file.close()
def create_user():
print('создание пользователя, введите: [логин] [пароль] [права]')
with open("logbase.txt", "a") as myfile:
inp = input()
my_file.write(inp+"\n")