Skip to content
This repository was archived by the owner on Dec 28, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions students/23K1302/23K1302-p04/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>23K1302</artifactId>
<groupId>ru.mirea.practice</groupId>
<version>2024.1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>23K1302-p04</artifactId>
<description>Четвёртое задание</description>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package ru.mirea.practice.s0000001;

enum Brand {
HUAWEI, HP, LENOVO, APPLE, ASUS
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package ru.mirea.practice.s0000001;


class Computer {
private Brand brand;
private Processor processor;
private Memory memory;
private Monitor monitor;

public Computer(Brand brand, Processor processor, Memory memory, Monitor monitor) {
this.brand = brand;
this.processor = processor;
this.memory = memory;
this.monitor = monitor;
}

public Brand getBrand() {
return brand;
}

public Processor getProcessor() {
return processor;
}

public Memory getMemory() {
return memory;
}

public Monitor getMonitor() {
return monitor;
}

@Override
public String toString() {
return "Computer{"
+ "brand=" + brand
+ ", processor=" + processor
+ ", memory=" + memory
+ ", monitor=" + monitor
+ '}';
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package ru.mirea.practice.s0000001;

enum Ex1 {
WINTER(-10) {
@Override
public String getDescription() {
return "Холодное время года";
}
},
SPRING(10) {
@Override
public String getDescription() {
return "Прохладное время года";
}
},
SUMMER(25) {
@Override
public String getDescription() {
return "Теплое время года";
}
},
AUTUMN(5) {
@Override
public String getDescription() {
return "Прохладное время года";
}
};

private int averageTemperature;

Ex1(int averageTemperature) {
this.averageTemperature = averageTemperature;
}

public String getDescription() {
return "Холодное время года";
}

public int getAverageTemperature() {
return averageTemperature;
}

public static void main(String[] args) {
Ex1 favoriteSeason = Ex1.AUTUMN;
System.out.println("Мое любимое время года:");
System.out.println("Название: " + favoriteSeason);
System.out.println("Средняя температура: " + favoriteSeason.getAverageTemperature());
System.out.println("Описание: " + favoriteSeason.getDescription());

printSeasonMessage(favoriteSeason);

for (Ex1 season : Ex1.values()) {
System.out.println(season + ": Средняя температура = " + season.getAverageTemperature()
+ ", Описание = " + season.getDescription());
}
}

public static void printSeasonMessage(Ex1 season) {
switch (season) {
case WINTER:
System.out.println("Я люблю зиму");
break;
case SPRING:
System.out.println("Я люблю весну");
break;
case SUMMER:
System.out.println("Я люблю лето");
break;
case AUTUMN:
System.out.println("Я люблю осень");
break;
default:
System.out.println("Неизвестное время года");
break;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package ru.mirea.practice.s0000001;

public final class Ex4 {

private Ex4() {
// Пустота
}

public static void main(String[] args) {
Processor processor = new Processor("Apple M2 Pro", 16, 3.5);
Memory memory = new Memory("LPDDR5", 16);
Monitor monitor = new Monitor("3456x2234 Retina", 16);

Computer computer = new Computer(Brand.APPLE, processor, memory, monitor);

System.out.println(computer);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package ru.mirea.practice.s0000001;

public class Main {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package ru.mirea.practice.s0000001;

class Memory {
private String type;
private int size;

public Memory(String type, int size) {
this.type = type;
this.size = size;
}

public String getType() {
return type;
}

public int getSize() {
return size;
}

@Override
public String toString() {
return "Memory{"
+ "type='" + type + '\''
+ ", size=" + size + " GB"
+ '}';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package ru.mirea.practice.s0000001;

class Monitor {
private String resolution;
private double size;

public Monitor(String resolution, double size) {
this.resolution = resolution;
this.size = size;
}

public String getResolution() {
return resolution;
}

public double getSize() {
return size;
}

@Override
public String toString() {
return "Monitor{"
+ "resolution='" + resolution + '\''
+ ", size=" + size + " inches"
+ '}';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package ru.mirea.practice.s0000001;

class Processor {
private String model;
private int cores;
private double frequency;

public Processor(String model, int cores, double frequency) {
this.model = model;
this.cores = cores;
this.frequency = frequency;
}

public String getModel() {
return model;
}

public int getCores() {
return cores;
}

public double getFrequency() {
return frequency;
}

@Override
public String toString() {
return "Processor{"
+ "model='" + model + '\''
+ ", cores=" + cores
+ ", frequency=" + frequency + " GHz"
+ '}';
}
}
1 change: 1 addition & 0 deletions students/23K1302/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
<module>23K1302-p01</module>
<module>23K1302-p02</module>
<module>23K1302-p03</module>
<module>23K1302-p04</module>
</modules>
</project>
Loading