1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
statuscvo [17]
3 years ago
8

Given the following class: Create a class MyGenerator that can be used in the below main method.

Computers and Technology
1 answer:
natali 33 [55]3 years ago
4 0

Answer:

Explanation:

The below code shows the complete code for the project. we have used Math.random() as a means of generating a random double value in the getRandom() method since it is not specified.

class Random {

          \ \ \ \ \ \ \ \ \mathbf{  public  \ static \  void  \ main \ (String[] \  args) \ \   \{}

               perform(new MyGenerator());

       }  

           \mathbf{private  \ static \  abstract  \ class  \ Generator \{ \ }

                  \mathbf{ \ protected  \ abstract  \ double \  getRandom();}

       }  

       public static <T extends Generator> void perform(T g) {

               \mathbf{System.out.println(g.getRandom());}

       }  

       // MyGenerator class inherited from Generator

       public static class MyGenerator extends Generator {

               // implementing abstract method getRandom() of Generator class

               \mathbf{Override}

               \mathbf{protected \  double  \ getRandom() \{ }

                       //returning a single double value between 0.0 and 1.0

                       \mathbf{return \ Math.random();}

               }

       }

}

/*OUTPUT (will be random)*/

0.53296649765

You might be interested in
Write a code segment that displays the values of the integers x, y, and z on a single line, such that each value is right-justif
Elena L [17]

Answer:

x = int(input ("enter first number: "))

y = int(input ("enter second number: "))

z = int(input ("enter third number: "))

print('%6d %6d %6d' %(x,y,z))

Explanation:

Using python programming language we receive three integers variables (x,y,z) then using string formatting (%6) which specifies that the output should be right justified with a width of 6, the values are printed out.

3 0
3 years ago
The global network that links millions of computers is the
vitfil [10]
Your answer would be C. Internet since we all use the internet everyday to communicate through all over the world. We can currently communicate to the other side of the world with little to no effort now, almost 10 years ago it would of been very difficult.
6 0
3 years ago
Read 2 more answers
3.8 LAB: Read values into a list
Salsk061 [2.6K]

An example of Read values into a list is:

#!/usr/bin/python

list1 = ['math', 'chemistry', 1995, 2001];

list2 = [1, 2, 3, 4, 5, 6, 7 ];

print "list1[0]: ", list1[0]

print "list2[1:5]: ", list2[1:5]

<h3>What is Python Lists?</h3>

This is known to be a list that is seen as the a most versatile in terms of datatype that are known to be available in Python.

It is one that can be written as a list of comma-separated values that is found in between square brackets.

Note that the most Important thing about a list is that all the items in a list are ones that do not require to be of the same type.

Hence Creating a list is very simple to do and it is done by putting a lot of comma-separated values in between square brackets.

Therefore, An example of Read values into a list is:

#!/usr/bin/python

list1 = ['math', 'chemistry', 1995, 2001];

list2 = [1, 2, 3, 4, 5, 6, 7 ];

print "list1[0]: ", list1[0]

print "list2[1:5]: ", list2[1:5]

Learn more about python list  from

brainly.com/question/24232863

#SPJ1

8 0
2 years ago
What is one reason why a business may want to move entirely online?
Sidana [21]

Answer:

The correct answer is C. One reason why a business may want to move entirely online is to focus on a global market.

Explanation:

The fact that a business wishes to move entirely towards the online sales modality implies that there is a desire to expand the possibilities of selling its products beyond the physical place where it has its store.

It is a reality that starting an online business implies that the offered product can be purchased anywhere in the world, thanks to advances in technology and transportation that allow the product to be purchased and delivered in a matter of days, thanks to the advances produced by globalization.

Therefore, the fact that the store goes from physically to online selling makes its potential customers go from being the ones who know the store and live close to it to everyone in the world with access to internet.

3 0
3 years ago
Choose the missing term.
qaws [65]

Answer:

import

Explanation:

the <em>import </em>keyword is used to import external modules into a python script.

6 0
2 years ago
Other questions:
  • Which of the following is not a common network architecture type?
    9·1 answer
  • 3. What are the first steps that you should take if you are unable to get onto the Internet? (1 point)
    15·1 answer
  • Susan works for a company that values their employees me and deadlines in finding ways to keep the cost of doing business low wh
    12·1 answer
  • Why does every image on brainly look like this too me?? it started today
    15·2 answers
  • Under the Home tab, controls for aligning text and objects can be found in the
    5·2 answers
  • Does anyone have Rblx? if so write your username
    6·1 answer
  • Which version of java should i use?.
    13·1 answer
  • Can you please help me with this crossword puzzle, I am having trouble with numbers 5 down and 22 across.
    5·2 answers
  • The Internet is a worldwide communications network. Which device connects computer networks and computer facilities?
    11·1 answer
  • At a family reunion, your cousin takes a picture of both of you with her phone, orders a print of it, and mails it to you with a
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!