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
What specific type of DNS query instructs a DNS server to process the query until the server replies with an address that satisf
NeX [460]

Answer: a)Recursive

Explanation: Recursive DNS( Domain Name System) is the server that support the DNS servers in authority.They help in the management of the load that gets produced by the requests from the user. The load  is managed by splitting/distributing so that the website requests becomes supportive and load can be relieved.

Other options are incorrect because they don't revert with the query message   for the DNS servers processing .Thus, the correct option is option(a).

6 0
3 years ago
A seller buys and item from a manufacturer for 9,500
andriy [413]

we need more info

so we can answer the question

8 0
4 years ago
La computadora es un medio de comunicacion moderno?
kolbaska11 [484]
Moderno = mordern, if It does than yes!
3 0
3 years ago
A user of Augmented Reality is able to experience<br> of information on their surroundings.
Margarita [4]

Explanation:

A combination of our normal sense of the objects around us with an overlay of information displayed. Blurs the line between what's real and what's computer-generated by enhancing what we see, hear, feel and smell. Augmented reality is the integration of digital information with the user's environment in real time. Unlike virtual reality, which creates a totally artificial environment, augmented reality uses the existing environment and overlays new information on top of it.

Ex: projecting a phone pad to your hand, and Pokemon Go,

7 0
3 years ago
Write the definition of a method named add that receives a reference to a Scanner object associated with a stream of input consi
Lisa [10]

Answer:

import java.util.*;

class Main  

{

   public static void main(String[] args)

   {

       System.out.println("Enter integers and 0 to exit");

       Scanner a1=new Scanner(System.in);

       System.out.println(add(a1));

       

   }

  public static int add(Scanner a1)

  {

        int total = a1.nextInt();

          if (a1.hasNextInt())

              {

                 total =total +add(a1);

              }

       return total;

   }

}

Explanation:

The only thing that needs explanation here is hasnextInt. This returns true if entered number is integer and false if entered is not an integer. And rest is as shown in the program.

5 0
4 years ago
Other questions:
  • Which tasks can be completed within the File tab?
    8·1 answer
  • Maria wants to create a simple logo for her new flower shop. She would like to use the computer to create this logo. Maria shoul
    13·2 answers
  • Why does world of tanks keep downloading when I'm not even at the computer
    9·1 answer
  • You have just replaced the motherboard in your computer. now your computer will not start. you press the power button on the sys
    6·1 answer
  • What permission do users have by default regarding printer access and the ability to manage documents?
    14·1 answer
  • describe what measures should have been taken by the educational service and test preparation provider to avoid the security bre
    11·1 answer
  • The introduction of an academic paper must include a:
    12·2 answers
  • Suggest 4 new features for microsoft word/excel.
    9·1 answer
  • How am I supposed to delete my Brainly account if I don't know my password and my E-mail is made up?
    13·2 answers
  • Question 1 of 10
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!