{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

MathExercise3

# MathExercise3 - public class MathExercise3 public static...

This preview shows page 1. Sign up to view the full content.

/* This program calculates and prints out the force exerted by gravity on three objects of mass m1=5.0, m2=5.5 and m3=6.0, respectively, using the relationship force = mass * g, where g is the constant 9.81. The output should be as shown below, formatted to 3 decimal places: Force for mass m1 = xx.xxx Force for mass m2 = xx.xxx Force for mass m3 = xx.xxx
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: */ * public class MathExercise3 { public static void main(Stringargs) { double m1=5.0F; double m2=5.5F; double m3=6.0F; double gravity=9.81F; System.out.printf("Force for mass m1= %6.3F", m1*gravity); System.out.printf("Force for mass m2= %6.3F", m2*gravity); System.out.printf("Force for mass m3= %6.3F", m3*gravity); } }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online