Skip to content

Instantly share code, notes, and snippets.

@pepet96
Created November 13, 2013 23:50
Show Gist options
  • Save pepet96/7458664 to your computer and use it in GitHub Desktop.
Save pepet96/7458664 to your computer and use it in GitHub Desktop.
OrderChecker
import java.util.Scanner;
class OrderChecker {
public static void main(String [] args) {
Scanner input = new Scanner(System.in);
int bolt, nut, wash;
double total;
System.out.println("Enter number of bolts: ");
bolt = input.nextInt();
System.out.println("Enter number of nuts: ");
nut = input.nextInt();
System.out.println("Enter number of washers: ");
wash = input.nextInt();
if (nut < bolt) {
System.out.println("Check the order, total amount will not be calculated.");
}
else {
total = (bolt * .05) + (nut * .03) + (wash * .01);
System.out.println("The order is okay, the total amount is: " + total);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment