Question
4. Design a positive random number generator using method overloading. a) Return a random number between 0 to 100 if no parameter is passed by
4. Design a positive random number generator using method overloading. a) Return a random number between 0 to 100 if no parameter is passed by the user. b) Return a random number between o to "n", if user pass 1 "n" int number. c) Return a random number between 101 to 500 and append a message if user pass the single string message. d) Return a random number between the given two numbers, if the user passes two int number. e) Return a random number between the given two numbers and append a message if user pass two int number and a string message. f) You can use your own logic to calculate random number OR use built in library function.
2. create a class of a Player. Create child classes called Footballer and Cricketer. Create child classes of Footballer and call it GoalKeeper, Midfielder and Defender. Create child classes of Cricketer and call it Bowler, Batsman and allrounder using the concept of inheritance. Define possible properties and methods of each class using appropriate access modifiers a) Show how encapsulation concept works for this. b) Write which type(s) of inheritance this solution would take. c) Create objects of each class and access members. d) Show how child classes can use parent class members.
language java provide answer as early as possible ask if you have any query
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started