Develop a Python application that will randomly select n integers from 1 to 45 without repetitions.
Sample Output:
How many numbers? 6
6 randomly selected nos.
[33, 13, 24, 22, 38, 34]
I need the code to have an output stated above.
Develop a Python application that will accept two non-negative integers and store them in a list and will append ten additional values equivalent to the sum of the two previous elements of the list.
Sample Output:
First Number: 1
Second Number: 3
[1, 3, 4, 7, 11, 18, 29, 47, 76, 123, 199, 322]
I need the code to have an output stated above.
Define an abstract base class SHAPE that includes protected data members for the (x,y) position of a shape, a public method to move a shape , and a public abstract method show() to output a shape .Derive subclasses for lines, circles and rectangles. Also define the class POLYLINE with SHAPE as the base class. You can represent a line as two points, a circle as a center and a radius. A rectangle as two points on diagonally opposite corners. Implement the toString() method for each class. Test the classes by selecting ten random objects of the derived classes, then invoking the show() method for each class. Use the toString() method in the derived classes.
Create a class to print the area of a rectangle. The class has two methods with the same name but different number of parameters. The method for printing area of rectangle has two parameters which are length and breadth.
Create a class called computers and two classes MyComputer and YourComputer which inherits computer class. Define appropriate fields for the three classes. Create another class processor as a composite class of computer. Write a method which prints the differences between the processors of two computers.
Question 3: (Inheritance)
Create an abstract class called Employee that has an abstract method call computePay() which
computes the total pay per employee using the rate per hour = $50. The method should accept
the number of hours the employee has worked. Create a child class called employeeChild and
provide the implementation. In the main method invoke that method and get the number of hours
worked from the user and pass it to the called method.
Question 2 (Polymorphism)
Mathematically, the area of a rectangle is computed as length * width, the area of a circle is
computed as pi*radius*radius. Given that pi = 3.14, write a Java program with an overloaded
method called getArea() that can compute for the area of a circle or rectangle depending on the
parameters supplied. Illustrate how you will invoke the method in the main method for the two
scenarios.
You’re working on a search engine. Watch your back Google!
The given code takes a text and a word as input and passes them to a function called search().
The search() function should return "Word found" if the word is present in the text, or "Word not found", if it’s not.
Sample Input
"This is awesome"
"awesome"
Sample Output
Word found
Develop a Python application that will randomly select n integers from 1 to 45 without repetitions.
Sample Output 1:
How many numbers? 6 6 randomly selected nos. [21, 35, 16, 36, 5, 8]
Question 1: (Inheritance)
Consider a scenario where you have been given three classes, namely Vehicle, Bus, and
School_Bus. The School_Bus class is supposed to inherit all characteristics of both the Vehicle
and the Bus class. Explain and illustrate how you are going to achieve this considering you are using Java programming language.