Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package edu.wit.cs.comp1000;
- import java.util.Scanner;
- // @author: Jim Garrison
- public class PA1b {
- // TODO: Converts inches provided into yards, feet, and remaining inches, respectively.
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- System.out.print("Enter number of inches: ");
- int inputInches = input.nextInt();
- int yard = 36;
- int feet = 12;
- int finalYards;
- int finalFeet;
- int remainingInches;
- finalYards = inputInches / yard;
- inputInches = inputInches - (36 * finalYards);
- finalFeet = inputInches / feet;
- inputInches = inputInches - (12 * finalFeet);
- remainingInches = inputInches;
- System.out.printf("Yards: %d%n", finalYards);
- System.out.printf("Feet: %d%n", finalFeet);
- System.out.printf("Inches: %d%n", remainingInches);
- input.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement