{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Conversion - /Step 1 feet = console.nextInt/Step 2...

Info icon This preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
//******************************************************* // Author: D. S. Malik // // Program Convert: This program converts measurements // in feet and inches into centimeters using the formula // that 1 inch is equal to 2.54 centimeters. //******************************************************* / import java.util.*; i public class Conversion { static Scanner console = new Scanner(System.in); static final double CENTIMETERS_PER_INCH = 2.54; static final int INCHES_PER_FOOT = 12; public static void main (String[] args) { //declare variables int feet; int inches; int totalInches; double centimeters; System.out.print("Enter feet: ");
Image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: //Step 1 feet = console.nextInt(); //Step 2 System.out.println(); System.out.print("Enter inches: "); //Step 3 inches = console.nextInt(); //Step 4 System.out.println(); System.out.println("The numbers you entered are " + feet + " for feet and " + inches + " for inches."); //Step 5 totalInches = INCHES_PER_FOOT * feet + inches; //Step 6 System.out.println(); System.out.println("The total number of inches = " + totalInches); //Step 7 centimeters = totalInches * CENTIMETERS_PER_INCH; //Step 8 System.out.println("The number of centimeters = " + centimeters); //Step 9 } }...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern