Question
Write a program to help carpenters. Sometimes measurements are given in terms of yards, feet, and inches. Your program will convert these three numbers into
Write a program to help carpenters. Sometimes measurements are given in terms of yards, feet, and
inches. Your program will convert these three numbers into a total number of inches. When running, it
will prompt the user first for the number of yards, then the number of feet, and finally the number of
inches. Assume all numbers are whole (integers). Your program must compute the total number of inches
by converting each of the three inputs into inches and summing them all together. Finally, print out the
total length in inches. Recall that 1 yard = 3 feet, and 1 foot = 12 inches.
The following represents a sample run of the program in which the user inputs 1 for the number of yards,
2 for the number of feet, and 3 for the number of inches (yielding a correct output of 63 total inches). Note
that the JUnit tests, and grading, will be very picky about exact spacing, spelling, and capitalization.
Enter number of yards: 1
Enter number of feet: 2
Enter number of inches: 3
Total number of inches: 63
Problem b (PA2b.java)
Write a program to do the reverse of Problem a. It prompts the user for a length in inches, then converts
that total number of inches into yards, feet, and inches. Note that you do not convert the number of inches
separately into yards, then feet, then inches. Instead the program must calculate how many yards there
are in the given number of inches, then convert the remaining inches into feet, and finally have the left
over inches directly. For example, if the user enters 50 for the total number of inches, your program
should compute the result that is equal to 1 yard, 1 foot, and 2 inches. The following represents a run of
the program using this sample input (again, pay very careful attention to spacing, spelling, and
capitalization).
Enter number of inches: 50
Yards: 1
Feet: 1
Inches: 2
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started