java basic codes

Anonymous
timer Asked: Feb 28th, 2018
account_balance_wallet $5

Question Description

Define an abstract class named Temperature that stores a single temperature (as an integer value). The class should contain the following:

  • An integer variable for storing the temperature
  • An alternator constructor, passed a temperature value
  • A single getter method
  • An abstract toString method
  • An abstract method belowFreezing (that returns true if the temperature is below freezing or not)
  • An abstract method swimmingWeather (that returns true if the temperature is warm enough to go swimming)
    Define a subclass of the Temperature class named Fahrenheit, containing the following:
  • An alternator constructor, passed a temperature value (making a call to its parent constructor)
  • An implementation of the toString method to return a string of the form “76 degrees Fahrenheit”
  • An implementation of method belowFreezing (to return true if the temperature is less than 32 degrees)
  • An implementation of method swimmingWeather (to return true if the temperature is greater than or equal to 80 degrees)
  • An implementation of method convertToCelsius that returns the temperature in degree Celsius (as a floating point value) Define a subclass of the Temperature class named Celsius, containing the following:
  • An alternator constructor, passed a temperature value (making a call to its parent constructor)
  • An implementation of the toString method to return a string of the form “76 degrees Celsius”
  • An implementation of method belowFreezing (to return true if the temperature is less than 0 degrees)
  • An implementation of method swimmingWeather (to return true if the temperature is greater than or equal to 27 degrees)
  • An implementation of method convertToFahrenheit that returns the temperature in degree Fahrenheit (as a floating point value) Finally, develop and appropriate test driver for the Fahrenheit and Celsius classes.

Tutor Answer

ProfDwayne01
School: New York University

check the source code for the above java program implementation also check the java file zippedin case of a comment inform

JAVA BASIC SOURCE CODE

package temperature;
abstract class Temperature
{
//An integer variable for storing the temperature
private final int temp;
//An alternator...

flag Report DMCA
Review

Anonymous
awesome work thanks

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors