Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Escaping Literals II
//'main' method must be in a class 'Rextester'. //openjdk version '11.0.5' import java.util.*; import java.lang.*; //create a summary report on Stock purchases //sample dataset demodata class Rextester { public static void main(String args[]) { String header = "\n\tStock Portfolio:\n"; header += "\n\tStock\tShares\tPrice\tCost\n"; header += "\t---\t---\t---\t---\n"; String forecast = "\tApple\t440\t$64\t$28,000\n"; forecast += "\tAT&T\t870\t$28\t$27,000\n"; forecast += "\tGoogle\t920\t$390\t$359,000\n"; forecast += "\tIBM\t990\t$74\t$73,000\n"; forecast += "\tMerck\t950\t$42\t$40,000\n"; //Calculations: Sum, Minimum, Average, Maximum and Count forecast += "\tTotal Cost\t$527,000\n"; forecast += "\tAverage Price\t$119.40\n"; forecast += "\tMax Price \t$390\n"; forecast += "\tMin Price \t$28\n"; forecast += "\tCount \t5 \n"; System.out.println(header + forecast); } }
run
|
edit
|
history
|
help
0
output2
js
JAVA # EN UZUN CÜMLEYİ EKRANA YAZDIRMA
Program to generate random no. From 0 to 10
test no.1
A.K.JAVA_EXPERIENCE_2
1a
extends
[JAVA] Cool thing about iterating a map with iterator.
4a