Find an optimal solution for the knapsack instance n (number of objects) =7 and
W ( totalweight) =15. Profits and weights of each object are shown below:
(p1, p2………..p7) = (10, 5, 15, 7, 6, 18, 3)
(w1, w2………w7) = (2, 3, 5, 7, 6, 4, 1)
Show all the steps.
What is the out of the following... system.out.println(str.substring(0,5));
Create a community website using html and css, for neighborhoods and small towns, include features such as an events calendar and forum where residents can post relevant questions and comments. You can also add a blog and newsletter where you can share neighborhood stories and keep people updated with the latest local news. The main pages should be index.html, About Us, Contact us, Gallery. Your Contact Us page must have a php form (Contact Us Form) that should be responsive and be very connected to the database that should accept the information.
A teen ager Sport Club offers many sports to the registered members write a java code to keep facilitate the players.
Create a class name Play
⦁ Create the following method name
⦁ checkMatchSchedule(): This method will display the match schedule.
⦁ checkMatchSchedule():(): This method will display the match practice schedule.
⦁ rules(): display the sport rule.
Create the following classes:
⦁ Tennis, Cricket and football.
⦁ These classes will inherit the play class and override the parent methods.
Create a Player class:
⦁ playerId, name , height, weight, age.
⦁ checkMatchSch(): This method will take input from user inquiring which sport match schedule would he like to view and display the schedule of the respective Sport.
⦁ checkRules():This method will take input from user inquiring which sport rules would he like to view and display the rule of the respective Sport.
Create a Main class and test the methods.
Create a class name FunWithArrays and create the following methods:
⦁ consecutiveValueChecker(int arr[]): This method will not allow user to input consecutive values in an array
Input:
3,4,2,1,5,5
Output:
Cannot input consecutive value please input value other than 5
⦁ calcultesLongestSequence(String arr[]): This method will take a string array and calculate length of values at each index also print the word having the longest length
The following program is supposed to read two numbers from a file named Ex20Input.txt, and write the sum of the numbers to a file named Ex20Output.dat. However, it fails to do so. Rewrite the program so that it performs correctly. (You may assume that both numbers are on the same line.) import java.util.*; public class Ch3Ex20 { public static void main(String[] args) { Scanner inFile ¼ new Scanner(new FileReader("Ex20Input.txt")); int num1, num2; num1 = inFile.nextInt(); num2 = inFile.nextInt(); outFile.println("Sum = " + (num1 + num2)); outFile.close(); } }
Mean, Median and Mode
Given a list of integers, write a program to print the mean, median and mode.
Mean - The average value of all the numbers.
Median - The mid point value in the sorted list.
Mode - The most common value in the list. If multiple elements with same frequency are present, print all the values with same frequency in increasing order.
See Sample Input/Output for the output format.
Sample Input 1
2 4 5 6 7 8 2 4 5 2 3 8
Sample Output 1
Mean: 4.67
Median: 4.5
Mode: 2
Sample Input 2
2 6 3 1 8 12 2 9 10 3 4
Sample Output 2
Mean: 5.45
Median: 4
Mode: 2 3
The output should be in this function format given below :
def find_mean(num_list):
# Complete this function
def find_median(num_list):
# Complete this function
def find_mode(num_list):
# Complete this function
num_list = list(map(int, input().split()))
# Call the appropriate functions and print the results
Explain the order of execution of constructors in multilevel inheritance using an example.
Write a program to count the palindromic array elements from the group of 30 array elements where array is allocated memory dynamically.