Programming Java

Tasks studies - laboratory


Project maintained by dawidolko Hosted on GitHub Pages — Theme by dawidolko

OBJECT-ORIENTED JAVA PROGRAMMING – LABORATORY

Tasks to solve on your own:

Task 1.

Write a program that calculates the delta discriminant and the roots of a quadratic trinomial.

Task 2.

Write a calculator that calculates: sum, difference, product, quotient, power, root, and values ​​ of trigonometric functions for a given angle. Use the Math library, e.g. Math.Sin(2.5). Please remember that angle values ​​given to the function are measured in arc measure. Display the results of the algorithms on the console. To handle the menu, use the switch-case structure and the while loop.

Task 3.

Write a program that allows you to enter 10 real numbers into an array. Then create the following functionalities using the for loop: • Displaying the array from the first to the last index. • Displaying the array from the last to the first index. • Displaying elements with odd indexes. • Displaying elements with even indexes.

Display the results of the algorithms on the console. To select the above functionalities of the program, create the appropriate menu. To handle the menu, use the extended else-if structure and the do-while loop.

Task 4.

Write a program that allows you to enter 10 numbers. For the entered numbers, perform the appropriate algorithms: • calculate the sum of the array elements, • calculate the product of the array elements, • determine the average value, • determine the minimum value, • determine the maximum value. Display the results of the algorithms on the console. Create the appropriate menu.

Task 5.

Write a program that displays numbers from 20-0, excluding the numbers {2,6,9,15,19}. To perform the disable task, use the continue statement;

Task 6.

Write a program that asks the user for integers indefinitely. The infinite loop should end when the user enters a number less than zero. To exit the infinite loop, use the break statement. The infinite loop is implemented with the following constructs:

while(true)
{ loop body }
or
for(;;)
{ loop body }

Task 7.

Write a program that allows you to enter n numbers and sorts these numbers using the bubble or insertion method. Display the results on the console