Create a class called Register with three instance variables: username, email, and password. These three pieces of information are all String. Your class should have a constructor that initializes the three instance variables and assumes that the provided values are correct. For each instance variable, provide a set and a get method. Create a displayInformation method in order to display the username, email, and password, separated by a comma ( , ). Create a test application called RegistrationInfoTest that demonstrates the Register class.
1. Write a program using Java to move the last element of a LL to the beginning of the list.
2. Write a program using Java to find the number of common elements of two linked lists.
e.g. 1à3à5à7ànull
2à3à7à9à11ànull
Output: 2
3. Write a program using Java to reverse the elements of a linked list
4. Write a program using Java to find the middle node of a linked list (ensure that the number of nodes of the LL is an odd number).
5. Write a program to count the number of times a given integer appears in a LL.
6. Preparation for theory-based questions which can be asked during interview.
6.1 Linked List vs 1-d Array
6.2 Comparison of Singly Linked List, doubly linked list and circular Linked list. Advantages and disadvantages of each.
1. Write a Java program to find maximum product of two integers in a given array of integers.
Example:
Input :
nums = { 2, 3, 5, 7, -7, 5, 8, -5 }
Output:
Pair is (7, 8), Maximum Product: 56
1. Write a Java program to rearrange a given array of unique elements such that every second element of the array is greater than its left and right elements.
Example:
Input :
nums= { 1, 2, 4, 9, 5, 3, 8, 7, 10, 12, 14 }
Output:
Array with every second element is greater than its left and right elements:
[1, 4, 2, 9, 3, 8, 5, 10, 7, 14, 12]
2. Write a Java program to form the largest number from a given list of non-negative integers.
Example:
Input :
nums = {1, 2, 3, 0, 4, 6}
Output:
Largest number using the given array numbers: 643210
3. Write a Java program to shuffle a given array of integers.
1. Write a Java program to find the maximum and minimum value of a 1-d array.
2. Write a Java program without using a second array to reverse elements of each row of a 2-d array of integer values.
e.g. 1 2 3 4 4 3 2 1
5 6 7 8 è 8 7 6 5
9 10 11 12 12 11 10 9
3. Write a java program to print the Pascal’s Triangle using a 2-d array.
4. Write a Java program to convert an array to an ArrayList, and an ArrayList to an array.
5. Write a Java program to arrange the elements of a given array of integers where all negative integers appear before all the positive integers.
6. Given two sorted arrays A and B of size p and q, write a Java program to merge elements of A with B by maintaining the sorted order i.e. fill A with first p smallest elements and fill B with remaining elements.
An owner of an auto repair shop wishes to organize his team of mechanics at the beginning of the day. To make the distribution of work equal, he organizes cars with an even amount of faults into bay 1 and cars with an odd amount of faults into bay 2. There are nine cars in total Write the pseudocode for the problem, then write a Java program to separate the even and odd number of car faults. Have all even numbers displayed first, then odd numbers at the end. The repairs required for each car are as follows. 18, 14, 12, 6, 4, 21, 19, 9, 3 Hint: WHILE LOOPS and IF.
Comments are lines of code that JavaScript will intentionally ignore. Comments are a great way to leave notes to yourself and to other people who will later need to figure out what that code does.
NOTE: As you write code, you should regularly add comments to clarify the function of parts of your code. Good commenting can help communicate the intent of your code—both for others and for your future self.
Use a one-dimensional array to solve the following problem:
Write an application that inputs ten numbers, each between 10 and 100, both
inclusive. Save each number that was read in an array that was initialized to a value
of -1 for all elements. Assume a value of -1 indicates an array is empty. You are then
to process the array and remove duplicate elements from the array containing the
numbers you input. Display the contents of the array to demonstrate that the
duplicate input values were actually removed.
[Note: do not display the array
elements where the value is -1].
We want to store the information of different vehicles. Create a class named Vehicle with two data member named mileage and price. Create its two subclasses
*Car with data members to store ownership cost, warranty (by years), seating capacity and fuel type (diesel or petrol).
*Bike with data members to store the number of cylinders, number of gears, cooling type(air, liquid or oil), wheel type(alloys or spokes) and fuel tank size(in inches)
Make another two subclasses Audi and Ford of Car, each having a data member to store the model type. Next, make two subclasses Bajaj and TVS, each having a data member to store the make-type.
Now, store and print the information of an Audi and a Ford car (i.e. model type, ownership cost, warranty, seating capacity, fuel type, mileage and price.) Do the same for a Bajaj and a TVS bike.
using inheritance write a Program to calculate discount If customer purchase clothes on Offseason, set discount 15% and on Onseason 40%
Should use two classes, Onseason and Offseason
Use two methods- discount(method name should be same)