Object Oriented Programming With Java, Quizzes of Object Oriented Programming

Object Oriented Programming With Java

Typology: Quizzes

2021/2022

Available from 06/05/2024

omr-22
omr-22 🇪🇬

12 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1.12 (Average speed in kilometers) Assume that a runner runs 24 miles in 1 hour, 40 minutes, and 35
seconds. Write a program that displays the average speed in kilometers per hour.
(Note 1 mile is equal to 1.6 kilometers.)
2.14 (Health application: computing BMI) Body Mass Index (BMI) is a measure of health on weight. It
can be calculated by taking your weight in kilograms and dividing, by the square of your height in
meters.
Write a program that prompts the user to enter a weight in pounds and height in inches and displays the
BMI.
Note one pound is 0.45359237 kilograms and one inch is 0.0254 meters.
Here is a sample run:
Enter weight in pounds: 95.5
Enter height in inches: 50
BMI is 26.8573
3.32 (Geometry: point position) Given a directed line from point p0(x0, y0) to p1(x1,y1), you can use
the following condition to decide whether a point p2(x2, y2) is on the left of the line, on the right, or on
the same line (see Figure 3.11):
5.49 (Count Vowels and consonants) Assume that the letters A, E, O, U, and I are vowels.
Write a program that prompts the user to enter a string, and displays the number of vowels and
consonants in the string.
Enter a string: Programming is fun
The number of vowels is 5
The number of consonants is 11
1

Partial preview of the text

Download Object Oriented Programming With Java and more Quizzes Object Oriented Programming in PDF only on Docsity!

1.12 (Average speed in kilometers) Assume that a runner runs 24 miles in 1 hour, 40 minutes, and 35 seconds. Write a program that displays the average speed in kilometers per hour. (Note 1 mile is equal to 1.6 kilometers.) 2.14 (Health application: computing BMI) Body Mass Index (BMI) is a measure of health on weight. It can be calculated by taking your weight in kilograms and dividing, by the square of your height in meters. Write a program that prompts the user to enter a weight in pounds and height in inches and displays the BMI. Note one pound is 0.45359237 kilograms and one inch is 0.0254 meters. Here is a sample run: Enter weight in pounds: 95. Enter height in inches: 50 BMI is 26. 3.32 (Geometry: point position) Given a directed line from point p0(x0, y0) to p1(x1,y1), you can use the following condition to decide whether a point p2(x2, y2) is on the left of the line, on the right, or on the same line (see Figure 3.11): 5.49 (Count Vowels and consonants) Assume that the letters A, E, O, U, and I are vowels. Write a program that prompts the user to enter a string, and displays the number of vowels and consonants in the string. Enter a string: Programming is fun The number of vowels is 5 The number of consonants is 11 1