Skip to content
Open
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: 7 additions & 6 deletions src/main/java/Calculator.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
import java.util.Scanner;

public class Calculator {


public double start() {
ArrayList<Bludo> feedList = new ArrayList<>();
System.out.println("Привет!");
Expand All @@ -17,8 +15,11 @@ public double start() {
while (vvod) {
Bludo bludo = new Bludo();
i++;
System.out.println("Введите название товара № " + i + " или введите 'Завершить': ");
String vvodStr = scanner.nextLine().trim();
String vvodStr="";
do {
System.out.println("Введите название товара № " + i + " или введите 'Завершить': ");
vvodStr= scanner.nextLine().trim();
} while (vvodStr.equals(""));
double price = 0;
if (!vvodStr.equalsIgnoreCase("завершить")) {
bludo.name = vvodStr;
Expand Down Expand Up @@ -68,12 +69,12 @@ public static int skolkoNaroduPlatit() {
int men = 0;
while (notOk) {
Scanner scanner = new Scanner(System.in);
System.out.println("Сколько человек расплачиваются(2-9)?");
System.out.println("Сколько человек расплачиваются(не менее 2)?");
String strMen = scanner.nextLine();

try {
men = Integer.parseInt(strMen.trim());
if ((men > 1) && (men < 10)) {
if (men > 1) {

notOk = false;
} else System.out.println("неверное число " + men);
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ public static void main(String[] args) {
//идем на извращения, дабы поменять точку на запятую.
// функция replace не работает и т.п. тоже не работают
if (PoSkolkoPlatit>0) {
//System.out.println("итог: " + PoSkolkoPlatit);


DecimalFormat myFloatFormatter = new DecimalFormat("#.##");
String dolgStr = myFloatFormatter.format(PoSkolkoPlatit);
if (PoSkolkoPlatit-(int)PoSkolkoPlatit==0)
{dolgStr=dolgStr+",00";}
int zap = dolgStr.indexOf(",");
String part1 = dolgStr.substring(0, zap);
String part2 = dolgStr.substring(zap + 1, dolgStr.length());
Expand Down