Skip to content

Commit 4101ff2

Browse files
author
s-buvaka
committed
Initial commit
0 parents  commit 4101ff2

12 files changed

Lines changed: 441 additions & 0 deletions

.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/caches
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
/.idea/navEditor.xml
9+
/.idea/assetWizardSettings.xml
10+
.DS_Store
11+
/build
12+
/captures
13+
.externalNativeBuild
14+
.cxx
15+
local.properties

build.gradle

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apply plugin: 'java'
2+
3+
sourceCompatibility = 1.8
4+
version = '1.0'
5+
6+
repositories {
7+
}
8+
9+
dependencies {
10+
}

gradle.properties

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Project-wide Gradle settings.
2+
# IDE (e.g. Android Studio) users:
3+
# Gradle settings configured through the IDE *will override*
4+
# any settings specified in this file.
5+
# For more details on how to configure your build environment visit
6+
# http://www.gradle.org/docs/current/userguide/build_environment.html
7+
# Specifies the JVM arguments used for the daemon process.
8+
# The setting is particularly useful for tweaking memory settings.
9+
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
10+
# When configured, Gradle will run in incubating parallel mode.
11+
# This option should only be used with decoupled projects. More details, visit
12+
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13+
# org.gradle.parallel=true
14+
# AndroidX package structure to make it clearer which packages are bundled with the
15+
# Android operating system, and which are packaged with your app"s APK
16+
# https://developer.android.com/topic/libraries/support-library/androidx-rn
17+
android.useAndroidX=true
18+
# Kotlin code style for this project: "official" or "obsolete":
19+
kotlin.code.style=official
20+
# Enables namespacing of each library's R class so that its R class includes only the
21+
# resources declared in the library itself and none from the library's dependencies,
22+
# thereby reducing the size of the R class for that library
23+
android.nonTransitiveRClass=true

gradle/wrapper/gradle-wrapper.jar

57.8 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Sat Jul 23 10:15:32 MSK 2022
2+
distributionBase=GRADLE_USER_HOME
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
4+
distributionPath=wrapper/dists
5+
zipStorePath=wrapper/dists
6+
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 185 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradlew.bat

Lines changed: 89 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

settings.gradle

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
pluginManagement {
2+
repositories {
3+
gradlePluginPortal()
4+
google()
5+
mavenCentral()
6+
}
7+
}
8+
dependencyResolutionManagement {
9+
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
10+
repositories {
11+
google()
12+
mavenCentral()
13+
}
14+
}
15+
rootProject.name = "BillCalculator"

src/main/java/Calculator.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
class Calculator {
2+
3+
int friendsCount;
4+
5+
String cart = "Добавленные товары:";
6+
double totalPrice = 0;
7+
8+
Calculator(int friendsCount) {
9+
this.friendsCount = friendsCount;
10+
}
11+
12+
void addItem(Item item) {
13+
totalPrice += item.price;
14+
cart = cart + "\n" + item.name;
15+
16+
System.out.println(item.name + " в корзине");
17+
}
18+
19+
double divideSum() {
20+
return totalPrice / friendsCount;
21+
}
22+
}

src/main/java/Formatter.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
public class Formatter {
2+
3+
String formatValue(double price) {
4+
double roundedValue = Math.floor(price);
5+
if (roundedValue == 1) {
6+
return "рубль";
7+
} else if (roundedValue >= 2 && roundedValue <= 4) {
8+
return "рубля";
9+
} else {
10+
return "рублей";
11+
}
12+
}
13+
14+
String roundResult(final double result) {
15+
return String.format("%.2f", result);
16+
}
17+
}

0 commit comments

Comments
 (0)