https://www.youtube.com/watch?v=rLFYIq3iID8 Starting out with Java: From control structures through objects Chapter 6 Programming Challenges 8. Temperature class Write a Temperature class that will hold a temperature in Fahrenheit, and provide methods to get the temperature in Fahrenheit, Celsius, and Kelvin. The class should have the following field: • ftemp–A double that holds a Fahrenheit temperature. The class should have the following methods: • Constructor–The constructor accepts a Fahrenheit temperature (as a double) and stores it in the ftemp field. • setFahrenheit – The setFahrenheit method accepts a Fahrenheit temperature (as a double) and stores it in the ftemp field. • getFahrenheit – Returns the value of the ftemp field, as a Fahrenheit temperature (no conversion required). • getCelsius – Returns the value of the ftemp field converted to Celsius. • getKelvin – Returns the value of the ftemp field converted to Kelvin. Use the following formula to convert the Fahrenheit temperature to Celsius: Celsius = (5/9) x (Fahrenheit - 32) Use the following formula to convert the Fahrenheit temperature to Kelvin: Kelvin = ((5/9) x (Fahrenheit - 32)) + 273 Demonstrate the Temperature class by writing a separate program that asks the user for a Fahrenheit temperature. The program should create an instance of the Temperature class, with the value entered by the user passed to the constructor. The program should then call the object’s methods to display the temperature in Celsius and Kelvin. Gaddis, Tony (2015-05-29). Starting Out with Java: From Control Structures through Objects (Page 398 and 399). Pearson Education. Kindle Edition. Happy Steeming Everyone! :)
author | kakradetome |
---|---|
permlink | 6-8-part-1-temperature-class-java |
category | programming |
json_metadata | {"tags":["programming","coding","java","temperature-class","tony-gaddis"],"image":["https://img.youtube.com/vi/rLFYIq3iID8/0.jpg"],"links":["https://www.youtube.com/watch?v=rLFYIq3iID8"],"app":"steemit/0.1","format":"markdown"} |
created | 2017-01-08 18:29:42 |
last_update | 2017-01-08 18:29:42 |
depth | 0 |
children | 0 |
last_payout | 2017-02-08 18:59:18 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.539 HBD |
curator_payout_value | 0.156 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 1,713 |
author_reputation | 31,794,084,266,065 |
root_title | "6.8 (Part 1) Temperature Class - Java" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 2,196,092 |
net_rshares | 8,431,846,555,112 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
anonymous | 0 | 179,899,397,100 | 40% | ||
rainman | 0 | 4,808,594,867,446 | 40% | ||
penambang | 0 | 25,407,582,248 | 72% | ||
berkah | 0 | 32,287,275,977 | 72% | ||
hello | 0 | 48,547,442,095 | 40% | ||
world | 0 | 18,228,930,646 | 40% | ||
fufubar1 | 0 | 26,504,986,593 | 40% | ||
wang | 0 | 901,562,378,400 | 72% | ||
boy | 0 | 6,355,626,612 | 100% | ||
steem-id | 0 | 31,373,096,525 | 72% | ||
bue-witness | 0 | 7,738,449,062 | 100% | ||
bunny | 0 | 1,253,772,018 | 100% | ||
bue | 0 | 121,664,661,739 | 100% | ||
mini | 0 | 3,401,305,747 | 100% | ||
moon | 0 | 432,743,029 | 100% | ||
joseph | 0 | 274,768,974,581 | 72% | ||
biodragon | 0 | 30,066,049,384 | 72% | ||
boombastic | 0 | 316,193,999,020 | 40% | ||
mrs.agsexplorer | 0 | 39,829,330,455 | 40% | ||
idol | 0 | 1,485,522,992 | 72% | ||
healthcare | 0 | 1,273,040,816 | 100% | ||
daniel.pan | 0 | 2,009,634,036 | 100% | ||
helen.tan | 0 | 584,633,802 | 100% | ||
jocelyn | 0 | 16,140,629,731 | 72% | ||
murh | 0 | 1,266,729,055 | 11% | ||
proglobyte | 0 | 898,103,732 | 20% | ||
kimziv | 0 | 58,208,960,093 | 40% | ||
fyrstikken | 0 | 54,584,165,800 | 2% | ||
good-karma | 0 | 78,849,454,228 | 57.6% | ||
roelandp | 0 | 170,989,372,843 | 72% | ||
rubybian | 0 | 31,126,640,727 | 40% | ||
kakradetome | 0 | 10,586,115,552 | 100% | ||
picokernel | 0 | 21,297,361,702 | 72% | ||
allmonitors | 0 | 17,794,822,922 | 100% | ||
artific | 0 | 22,123,386,768 | 10% | ||
lichtblick | 0 | 92,714,145,728 | 100% | ||
mysteem | 0 | 4,731,084,478 | 57.6% | ||
sergey44 | 0 | 308,272,775 | 100% | ||
pinkisland | 0 | 35,701,548,278 | 100% | ||
sisterholics | 0 | 17,177,041,994 | 40% | ||
alex.chien | 0 | 593,311,657 | 40% | ||
proglobyte-m1 | 0 | 820,731,730 | 12% | ||
craigslist | 0 | 863,404,449 | 100% | ||
tingaling | 0 | 659,731,998 | 10% | ||
laonie | 0 | 380,653,010,388 | 40% | ||
laonie1 | 0 | 9,676,972,919 | 40% | ||
laonie2 | 0 | 9,678,314,633 | 40% | ||
laonie3 | 0 | 9,684,101,591 | 40% | ||
myfirst | 0 | 26,985,756,528 | 40% | ||
somebody | 0 | 115,677,459,696 | 40% | ||
kingofcoin | 0 | 2,353,516,768 | 40% | ||
flysaga | 0 | 4,307,181,075 | 40% | ||
midnightoil | 0 | 22,236,220,378 | 40% | ||
laonie4 | 0 | 9,688,994,946 | 40% | ||
laonie5 | 0 | 9,679,149,507 | 40% | ||
laonie6 | 0 | 9,676,722,570 | 40% | ||
laonie7 | 0 | 9,676,496,172 | 40% | ||
kurtbeil | 0 | 17,995,616,965 | 20% | ||
laonie8 | 0 | 9,672,234,149 | 40% | ||
xiaohui | 0 | 81,741,987,308 | 40% | ||
elfkitchen | 0 | 24,950,100,543 | 40% | ||
fishingvideos | 0 | 13,820,803,345 | 40% | ||
xiaokongcom | 0 | 1,964,120,619 | 40% | ||
numberone | 0 | 2,268,859,856 | 40% | ||
xianjun | 0 | 3,820,284,780 | 40% | ||
bhavnapatel68 | 0 | 43,598,675,018 | 100% | ||
zentat | 0 | 1,093,212,107 | 20% | ||
microluck | 0 | 256,785,086 | 40% | ||
pjheinz | 0 | 5,407,520,608 | 40% | ||
laonie10 | 0 | 9,546,594,540 | 40% | ||
imag1ne | 0 | 1,812,214,706 | 40% | ||
steembriefing | 0 | 514,169,598 | 8% | ||
nulliusinverba | 0 | 1,532,740,783 | 40% | ||
laonie11 | 0 | 9,340,935,169 | 40% | ||
blockcodes | 0 | 552,752,246 | 40% | ||
maryfromsochi | 0 | 1,297,203,984 | 40% | ||
pjo | 0 | 886,837,712 | 57.6% | ||
finleyexp | 0 | 1,441,815,190 | 57.6% | ||
feruz | 0 | 172,261,575 | 57.6% | ||
burnin | 0 | 4,656,437,805 | 40% | ||
xiaofang | 0 | 6,144,362,074 | 40% | ||
steemint | 0 | 677,259,802 | 10% | ||
birds90 | 0 | 18,056,493,493 | 40% | ||
better | 0 | 3,927,642,165 | 40% | ||
gamer00 | 0 | 25,251,475,957 | 40% | ||
trans-juanmi | 0 | 2,104,622,744 | 40% | ||
esteemapp | 0 | 178,829,335 | 57.6% | ||
tamersameeh | 0 | 289,092,116 | 72% |