Intended to be cloned down as an eclipse workspace, then open the projects.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

46 lines
1.1 KiB

package uwstout.courses.cs144.labs.lab2;
import java.util.Scanner;
/**
* Reads in a value (in stones) and converts it to ounces.
*
* @author Brett Bender
* @version 2022.09.20
*/
public class Stones {
private static final int STONE_POUNDS_CF = 14;
private static final int POUNDS_OUNCES_CF = 16;
private static final int STONE_OUNCES_CF = STONE_POUNDS_CF * POUNDS_OUNCES_CF;
/**
* Reads in a value (in stones) and converts it to ounces.
*
* @param args Command line arguments (not used)
*
*
* Input: 2 stones Expected: 448 ounces
*
* Input: -1 stones Expected: -224 ounces
*
* Input: 0 stones Expected: 0 ounces
*/
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("How heavy is the object in stones?");
// Read in the weight in stones
int stonesIn = scan.nextInt();
// Calculate the weight in ounces
int ouncesOut = stonesIn * STONE_OUNCES_CF;
// Output it to the user
System.out.printf("%d stones in ounces is %d ounces.\n", stonesIn, ouncesOut);
scan.close();
}
}