Skip to content

ahmetpinar/AlgorithmsExamplesWithJava

Repository files navigation

AlgorithmsExamplesWithJava

Some algorithms examples with java

                                                    QUESTİONS 
  1. Write a Java program to read two integer numbers from the keyboard and then print the quotient and remainder of numbers. Note: the quotient (/) of 25 and 4 is 6 and the reminder (%) of 25 and 6 is 1. 25/4=6 25%4=1

  2. Write a Java program that reads a number in inches and then converts it to meters. Note: One inch is 0.0254 meter.

  3. Write a Java Program to read the birth year of one student and then finds his/her age. Note: age = currentyear - birthyear.

  4. Write a Java program to read two integer numbers an done operator (+, -, *, /) tocalculatesummation, subtraction, multiplication and devision using if statement.

  5. Write a Java program that displays water bills. Your program should prompt the user toenteran integer account number, a character use code, and a real number representingthegallonsof water used. The output from your program should include the account number, messageindicating the type of usage, and the amount of money due from the user. The water rates vary depending on the type of usage. A code of H means home use, a codeofCmeans commercial use, and a code of I means industrial use. Any other code value shouldbetreatedas an error. Water rates are computed as follows: Code H: $5.00 plus $0.005 per gallon 1 Code C: $1000.00 for the first 4 million gallons used plus $0.025 for each additional gallon used Code I: $1000.00 if usage does not exceed 4 million gallons $2000.00 is usage is between 4 million and 10 million gallons $3000.00 is 10 million gallons or more

  6. Write a Java program to find prime numbers between two integer numbers givenfromthekeyboard.

  7. Write a Java program to read a 1D array of type double and size N using a keyboardandthen convert the odd numbers of the array to even by applying ++ operator ontheoddnumber. Print the array elements on the screen at the end.

  8. Write a Java program to find the summation of one 1D array using a method.

  9. Write a Java program using a method to read a 1D array of type double and size Nusingakeyboard and then prints the maximum element of array.

  10. Write a Java program to read a 2D array of type double and size N×Musing a keyboardandthen find the summation of each row if user entered -1 and/or summation of eachcolumnwhen user entered -2. Write your code using a method.

About

Some algorithms examples with java

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages