Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Java Programming Practice 7. Write a Java program to calculate the and print the roots of a quadratic equation. Program Output: Enter The a coefficient 2 Enter The b coefficient -6 Enter The c coefficient 3 The Roots are: X1 = , X2 =
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Java Programming Practice 8) Write a Java program which asks from the user the weight in kilograms and the height in meters as input and then calculates Body Mass Index (BMI) with the formula BMI = weight / (height 2 ) and print the result with the corresponding comment according to the following table. Output: Enter the weight in kg: 60 Enter the height in meters: 1.5 The BMI is So, it is overweight
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Java Programming Practice 9. Write a Java program to convert weekdays number to the weekdays name. (Use case Command) Output: Enter Weekday Number: 0 Day is Monday Enter Weekday Number: 2 Day is Wednesday Enter Weekday Number: 6 Day is Sunday Enter Weekday Number: 3 Day is Thursday