Program for convert temprature and length, JAVA Programming

Assignment Help:

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;

 } 

}


Related Discussions:- Program for convert temprature and length

What is constructor chaining, What is constructor chaining and how is it ac...

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

Heap and Stack memory allocation in java, Each time an object is started in...

Each time an object is started in Java it goes into the area of memory named as heap. The primitive variables like double and int are allocated in the stack, if they are local inst

What is a framework, A framework is made up of the set of classes which per...

A framework is made up of the set of classes which permit us to use a library in a best possible way for a particular requirement.

What is a jsp and what is it used for?, Java Server Pages (JSP) is a platfo...

Java Server Pages (JSP) is a platform independent presentation layer technology that comes with SUN s J2EE platform. JSPs are normal HTML pages with Java code pieces embedded in th

Differences between AOP and OOP, Normal 0 false false false...

Normal 0 false false false EN-US X-NONE X-NONE      Obj ec t Ori e n

Area of the curve, program t ofind area under the curve y=f(x) between x=a ...

program t ofind area under the curve y=f(x) between x=a and x=b integrate y=f(x) between the limits a and b

Develop a simple polling web application , Develop a simple polling (voting...

Develop a simple polling (voting) web application according to the following specifications: 1. Initially a page should be presented to the user where he can enter his/her

Develop a cityinfo mobile application, INTRODUCTION Mobile computing is ...

INTRODUCTION Mobile computing is everywhere. Even as an increasing population of the world are now using mobile phones, and mobile phone (or smartphone) applications, there is a

Explanation of the inputstream with suitable diagrams, Problem 1) Descr...

Problem 1) Describe the concept of interfaces in Java with a suitable example for the same Explanation of the concept of interfaces with example 2) Describe the Inp

What is javaserver faces expression language, A easy expression language us...

A easy expression language used by a JavaServer Faces UI component tag attributes to bind the associated component to a bean property or to bind the associated component's value to

Write Your Message!

Captcha
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