1. Create a class named GlobalWarming. In that class, define the following instance variables and methods:]

Instance Variables

name: A String that is the name of the person taking the quiz.

Methods

GlobalWarming () – A default or no argument constructor that takes no parameters and initializes the instance variable to ‘null’.

GlobalWarming (String name) – A constructor that takes one parameter that will be the name of the person taking the quiz, and that will be used to initialize the instance variable.

sets/gets – to set and return the value of the instance variable(s)

quiz () – a method that administers the 10 question quiz (yes, 10 questions not the 5 of the text). It will calculate the number of correct answers and return that value to the calling ‘main’ method.

2. Create a test driver class named GlobalWarmingTest. This class will contain the ‘main’ method. The method will create/instantiate an object of type GlobalWarming, passing the name of the person taking the test as a parameter. (No need to read a value, simple write the statement creating the object and calling the constructor with your name as parameter.)

Once the object is created, ‘main’ will call the quiz () method of Global Warming. When quiz () returns, use the return value to select and print the appropriate message as follows:

10 correct: “Excellent”

8-9 correct: “Very good”

6 or fewer: “Time to brush up on your knowledge of Global Warming”

the question itself is; (Global warming facts quiz) the controversial issue of global warming has been widely publicized by the film”An inconvenient Truth,” featuring former Vice president Al Gore.Mr.Gore and a U.N. network of scientist, the intergovernmental Panel on Climate change, shared the 2007 Nobel Peace Prize in recognition of “their efforts to build up and dissminate greater knowledge about man-made climate change.” Research both sides of the global warming issue online (you might want to search for phrases like “global warming skeptics”). Create a five-question multiple choice quiz on global warming, each question having four possible ansers (numbered 1-4). Be objective and try to fairly represent both sides of the issue. Next, write an application that administers the quiz, calculates the number of correct answers (zero through five) and returns a message to the user. If the user correctly ansers five questions, print “Excellent”; if four,print “Very good”; if three or fewer points, print “Time to brush up on your knowledge of global warming,” and include a list of some of the webssites where you found your facts.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *