Create a temperature demo program

Assignment Help Computer Engineering
Reference no: EM13323278

Create a Temperature class:
-Create methods to convert centigrade to fahrenheit and fahrenheit to centigrade.
-Make sure you take no input in this class and that it does not contain a main method.

Create a Temperature Demo program:
-Use your temperature class to create a temperature object.
-Ask the user for a value.
-Ask the user if the value is C or F.
-Display the user input and the result of the chosen operation to the screen.
-Repeat the program until the user chooses to quit.

My code below compiles correctly and meets all the requirements, but my methods need to be in a temperature class, not in the TemperatureDemo... Please help

my original code:

import java.util.Scanner;

public class TemperatureDemo {

public static void main(String[] args) {

char entry = 'e';

do {

Scanner in = new Scanner(System.in);

System.out.print("Enter a temperature: ");

double temp = in.nextDouble();

System.out.print("Centigrade or Fahrenheit? Enter c/f: ");

char unit = in.next().toLowerCase().charAt(0);

//methods

if(unit == 'f') {

System.out.println(temp + " Fahrenheit = " + (5 * (temp-32)/9) + " Centigrade");

}

else if(unit == 'c') {

System.out.println(temp + " Centigrade = " + (9 * (temp/5)+32) + " Fahrenheit");

}

else {

System.out.println("Invalid entry");

}

System.out.print("Enter q to quit or anything else to continue: ");

entry = in.next().toLowerCase().charAt(0);

} while(entry != 'q');

}

}

 

Reference no: EM13323278

Questions Cloud

Determine the initial acceleration of the metal cylinder : A 0.527 kg metal cylinder is placed inside the top of a plastic tube, the lower end of which is sealed off by an adjustable plunger, what is the initial acceleration of the metal cylinder
Show the parse tree for the expression 110 : The second grammar is unambiguous. This means that every expression in the language has exacty on parse tree. Show the parse tree for the expression 110.
Find its angular separation between central maxima : If wavelength is 5890 , and slits width is 0.25 mm, find its angular separation between central maxima
Determine total time for the compression wave to travel down : You are to perform a dynamic pile load test on a24-inch OD open ended homogeneous pipe pile. The pile has a shellthickness of 0.5 inch and is 80 feet long. Calculate: Compression wave velocity(hint: E=29x106 psi, g=490 pcf)
Create a temperature demo program : Make sure you take no input in this class and that it does not contain a main method.
Determine the pressure at the bottom of the tank : A large tank of water is full and has a depth of 10.0 m. What is the pressure at the bottom of the tank
Determine the pressure exerted on the floor by each leg : A 4.5-kg, three legged stool supports a 68-kg person. If each leg of the stool has a cross-sectional diameter of 3.0 cm, determine the pressure exerted on the floor by each leg
Determine the power required to run the compressor : Helium (Hrom an intie) at a rate of 1.5 lbm/s is compressed inan adibatic compressor from an intial condition of 70 F, 14.7 Psiato final condtion of 1070 F, 147 Psia. Determine The power required to run his compressor
Write a base class to hold basic computer information : Write a class that inherits the computer class for Windows computers.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Why organization that meets the company''s specifications

A software application has been delivered to your organization that meets the company's specifications. Using associated examples, describe problems which may arise when it is installed and used in your organization.

  How many units the want to buy

The program should ask the user three things:Which unit (A,B,C or D) he or she is responsable for buying, how many units the want to buy,and total budget for month.

  Implementing model to check the vulnerability

Construct a simple threat model which explains the risk this represents: attacker(s), vulnerability, assets, attack vector, and the likelihood of occurrence, likely impact, and the plausible mitigations.

  Program to find smaller between num1 and num2 to output

Program to find smaller between num1 and num2 to output

  Generate a class named realtorcommission

generate a class named RealtorCommission. Fields include the sale price of a house, the sales commission rate, and the commission. Create two constructors.

  What is standard purchasing system

SPS system would standardize purchasing practices for each Snad and Surf subsidiary and manage all purchasing information. System testing will be completed by end of the week. What kinds of documentation are required for this application?

  Create a class named package with data fields for weight

Create a class named Package with data fields for weight in ounces (oz.), shipping method, and shipping cost.

  The web page is passed back to the client

One of the features of Javascript that we have been looking at this week is that code is interpreted within the browser environment, on client machine.

  What fields you believe would be primary keys

Be sure to include the field type and size. Please do not jump ahead and try to create tables. now I'm just looking for a list of fields. This is somewhat vague on purpose. I want you to decide what is required in the database.

  Identify current strengths and weaknesses in the firm

Each weakness must be addressed in the action plan. I might select any firm with which I'm associated with (I don't have any), or any other firm that will cooperate in providing necessary information to complete this project.

  Sense making in health care organizations

Evaluate the most suitable way that the “sense making” may be applied to the health care organizations. Give the specific examples in order to support your response.

  Would you agree with the materialism philosophy

The mind-body dualism, in philosophy, maintains that the mind and brain are two distinct categories and one cannot be explained in terms of the other: Mental phenomena are not physical and cannot be explained in physical terms.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd