Question

Consider the following class designed to store weather statistics at a particular date and time: public...

Consider the following class designed to store weather statistics at a particular date and time:

public class WeatherSnapshot
{
    private int tempInFahrenheit;
    private int humidity;        // value of 56 means 56% humidity
    private int dewPoint;        // in degrees Fahrenheit
    private String date;         // stores the date as a String
    private int time;            // in military time, such as 1430 = 2:30 pm
    private boolean cloudy;      // true if 25% or more of the sky is covered

    // constructor not shown, but it initializes all instance variables
    // postcondition: returns temperature
    public int getTemp()
    {
       return tempInFahrenheit;
    }

    // postcondition: returns date
    public String getDate()
    {
       return date;
    }
    // postcondition: returns true if precipitation is likely; false otherwise
    public boolean precipitationLikely()
    {
       // implementation not shown
    }

    // other methods not shown
}

Which of the following methods is a mutator method?

A. getTemp

B. getDate

C. precipitationLikely

D. None of the above are mutator methods.

E. All of the above are mutator methods.

0 0
Add a comment Improve this question Transcribed image text
Answer #1


D. None of the above are mutator methods.

Add a comment
Know the answer?
Add Answer to:
Consider the following class designed to store weather statistics at a particular date and time: public...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • The following is for java programming. the classes money date and array list are so I are are pre...

    The following is for java programming. the classes money date and array list are so I are are pre made to help with the coding so you can resuse them where applicable Question 3. (10 marks) Here are three incomplete Java classes that model students, staff, and faculty members at a university class Student [ private String lastName; private String firstName; private Address address; private String degreeProgram; private IDNumber studentNumber; // Constructors and methods omitted. class Staff private String lastName;...

  • public class Date { private int month; private int day; private int year; /** default constructor...

    public class Date { private int month; private int day; private int year; /** default constructor * sets month to 1, day to 1 and year to 2000 */ public Date( ) { setDate( 1, 1, 2000 ); } /** overloaded constructor * @param mm initial value for month * @param dd initial value for day * @param yyyy initial value for year * * passes parameters to setDate method */ public Date( int mm, int dd, int yyyy )...

  • Consider the class as partially defined here: //class Pizzaorder class Pizzaorder // static public members public...

    Consider the class as partially defined here: //class Pizzaorder class Pizzaorder // static public members public static final int MAX TOPPINGS 20: // instance members private String toppings[]; private int numToppings; // constructor public PizzaOrder () { numToppings toppings 0; String[MAX TOPPINGS]; new // accessor tells # toppings on pizza, i.e., #toppings in array public int getNum Toppings ()return numToppings; // etc. We want to write an instance method, addTopping) that will take a String parameter, topping, and add it...

  • Consider the Automobile class: public class Automobile {    private String model;    private int rating;...

    Consider the Automobile class: public class Automobile {    private String model;    private int rating; // a number 1, 2, 3, 4, 5    private boolean isTruck;    public Automobile(String model, boolean isTruck) {       this.model = model;       this.rating = 0; // unrated       this.isTruck = isTruck;    }        public Automobile(String model, int rating, boolean isTruck) {       this.model = model;       this.rating = rating;       this.isTruck = isTruck;    }                public String getModel()...

  • public class Fish { private String species; private int size; private boolean hungry; public Fish() {...

    public class Fish { private String species; private int size; private boolean hungry; public Fish() { } public Fish(String species, int size) { this.species = species; this.size = size; } public String getSpecies() { return species; } public int getSize() { return size; } public boolean isHungry() { return hungry; } public void setHungry(boolean hungry) { this.hungry = hungry; } public String toString() { return "A "+(hungry?"hungry":"full")+" "+size+"cm "+species; } }Define a class called Lake that defines the following private...

  • I need to create a Java class file and a client file that does the following:  Ask user to enter Today’s date in the fo...

    I need to create a Java class file and a client file that does the following:  Ask user to enter Today’s date in the form (month day year): 2 28 2018  Ask user to enter Birthday in the form (month day year): 11 30 1990  Output the following: The date they were born in the form (year/month/day). The day of the week they were born (Sunday – Saturday). The number of days between their birthday and today’s...

  • Write a class called Date that represents a date consisting of a year, month, and day....

    Write a class called Date that represents a date consisting of a year, month, and day. A Date object should have the following methods: public Date(int year, int month, int day) Constructs a new Date object to represent the given date. public void addDays(int days) Moves this Date object forward in time by the given number of days. public void addWeeks(int weeks) Moves this Date object forward in time by the given number of seven-day weeks. public int daysTo( Date...

  • Examine the following class definition: public class Date private int year; private int month; private int...

    Examine the following class definition: public class Date private int year; private int month; private int day; public Date() { ...) public void set (int x, int y, int z) { ...) public int getYear() { ...) // returns year public int getMonth() { } // returns month public int get Day () { ...) // returns day //more methods here -- 1 Which of the following statements in a client program correctly prints out the day of the object...

  • Java: Create the skeleton. Create a new file called ‘BasicJava4.java’ Create a class in the file...

    Java: Create the skeleton. Create a new file called ‘BasicJava4.java’ Create a class in the file with the appropriate name. public class BasicJava4 { Add four methods to the class that return a default value. public static boolean isAlphabetic(char aChar) public static int round(double num) public static boolean useSameChars(String str1, String str2) public static int reverse(int num) Implement the methods. public static boolean isAlphabetic(char aChar): Returns true if the argument is an alphabetic character, return false otherwise. Do NOT use...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT