Program for convert temprature and length, JAVA Programming

Public class ConversionProgram {

 public void start() { 

  String userChoice = askConversionCategory();

  while (userChoice.equals("1") || userChoice.equals("2") || Page 2 of 12

    userChoice.equals("3") || userChoice.equals("4") || 

    userChoice.equals("5") || userChoice.equals("6")) { 

   processConversionRequest(userChoice);

   userChoice = askConversionCategory();

  }

  System.out.println("Good Bye!");

 }

 private String askConversionCategory() {

  System.out.println();

  String prompt = "Select a conversion category, enter \n" +

       "\t\"1\" to convert Length, \n" +

       "\t\"2\" to convert Temperature, \n" +

       "\t\"3\" to convert Initials, \n" +

       "\t\"4\" to convert Date, \n" +

       "\t\"5\" to convert Time, \n" +

       "\t\"6\" to convert Pig Latin, and\n" +

       "\tany other key to quit: ";

  String category = acquireInput(prompt);

  return category; 

 }

 

 private void processConversionRequest(String userChoice) {

  if (userChoice.equals("1")) {

   convertLength();

  } else if (userChoice.equals("2")) {

   convertTemperature();

  } else if (userChoice.equals("3")) {

   convertInitials();

  } else if (userChoice.equals("4")) {

   convertDate();

  } else if (userChoice.equals("5")) {

   convertTime();

  } else if (userChoice.equals("6")) {

   convertPigLatin();

  }

 }

 private void convertLength(){

 }

 private void convertTemperature(){

 }

 private void convertInitials(){

 }

 private void convertDate(){

 }

 private void convertTime(){

 }

 private void convertPigLatin(){

 }

 private String acquireInput(String prompt){

  System.out.print(prompt);

  String input = Keyboard.readInput().trim();

  return input;

 } 

}

Posted Date: 2/22/2013 4:38:14 AM | Location : United States







Related Discussions:- Program for convert temprature and length, Assignment Help, Ask Question on Program for convert temprature and length, Get Answer, Expert's Help, Program for convert temprature and length Discussions

Write discussion on Program for convert temprature and length
Your posts are moderated
Related Questions
Public class ConversionProgram {  public void start() {    String userChoice = askConversionCategory();   while (userChoice.equals("1") || userChoice.equals("2") || Page 2

i m confused what to take as a project for final year in information tech cn u suggest some of the topic of software

Java program need to compile Project Description: i have one program required to compile to run it . Skills required: Java

What is constructor chaining and how is it achieved in Java? A child object constructor always first requires to construct its parent (which in turn calls its parent constructo

Write responsibilities of the followings 1. Developer a) Module level design. b) Coding c) Unit testing 2. Executive Team a) Responsible for the day to day operations. b) A

Write a program to add of doubles in java? Doubles are treated much the similar way, but now you obtain to use decimal points in the numbers. This is a same program which does

State in brief about the java Java is a object-oriented, simple, distributed, robust, interpreted, architecture-neutral, secure, portable, multi-threaded, high- performance and

1-4 Problem Set: Arithmetic Consider the following statement when responding to questions 1 and 2: Jim develops 5 Java applications a year. Joe develops 10 Java applications a year

Modify both of the above clients (to write separate clients) to extract the exchange rate from a live web service that performs currency conversion. You can choose a Java or a .NET

String concatenation and comparison public class StringTest { public static void main(String[] args) { int i = 4; int j = 5; System.out.println ("Hello" + i); // wi