ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 2 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 05 May 2017 My Price 9.00

user types Y, it calculates the Fahrenheit

JavaScript

When user types Y, it calculates the Fahrenheit.  when user types N, it still asks for the Fahrenheit.   if user types N again, it gives the Celsius. and then it's complete. I'm missing a loop or there's something off on the loop... but I can't figure out what it is.   

 

import java.io.BufferedReader;

import java.io.IOException;

import java.io.InputStreamReader;

import java.util.Scanner;

public class FinalTemp {

static Scanner scan = new Scanner(System.in);

static String userInput = null;

 

public static void main(String[] args) throws IOException{

while (true)

{

System.out.println("Do You Want to Continue (Y/N) ?");

userInput = scan.next();

if (userInput.equalsIgnoreCase("Y"));

BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

System.out.println("Please enter temperature in Fahrenheit : ");

double fahrenheit = Double.parseDouble(reader.readLine());

double celsius = (5.0/9.0)*(fahrenheit - 32);

System.out.println("Temperature in Celsius is : "+celsius);

if (userInput.equalsIgnoreCase("N"))

{

System.out.println("HELLO INSTRUCTOR, THIS IS THE INF231 FINAL ASSIGNMENT");

break;

}}}}

Answers

(11)
Status NEW Posted 05 May 2017 12:05 AM My Price 9.00

-----------

Not Rated(0)