Java

Написать программу на языке java

Нужно написать программу в Java, СРОЧНО!!!
1. Пользователь вводит текст, признаком конца которого является точка.
Каких символов больше в тексте: символов «*» или символов « +»?

2. Дана последовательность ненулевых вещественных чисел, за которой
следует 0 (0 – признак конца последовательности). Каких чисел больше в
данной последовательности больше, равных 0 или равных 1
1)
 import java.util.Scanner; 

public class Main {
public static void main(String[] args) {
// Create a new Scanner to read input from the user
Scanner scanner = new Scanner(System.in);

// Read the input text from the user
System.out.print("Enter the text: ");
String text = scanner.nextLine();

// Count the number of occurrences of "*" and "+" in the text
int countStar = 0;
int countPlus = 0;
for (int i = 0; i < text.length(); i++) {
if (text.charAt(i) == '*') {
countStar++;
} else if (text.charAt(i) == '+') {
countPlus++;
}
}

// Determine which character appears more often in the text
if (countStar > countPlus) {
System.out.println("The character '*' appears more often in the text.");
} else if (countPlus > countStar) {
System.out.println("The character '+' appears more often in the text.");
} else {
System.out.println("Both characters appear the same number of times in the text.");
}
}
}
2)
 import java.util.Scanner; 

public class NumberSequence {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);

// Read numbers from the input until we encounter a 0.
System.out.println("Enter a sequence of nonzero real numbers, followed by 0:");
double number = scanner.nextDouble();
while (number != 0) {
// Check if the number is greater than 0 or 1, or equal to 0 or 1.
if (number > 0) {
System.out.println(number + " is greater than 0.");
} else if (number == 0) {
System.out.println(number + " is equal to 0.");
} else if (number == 1) {
System.out.println(number + " is equal to 1.");
} else {
System.out.println(number + " is less than 1.");
}

// Read the next number from the input.
number = scanner.nextDouble();
}

// Print a message when the input is finished.
System.out.println("Finished reading the input.");
}
}
Бауржан Нугманов
Бауржан Нугманов
2 690
Лучший ответ
Константин Константи Скопипи3дили где-то) явно не ваше решение
Ковалев Виктор Во втором выдает вообще другое
к чему эта срочность?