EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
8th Edition
ISBN: 9781305480537
Author: FARRELL
Publisher: CENGAGE LEARNING - CONSIGNMENT
Question
Book Icon
Chapter 3, Problem 7PE
Program Plan Intro

Metric Conversion

Program Plan:

Define the class “MetricConversion”.

  • Define the main method.
    • Declare the required variables.
    • Get the values from the user using the scanner class.
    • Call the method “convertToCentimeters()”.
    • Call the method “convertToLiters()”.
  • Definition of method “convertToCentimeters()”.
    • Declare the variable “cm”.
    • Assign “2.54” to “CENT_FACTOR”.
    • Calculate and print the values in centimeters.
  • Definition of method “convertToLiters ()”.
    • Declare the variable “liters”.
    • Assign “3.784” to “GALLON_FACTOR”.
    • Calculate and print the values in liters.

Blurred answer
Students have asked these similar questions
Using R language
using r language
using r language
Knowledge Booster
Background pattern image
Recommended textbooks for you
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,