Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help with this question This assignment has 50 marks. 5 marks for style (hand marked by a TA) 45 marks for correctness marked by

Please help with this question image text in transcribed
image text in transcribed
This assignment has 50 marks. 5 marks for style (hand marked by a TA) 45 marks for correctness marked by the server 0 Style Part of your grade for this assignment will be for style. Style for this assignment will consist of (a) Good use of inline comments. 5 marks (b) Good attribute, method and variable names (when you create them) (c) Good use of whitespace (indenting, empty lines) (d) Good attribute choices for storing the state of your objects. 1 Temperature 15 marks] Complete the provided Temperature class. Add any attributes and helper methods as needed but keep in mind that testing will involve only the methods you are asked to write/complete. You must complete the constructors and methods in the provided class (without changing any signatures return types, or modifiers). In this problem you will need to be able to convert temperatures betwen Celsius, Fahrenheit and Kelvin. For help, see httpe://en.vikipedia.org/viki/Coversion of units of temperature A temperature object holds a single temperature and displays it in one of the three scales. Once a scale has been set, it will display the temperature in that scale until changed. The default scale is Celsius if not specified For one of the methods, setTemp(double temp, String scale), the specification is a bit open ended. In this method, you will try to allow any scale input string that resembles the intended input. At the very least, it niust work correctly for the three input strings-CELSIUS..FAHRENHET" and KELVIN In order to receive full marks for this method it must be able to process more strings correctly. For example, see in the examples below. (Don't worry about processing typos of the names. Case and shortened versions should be handled.) Some examples of using a Temperature object: Temperature t nev Tenperature (10.1); System . out.printin (t.getScale()); // outputs System.out printin(t) the char . // outputs 10.1C COMP1406-Winter 2019 MacBook Pro WIl volve only the methods you are asked to write/complete. You must complete the constructors and methods in the provided class (without changing any signatures, return types, or modifiers) In this problem you will need to be able to convert temperatures between Celsius, Fahrenheit and Kelvin. For help, see https://en.wikipedia.org/wiki/Conversion of units of.temperature A temperature object holds a single temperature and displays it in one of the three scales. Once a scale has been set, it will display the temperature in that scale until changed. The default scale is Celsius if not specified. For one of the methods, setTemp (double temp, String scale)'the specification is a bit open ended. In this method, you will try to allow any scale input string that resembles the intended input. At the very least, it must work correctly for the three input strings "CELSIUS", "FAHRENHEIT" and KELVIN. In order to receive full marks for this method it must be able to process more strings correctly. For example, see in the examples below. (Don't worry about processing typos of the names. Case and shortened versions should be handled.) Some examples of using a Temperature object: Tesperature t ne Temperature (10.1); System.out.println(t.getScale)); // outputs the char c System.out printin(t); // outputs 10.1C COMP1406-Winter 2019 Assignment #2 Due Friday, February 8 at 5:30 pm t . setScale (Scale . FAHRENHEIT ) ; System.out.println(t); System.out.println(t.getScale)) t.setTemp(12.25 "Kel"); System.out.printin(t) // outputs 50.18F I outputs the char F' // outputs 12.25K When you set a temperature (without explicitly stating the scale), it is assumed that the input temperature is in whatever scale the object is currently using Note: You should have no static attributes or methods in your class (unless they were supplied in the starter code) 2 Weather 30 marks] MacBook Pro

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

Distributed Relational Database Architecture Connectivity Guide

Authors: Teresa Hopper

4th Edition

0133983064, 978-0133983067

More Books

Students also viewed these Databases questions

Question

What is the environment we are trying to create?

Answered: 1 week ago

Question

How can we visually describe our goals?

Answered: 1 week ago