0% found this document useful (0 votes)
31 views2 pages

Jouf University: Department of Information Systems Dr. Abd El-Aziz Ahmed Java Programming Fall 2018 Practice Lab 1

This document provides instructions for 14 practice programming problems assigned as lab work for a Java programming course. The problems cover a range of programming concepts including: accepting user input, mathematical calculations, object-oriented programming with classes, unit conversions, and geometric formulas. Students are asked to write Java programs that add and perform operations on numbers, calculate circle properties, slope of a line, electrical circuit calculations, total costs, temperature conversions, digit sums, time conversions, water heating energy needs, airplane takeoff distance, and triangle area.

Uploaded by

wiem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views2 pages

Jouf University: Department of Information Systems Dr. Abd El-Aziz Ahmed Java Programming Fall 2018 Practice Lab 1

This document provides instructions for 14 practice programming problems assigned as lab work for a Java programming course. The problems cover a range of programming concepts including: accepting user input, mathematical calculations, object-oriented programming with classes, unit conversions, and geometric formulas. Students are asked to write Java programs that add and perform operations on numbers, calculate circle properties, slope of a line, electrical circuit calculations, total costs, temperature conversions, digit sums, time conversions, water heating energy needs, airplane takeoff distance, and triangle area.

Uploaded by

wiem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Jouf University

Department of Information Systems


Dr. Abd El-Aziz Ahmed

Java Programming
Fall 2018
Practice Lab 1

1. Write a java program that adds two numbers from the user.
2. Write a java program that asks the user to enter two numbers, obtains the two numbers from the
user, and prints the sum, product, difference, and quotient of the two numbers .

3. Write a java program that reads in the radius of a circle and prints the circle’s diameter,
circumference and area.
4. Write a program that accept X, Y for two points P1 = (X1, Y1) and P2 = (X2, Y2) and
calculate the Slope (m) = X1-X2 / Y1-2Y.

5. Write a program to calculate Total Resistance of three resistances in parallel. Rt = R1


*R2 * R3/ R1+*R2 + R3.

6. Write a program to calculate Total Resistance of four resistances in circuit, three of them
connected in parallel and the last one connected in series with them. Rt = R in parallel +
R in series.

7. Write a program to calculate I total (It) of a circuit contains voltage source (Vs) and five
resistances connected in parallel. It = Vs / Rt.

8. Write a program that uses a Purchase class to set the following prices: Oranges: 10 for
2.99, Eggs: 12 for 1.69, Apples: 3 for 1.00, Watermelons: 4.39 for each Bagels: 6 for
3.50. Calculate the total bill subtotals for each item of the following: 2 dozen oranges, 3
dozen eggs, 20 apples, 2 watermelons, and 1 dozen bagels.
9. Write a program that reads a Celsius degree in a double value from the console, then
converts it to Fahrenheit and displays the result. The formula for the conversion is as
follows: fahrenheit = (9 / 5) * celsius + 32.

10. Write a program that reads an integer between 0 and 1000 and adds all the digits in the
integer. For example, if an integer is 932, the sum of all its digits is 14.

11. Write a program that prompts the user to enter the minutes (e.g., 1 billion), and displays
the number of years and days for the minutes. For simplicity, assume a year has 365 days.

12. Write a program that calculates the energy needed to heat water from an initial
temperature to a final temperature. Your program should prompt the user to enter the
amount of water in kilograms and the initial and final temperatures of the water. The
formula to compute the energy is Q = M * (finalTemperature – initialTemperature) *
4184. where M is the weight of water in kilograms, temperatures are in degrees Celsius,
and energy Q is measured in joules.
13. Given an airplane’s acceleration a and take-off speed v, you can compute the minimum
runway length needed for an airplane to take off using the following formula
length=(v2)/(2a): Write a program that prompts the user to enter v in meters/second (m/s)
and the acceleration a in meters/second squared and displays the minimum runway
length.
14. Write a program that prompts the user to enter three points (x1, y1), (x2, y2), (x3, y3) of
a triangle and displays its area. The formula for computing the area of a triangle is

You might also like