Commit f939b5a8 authored by s9_saleni_s's avatar s9_saleni_s
Browse files

INIT

parents
Pipeline #1769 canceled with stages
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4" />
\ No newline at end of file
<?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>
<groupId>org.example</groupId>
<artifactId>DevOps_homework_october</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.6.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
</project>
\ No newline at end of file
public class Auto {
private String make;
private String model;
private int power;
private float engineCapacity;
// Default constructor
public Auto() {
make = "Grabulis";
model = "Parastais";
power = 20;
engineCapacity = 0.001f;
}
// Constructor with arguments
public Auto(String mk, String md, int p, float ec) {
setMake(mk);
setModel(md);
setPower(p);
setEngineCapacity(ec);
}
// get methods
public String getMake() {
return make;
}
public String getModel() {
return model;
}
public int getPower() {
return power;
}
public float getEngineCapacity() {
return engineCapacity;
}
// set methods
public void setMake(String mk) {
make = mk;
}
public void setModel(String md) {
model = md;
}
public void setPower(int p) {
if (p>0)
power = p;
else
power = 20;
}
public void setEngineCapacity(float ec) {
if (ec>0)
engineCapacity = ec;
else
engineCapacity = 0.001f;
}
// toString method
public String toString() {
return make + " " + model + ", " + Integer.toString(power) + " kW, " + Float.toString(engineCapacity) + " m3.";
}
// Calculates horse power
public float calculateHorsePower() {
return power*1.36f;
}
// Calculate fuel consumption
public float calculateFuelConsuption() {
return (float) (Math.sqrt(engineCapacity)*6.7/100);
}
// Calculate brake distance
public float brakeDistance(String coefType) {
float coef = 0f;
if (coefType.equals("wet")) {
coef = 0.55f;
} else if(coefType.equals("dry")){
coef = 0.75f;
}
return (float) (25*25/(2*9.81*coef));
}
}
public class Main {
public static void main(String[] args) {
Auto car = new Auto("VW", "Passat", 125, 1.9f);
System.out.println(car);
}
}
import static org.junit.jupiter.api.Assertions.*;
class AutoTest {
@org.junit.jupiter.api.Test
void getMake() {
}
@org.junit.jupiter.api.Test
void getModel() {
}
@org.junit.jupiter.api.Test
void getPower() {
}
@org.junit.jupiter.api.Test
void getEngineCapacity() {
}
@org.junit.jupiter.api.Test
void setMake() {
}
@org.junit.jupiter.api.Test
void setModel() {
}
@org.junit.jupiter.api.Test
void setPower() {
}
@org.junit.jupiter.api.Test
void setEngineCapacity() {
}
@org.junit.jupiter.api.Test
void testToString() {
}
@org.junit.jupiter.api.Test
void calculateHorsePower() {
}
@org.junit.jupiter.api.Test
void calculateFuelConsuption() {
}
@org.junit.jupiter.api.Test
void brakeDistance() {
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment