Write the complete to print out the following table Write th
Solution
package org.students;
public class PrintTable {
public static void main(String[] args) {
//Declaring variables
double v,s,vTot=0.0,sTot=0.0,tTot=0.0;
//Displaying the output in the tabular form.
System.out.println(\"\\t\\tT\\t\\tV=32T\\t\\tS=16T^2+VT-1000\");
System.out.println(\"\\t\\t--\\t\\t------\\t\\t---------------\");
for(float t=0;t<=10.0;t+=0.5)
{
//Calculating total
tTot+=t;
v=32*t;
//Calculating total
vTot+=v;
s=(16*Math.pow(t,2))+(v*t)-1000;
//Calculating total
sTot+=s;
System.out.printf(\"\\t\\t%.1f\\t\\t%.2f\\t\\t%4.2f\ \",t,v,s);
}
//Displaying the total
System.out.printf(\"\ Totals\\t\\t%.2f\\t\\t%.2f\\t%.2f\",tTot,vTot,sTot);
}
}
__________________
Output:
T V=32T S=16T^2+VT-1000
-- ------ ---------------
0.0 0.00 -1000.00
0.5 16.00 -988.00
1.0 32.00 -952.00
1.5 48.00 -892.00
2.0 64.00 -808.00
2.5 80.00 -700.00
3.0 96.00 -568.00
3.5 112.00 -412.00
4.0 128.00 -232.00
4.5 144.00 -28.00
5.0 160.00 200.00
5.5 176.00 452.00
6.0 192.00 728.00
6.5 208.00 1028.00
7.0 224.00 1352.00
7.5 240.00 1700.00
8.0 256.00 2072.00
8.5 272.00 2468.00
9.0 288.00 2888.00
9.5 304.00 3332.00
10.0 320.00 3800.00
Totals 105.00 3360.00 13440.00
____________Thank You

