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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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