HeapSort a given array with constant space complexity O(1).
Design a method that determines whether or not a binary tree is fully balanced.
This method takes no parameters, and returns a boolean value: true if the tree is
fully balanced, and false if it is not.
Write a Java program to sort a numeric array and a string array
The organisation you work for has asked you to create an interactive application that will assist with the allocation of employees to a cell phone network provider and phone number generation. You are required to prompt a user for three employee names which will randomly assign the employee to either the Vodacom, MTN or Cell C network. The employees also require a randomly generated phone number. The start of each phone number will begin with the following, depending on the network provider: NETWORK PROVIDER START Vodacom 072 MTN 083 Cell C 084 The remaining numbers of the phone number must be randomly generated
Program 2 – Seasons in the sun Create a Java application which will prompt the user to type in any month number (1-12). Implement a switch statement that will display the season. The seasons according to the months are: 1. Summer: November, December, January and February 2. Autumn: March, April and May. 3. Winter: June, July, August. 4. Spring: September and October
Sam runs a local musical equipment store in your neighbourhood. He has contracted you to create an interactive application that will assist him with customer purchases. Create a class named Customer Purchases that will contain get and set methods for a customer number, first name, surname, product, price and quantity. Create a separate class called Printing that will include a method called Print Details, that will print the Customer Invoice. In the Printing class include another method called Customer Purchase Report which will display the following information: REPORT OPTION PERCENTAGE TAX 15% COMMISSION 8.5% DISCOUNT 10% TOTAL (Price + Tax) – (Discount + Commission
Define a class called Complex with instance variables real, imag and instance methods
setData(), display(), add(). Write a Java program to add two complex numbers.
The prototype of add method is: public Complex add(Complex, Complex).
Create a GUI application “Address Book” which can be used to store and search the information of different people. The information can be: name, phone no, email, street address etc. Your project should have the following features:
1. A GUI where user can input the information of a particular people
2. A file where all information are stored. (You will have to append new info to the file. Otherwise the previous information will be lost ,you have to use file reader and writer method)
3. A GUI in which the user will be able to see all the information, sorted by name. The information must come from the file where you stored user information. (Hint: use JTextArea to show all user info)
4. A GUI where the user will be able to search a person using his name or phone no. The search result should show the info of all the matched person
5. A GUI where the user will be able to edit the information of a specific person.
Exercise 1:
1. //The max function the max between a and b, it returns a if a == //b
public double max(double a, double b);
2. //The mult function returns the result of a * b public double mult(double a, double b);
3. //The exist in array function returns the index of the element //‘a’ if //‘a’ exist in array ‘arr’ otherwise returns ‘-1’ public int existsInArray(int [] arr, int a);
4. //Are array equals method compares two arrays and returns true // if the elements of array ‘a’ are equal to elements of array
// ‘b’, element by element. If equals it returns 0, it returns -
// 1 if not
public int areArrayEquals(int [] a, int [] b);
Devise four executable test cases for every method in the JUnit notation. See the attached handout for a refresher on the notation.
Suppose that you are hired by a High-End “Gola Ganda” shop, this shop offers Gola Gandas of all shapes and sizes. They have basic gola gandas of three sizes: Small, Medium and Large. All have different prices
A customer can add as many toppings on it as they want, the toppings could be more “Sauce”, Condensed Milk, Nutella, etc (more can be added). Every topping has a different cost, and the cost of each topping will be added on top of the cost of the size of gola ganda.
For example, if a small gola ganda cost, 50 rupees, and a topping of condensed milk cost 10 rupees, and a topping of Nutella cost 20 rupees, and if a customer has ordered a small gola ganda with condensed milk and Nutella then the total cost will be 80 rupees (50 for small gola ganda, 10 for condensed milk, and 20 for Nutella).