Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Objective: Use PHP classes to code a temperature converter. PHP Class Definition: Temperature celsius Temp: float - fahren Temp: float - kelvin Temp: float +

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Objective: Use PHP classes to code a temperature converter. PHP Class Definition: Temperature celsius Temp: float - fahren Temp: float - kelvin Temp: float + temperature(float temperature, string type): void + incrementTemp(float interval, string type): void + getCelsius(): float + getFahren(): float + getKelvin(): float + isBoiling(): string + isFreezing(): string . O . O Class specifications: Your constructor should take in an initial temperature and a type (C for Celsius, K for Kelvin, and F for Fahrenheit) The constructor should store the temperature to the appropriate variable and also perform the appropriate conversions to initialize the other two temperature types incrementTemp should take in an interval to alter your temp and the type it's incrementing (incrementing a Celsius temperature by 10 is way different than incrementing a Fahrenheit temperature by 10) The other temperature types should be incremented based on the appropriate interval through conversion getCelsius, getFahren, and getKelvin should all return number values format to two decimal places isBoiling should check if the current temperature is at or above the boiling point -- since the Celsius, Fahrenheit, and Kelvin temperatures should be equivalently the same temperature, you should only have to check one value (Celsius for example) -- return a string "True" or "False": this allows to printing a value more easily readable by a user isFreezing checks is the current temperature is at or below the freezing point -- return a string "True" or "False": this allows printing a value more easily readable by a user . O Program specifications: Implement the class within its own PHP file (called Temperature.php) The function names should match those given in the class definition -- it must work with my test file Implement a second PHP file that imports the class and tests it (called testTemperature.php) testTemperature.php should implement one of the example tables found below Additionally, there should be a second table that uses a different incrementer (so, for instance, 25 instead of 10) and start point (so, maybe 100 instead of 0) testTemperature.php should validate through w3school's validator -- remember, PHP doesn't validate, so you must get the code from the source in the browser and validate that O O o Use the following CSS in your php file to style the table: Compare Temperatures Deliverables: Temperature.php testTemperature.php Link to your testTemperature.php on Pluto . o o Point Breakdown: Assignment submit correctly - 10pts This includes Pluto upload, Canvas upload, and the link to where your file is located Temperature.php - 50pts Naming conventions and functions match those of the class definition (must work with the provided test file) Returns rounded numbers Math is correct isBoiling/isFreezing only checks one temperature set testTemperature.php - 40pts Includes both requested tables Source validates properly O o O . O o Lab Hints . O . o Class tips: Private/Public A minus sign (-) denotes a private variable/function A plus sign (+) denotes a public variable/function Variables: The middle portion has all the variables your class should use The type that is expected for those is listed Functions: The bottom portion contains all the functions your class should have temperature is your constructor -- make sure you label it correctly in your program to follow PHP conventions The definitions contain what should be passed to the functions and what it is expected to return o O o o Technical tips: Kelvin to Fahrenheit: F = K * 9/5 - 459.67 Kelvin to Celsius: C = K -273.15 Celsius to Fahrenheit: F = C* 9/5 + 32 . . General Tips: There are types declared in the class definition for parameters and return types -- keep in mind PHP has no explicit type casting. You should not use it, nor will you need to use it. This is just a tool to show you what data you should be expecting to use/return. You can adjust how many columns a cell takes up via the "colspan" attribute on your "" or "" Example tables: Celsius starts at 0, increments by 10 Celcius Kelvin Fahrenheit Boiling Freezing 0.00 273.15 32.00 False True 10.00 283.15 50.00 False False 20.00 293.15 68.00 False False 30.00 303.15 86.00 False False 40.00 313.15 104.00 False False 50.00 323.15 122.00 False False 60.00 333.15 140.00 False False 70.00 343.15 158.00 False False 80.00 353.15 176.00 False False 90.00 363.15 194.00 False False 100.00 373.15 212.00 True False Fahrenheit starts at 0, increments by 10 Celcius Kelvin Fahrenheit Boiling Freezing -17.78 255.37 0.00 False True -12.22 260.93 10.00 False True -6.67 266.48 20.00 False True -1.11 272.04 30.00 False True 4.44 277.59 40.00 False False 10.00 283.15 50.00 False False 15.56 288.71 60.00 False False 21.11 294.26 70.00 False False 26.67 299.82 80.00 False False 32.22 305.37 90.00 False False 37.78 310.93 100.00 False False

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

9th Edition

B01JXPZ7AK, 9780805360479

More Books

Students also viewed these Databases questions

Question

3. Write a policy statement to address these issues.

Answered: 1 week ago