Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Problem 3: New Products
//'main' method must be in a class 'Rextester'. //Compiler version 1.8.0_111 import java.util.*; import java.lang.*; class Rextester { public static void main(String args[]) { return sales(AADBACBADC); } public void sales(String sale) { int A = 0; int B = 0; int C = 0; int D = 0; for(int i = 0; i < sale.length(); i++) { if(sale.substring(i).equals('A')) { A++; } if(sale.substring(i).equals('B')) { B++; } if(sale.substring(i).equals('C')) { C++; } if(sale.substring(i).equals('D')) { D++; } } if((A > B) && (A > C) && (A > D)) { return A; } if((B > A) && (B > C) && (B > D)) { return B; } if((C > A) && (C > B) && (C > D)) { return C; } if((D > A) && (D > B) && (D > C)) { return D; } } }
run
|
edit
|
history
|
help
0
Escaping Literals (Table of records)
anonymous abstract class
forloop
circleapp.java
Votes JAVA
Reverse string template
This code is not what it seems...
Print Count Strings
Problem: rstring
Трикотаж