import java.util.*;
public class DiscountBolts
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
double bolts, nuts, washers;
double total;
System.out.println("Enter number of bolts: ");
bolts = keyboard.nextDouble();
System.out.println("Enter number of nuts: ");
nuts = keyboard.nextDouble();
System.out.println("Enter number of washers: ");
washers = keyboard.nextDouble();
total = (bolts * 0.05) + (nuts * 0.03) + (washers * 0.01);
if (bolts > nuts)
{
System.out.println("Check the order: too few nuts");
}
if (bolts >= washers)
{
System.out.println("Check the order: too few washers");
}
{
if (nuts > bolts && washers*2 > bolts)
{
System.out.println("Order is CORRECT");
System.out.printf("Order total is: $%.2f \n ", total);
}
{
}
}
}
}
A correct order must have at least as many nuts as bolts, and at least twice as many washers as bolts, otherwise the order has an error.
How would i do my if statement so it will read that it has twice as many washers??