READ THE COMMENTS AND THE ASSIGNMENT DOCUMENT. WRITE CODE AS PER THE COMMENTS
class QI1 {
// method that prints an int array
public static void printIntArray(int[] array) {
// TODO
}//printArray
// method that inserts a new key at the index 0 of an array
public static void insertKey(int[] array, int key) {
// TODO
}//insertValue
// method that removes and returns a key from the index 0 of an array
public static int removeKey(int[] array) {
// TODO
}//insertValue
// method that copies values from one array to another array
// returns the new array after copying
public static String[] copyArray(String[] array) {
// TODO
}//insertValue
// method that checks the values in both argument arrays
// returns true if all values are equal
public static boolean arraysEqual(String[] array1, String[] array2) {
// TODO
}//arraysEqual
public static void main(String[] args) {
// TODO
}//main
}//class
Q2.Given an array String[] array ={"civic","level","check","oop","boss","madam","sir"}, write down the
program with method which will print only palindromes from the array. You can use
public static Boolean ifPalindrome()
public static void printPalindrome() as reference.
Your Output should look like:
civic
level
madam
(A palindrome is a word, a sequence of characters which reads the same backward as forward, such as
refer)
Q1.Given an array int[] array={1,2,3,4,5}, write down the code to calculate the sum and average of the array.
LINKED LIST DATA STRUCTURE
CREATE a user-defined Class LinkedList to store a list of Books.
Class Linked List contains it’s own constructors to instantiate its private data.
Define mutator and accessor methods.
Define method add and remove for the linked list.
Then defined an application class to manipulate the list of books.
Properties Of Relation (Cover Transitive, Reflective and Symmetric)
a. Embed Transitive, Reflective, and Symmetric rules into the java program.
b. Write a java program that read set of element and its relation. Your input data will be read from text file/console/GUI with the format below:
Input (Example): {(1, 1), (1, 2), (2, 1), (2, 2), (3, 3), (4, 4)}
Write an application that stores 12 integers in an array. Display the ingeter from first to last, and then display the integers from last to first.
In a science research lab, the combination of two nuclear chemicals produces initial energy as X. This energy X changes at a consistent rate R every second. The scientist wishes to calculate the total energy produced if the reaction is allowed to occur for N seconds.
Write an algorithm to find the total
energy produced.
The first line of the input consists of an integer numOfProducts, representing the number of products to be considered in the sales data (N).
The second line consists of N space separated characters - productID₁, productID 2...... productIDN representing the product IDs of the sales of the last N products.
The current selected programming language is C. We emphasize the submission of a fully working code over partially correct but efficient code. Once submitted, you cannot review this problem again. You can use printf() to debug your code. The printf() may not work in case of syntax/runtime error. The version of
GCC being used is 5.5.0.
Create a Java console application for employees’ records management using Java collections. This application should offer a Menu that allows the user to perform specific operations (e.g., add, update, search, delete employees’ records, ...).
Employee class
Define the getters of all these attributes.
Define setters or input methods (e.g., inputName(), inputTitle()) for all
attributes in a way that allows you to check the validity of the user’s inputs
using RegEx.
These methods should throw an exception of type InvalidEmployeeDetailException (custom exception)
Add an employee
A method addEmployee() should be defined in the EmployeeManager class which prompts the user to enter the employee’s details from which a new Employee instance is created and added to the collection.
Methods:
updateEmployee()
SearchEmployee
displayEmployees()
deleteEmployee()