Question: Write a method isEven that uses the remainder operator (%) to determine whether an integer is even. The method should take an integer argument

Write a method isEven that uses the remainder operator (%) to determine

 whether an integer is even. The method should take an integer argument

Write a method isEven that uses the remainder operator (%) to determine whether an integer is even. The method should take an integer argument and return true if the in- teger is even and false otherwise. Incorporate this method into an application that inputs a se- quence of integers (one at a time) and determines whether each is even or odd. Q2: (10 points) 6.22 (Temperature Conversions) Implement the following integer methods: a) Method celsius returns the Celsius equivalent of a Fahrenheit temperature, using the calculation celsius = 5.0 / 9.0 (fahrenheit 32); b) Method fahrenheit returns the Fahrenheit equivalent of a Celsius temperature, using the calculation fahrenheit = 9.0 / 5.0 celsius+ 32; c) Use the methods from parts (a) and (b) to write an application that enables the user ei- ther to enter a Fahrenheit temperature and display the Celsius equivalent or to enter a Celsius temperature and display the Fahrenheit equivalent. Q3: (10 points) 7.11 Write statements that perform the following one-dimensional-array operations: a) Set the 10 elements of integer array counts to zero. b) Add one to each of the 15 elements of integer array bonus. c) Display the five values of integer array bestScores in column format. Q4: (20 Points) A- Write a method, called findNameIndex, which receives two parameters: 1: an array of type String. called nameArray, 2: a String called name and returns an integer value. B- The method searches the name Array for the given name. If the name matches one of the values stored in the nameArray, the method returns the index of the matched name in the array. If the name is not found in the name Array, the method returns -1. Test your method by writing a Java program that its main method does the following: a) Creates a one-dimensional array, called peopleNames, of type String, and fills the array with the first names of at least 5 people. b) Prints the peopleNames array. c) Calls findNameIndex and passes the people Names array and a first name of type String to the method for the following two cases and prints the result: i- ii- The given name does not exist in the peopleNames array. The given name exists in the peopleNames array. Q5: Write a Java program that performs the following: (20 Points) a) Creates an ArrayList, called al that can store integers. b) Fills the al ArrayList with 10 random integer numbers between 1 and 100. c) Prints the content of al. d) Removes the first element of al. e) Prints the removed element in step d. f) Prints the content of al again. Q4: (10 points) 8.4 (Rectangle Class) Create a class Rectangle with attributes length and width, each of which defaults to 1. Provide methods that calculate the rectangle's perimeter and area. It has set and get methods for both length and width. The set methods should verify that length and width are each floating-point numbers larger than 0.0 and less than 20.0. Write a program to test class Rectangle.

Step by Step Solution

3.53 Rating (153 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Lets go through each of the questions step by step Q1 java import javautilScanner public class EvenOddChecker public static void mainString args Scanner scanner new ScannerSystemin while true Systemou... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!