1. Choose your own category
2. Look for subcategories with similarities or shared attributes (atleast 3 subcategories)
3. Map inheritance on paper, list properties and methods
4. Define PHP classes
5. Inherit, extend, and override properties and methods
6. Create instances to test
Category Ideas: Animals, Clothing, Foods, Furniture, Musical Instruments.
Encapsulate the following Python code from Section 7.5 in a function named my_sqrt that takes a as a parameter, chooses a starting value for x, and returns an estimate of the square root of a.
while True:
y = (x + a/x) / 2.0
if y == x:
break
x = y
Write statements that perform the following one-dimensional-array operations (To test the items a-e below, create an integer array called numbers with 10 elements. Array should be first pre-initialized with random numbers from 1-100) or You can create a user defined Array taking input from user
For each array element.
a) Crete a method that will return sum of all the elements of an integer array.
b) Crete a method that will return the highest number in the array.
c)Crete a method that will return the lowest number in array.
d) Display all the values of an array in column format.
e) Create a method that will reverse the array or create a method to get the Average of the array.
Make a dictionary using linked list that searches names of people entered by the user using the First alphabet of the name
For example, if user enters names, Ali, abbas, bakar, rehan and then searches for names starting with 'a' then it displays the names
Abbas and Ali
Note:
No global declarations
Make use of class or struct
Test run your code in main
“If the height of a tree is reduced and balanced, then the searching time
also get reduced.” (True/ False) Justify. Construct a B-tree of order three with
the following set of elements where the elements are added to the tree one
after the other in the given sequence.23, 64, 48, 96, 101, 34, 55, 11, 22, 41,
89, 71, 78, 61, 83, 94, 8, 27, 35, 1.
arr1 = ["january","february","march","april","may","june"]
arr2 = ["july","august","septmber","october","november","december"]
combine two arrays
Write a program in Python programming language, which allows the user to input integer values for variables named lowerLimit and upperLimit. Based on the input values, the program should perform the following tasks:
• Calculate and display all odd numbers within the given range (lowerLimit to upperLimit).
• Calculate and display all even numbers within the given range (lowerLimit to upperLimit).
• Calculate and display the number of total even and odd numbers present within the range (lowerLimit to upperLimit).
*lowerLimit and upperLimit are included within range.
Write a program in Python programming language, which allows the user to input year value and based on the input value, the program should perform the following tasks:
Sample output for the wrong input:
Enter the year : -1995
wrong input !! year should be positive integer.
Enter the year : 19
wrong input !! worng input Enter the year in correct format i.e , 1980 or 2030
Sample output for the correct input:
Enter the year : 2020
2020 is a leap year
Enter the year : 2021
2021 is not a leap year
A processor method named upragedRAM(int) that receive the size of RAM to be upgraded as its parameter. This method will determine and return the price of RAM based on the following table:
RAM Size Price(RM)
8GB 98.00
16GB 299.00
3. Write main program :
a. Declare an array of objects named Laptops that store 10 laptop objects.
b. Ask user to enter all information required and store the data in the array above.
c. Calculate and display the total price of all Acer laptops
d. Display the brand of laptop thatt provides 4 USB ports
Given the definition of Laptop class as follows:
public class Laptop
{
private String brand; //HP, Acer, ASUS
private double price; //price per unit
private int RAM; // memory space in GigaByte(GB),e.g:2,4
private int USBport; //number of USB port e.g:2, 3, 4
//normal constructor: public Laptop (String, double, int, int)
//processor method: upradeRAM(int)
//accessors: getBrand (), getPrice(), getRAM(), getUSB()
}
1. Write full class definition for the Laptop class.