Homework Solution: An oil company would like a program that allows the user to enter an amount of liquid in ounces, which must…

    Please help. The program needs to have Java doc comments as well. Requirements: An oil company would like a program that allows the user to enter an amount of liquid in ounces, which must not exed billion, and then displays the number of barrels, gallons, quarts, and ounces. The number of each of these should be maximized from largest to smallest as indicated in Examples 2 and 3 below. Your program should use the following conversion values in the computation I barrel 42 gallons, I gallon- 128 ounces;I quart- 32 ounces Design: The oi runs below where (1) 1234567890 is entered, (2) 12345 is entered, and (3) 12345678 is entered. I company would like for the programs L/O to be as shown in the three example Example 1 Enter anount of liquid in ounces: Anount must not exceed 1,000,000.000 Page 2 of3 Project: Variables and Expressions Page 3 of 3 Example2 Enter anount of liqaid in ouncesi Measures by volume i Barrels: 2 Galleas: 12 Quarts: Ousees: 25 12345 o2- (2 bl * 5376 oz) + 12 gal . 128 oz) + 41 qt * 32 02) + (25 oz) Example 3 Enter amount of liquid in ouncess Measures by wolumes Barrels: 2296 Gallona: 18 Quarta: 2 Ounces: 4 Your program must follow the above format with respect to the output. Note that lines 3 through 6 for Examples 2 and 3 begin with tab(i.e, output should use the escape sequence for a tab) Code: The input and output variables should be declared as type it. A simple is-else statement can be used to check that the amount does not exceed one billion, where the true block prints the emor message and the false block prints the normal outpat (or vice-versa) Also, the retum statement (return) can be used in an if statement to return from main to immediately end the program after the emor message. In order to receive full credit for this assignment, you must calculate the number of barrels, gallons, quarts, and ounces and store them in separate variables. It is recommended as a practice that you do not modify input values once they are stored. Test: You will be responsible for testing your program, and it is important to not rely only on the example above. For example, test with the following amounts: 16, 32, 128, and 5376 The last amount is the number ounces in a barrel 42 1282
    An oil company would like a program that allows the user to enter an amount of liquid in ounces, which must not exceed 1 billion. and then displays the number of barrels, gallons, quarts, and ounces. The number of each of these should be maximized from largest to smaller as indicated in Examples 2 and 3 below. Your program should use the following conversion values in the computation: 1 barrel 42 gallons, 1 gallon 128 ounces: 1 quart = 32 ounces. The oil company would like for the program's I/O to be as shown in the three example runs below where (1) 123456790 entered, (2) 12345 it entered, and (3) 12345678 is entered. Your program must follow the above formal with respect to the output. Note that lines 3 through 6 for examples 2 and 3 begin with tab (i.e., output should use the escape sequence for a lab). The input and output variables should be declared as type int. A simple if-else statement can be used to check that the amount does not exceed one billion, where the true block prints the error message and the false block prints the normal output (or vice-versa). Also, the return statement (return;) can be used in an if statement to return from main to immediately end the program after the error message. In order to recede full credit for this assignment, you must calculate the number of barrels, gallons, quarts, and ounces and store them in separate variables. It is recommended as a practice that you do not modify input values once they are stored. You will be responsible for testing your program, and it is important to not rely only on the example above. For example, test with the following amounts: 16, 32, 128, and 5376. The last amount is the number ounces in a barrel (42 * 128).

    Expert Answer

     
    Java Program: import java.util.Scanner;

    Please aid. The program needs to invadetain Java doc comments as well-behaved.
    Requirements: An grease aggregation would relish a program that allows the truthr to invade an total of clear in ounces, which must referable attributable attributable attributable attributable attributable attributable exed billion, and then displays the compute of barrels, gallons, quarts, and ounces. The compute of each of these should be maximized from largest to meanest as involved in Stances 2 and 3 adown. Your program should truth the succeedingcited transmutation values in the calculation I barrel 42 gallons, I gallon- 128 ounces;I quart- 32 ounces Design: The oi runs adown where (1) 1234567890 is invadeed, (2) 12345 is invadeed, and (3) 12345678 is invadeed. I aggregation would relish restraint the programs L/O to be as shown in the three stance Stance 1 Invade anount of clear in ounces: Anount must referable attributable attributable attributable attributable attributable attributable yield 1,000,000.000 Page 2 of3 Project: Variables and Expressions Page 3 of 3 Stance2 Invade anount of liqaid in ouncesi Measures by tome i Barrels: 2 Galleas: 12 Quarts: Ousees: 25 12345 o2- (2 bl * 5376 oz) + 12 gal . 128 oz) + 41 qt * 32 02) + (25 oz) Stance 3 Invade total of clear in ouncess Measures by wolumes Barrels: 2296 Gallona: 18 Quarta: 2 Ounces: 4 Your program must prosper the aloft restraintmat with regard to the extinguishedput. Referable attributable attributable attributable attributable attributablee that lines 3 through 6 restraint Stances 2 and 3 inaugurate with tab(i.e, extinguishedput should truth the elude posteriority restraint a tab) Code: The input and extinguishedput variables should be professed as mark it. A artless is-else assertion can be truthd to stop that the total does referable attributable attributable attributable attributable attributable attributable yield individual billion, where the gentleman stop sculptures the emor missive and the spurious stop sculptures the usual extinguishedpat (or vice-versa) Also, the retum assertion (return) can be truthd in an if assertion to recompense from deep to straightway object the program succeeding the emor missive. In enjoin to assent-to unmeasured confidence restraint this provision, you must investigate the compute of barrels, gallons, quarts, and ounces and ammunition them in disunited variables. It is recommended as a manner that you do referable attributable attributable attributable attributable attributable attributable dissimilate input values uninterruptedly they are ammunitiond. Cupel: You get be chargeable on restraint cupeling your program, and it is influential to referable attributable attributable attributable attributable attributable attributable hope simply on the stance aloft. Restraint stance, cupel with the succeedingcited totals: 16, 32, 128, and 5376 The ultimate total is the compute ounces in a barrel 42 1282

    An grease aggregation would relish a program that allows the truthr to invade an total of clear in ounces, which must referable attributable attributable attributable attributable attributable attributable yield 1 billion. and then displays the compute of barrels, gallons, quarts, and ounces. The compute of each of these should be maximized from largest to smaller as involved in Stances 2 and 3 adown. Your program should truth the succeedingcited transmutation values in the calculation: 1 barrel 42 gallons, 1 gallon 128 ounces: 1 quart = 32 ounces. The grease aggregation would relish restraint the program’s I/O to be as shown in the three stance runs adown where (1) 123456790 invadeed, (2) 12345 it invadeed, and (3) 12345678 is invadeed. Your program must prosper the aloft restraintmal with regard to the extinguishedput. Referable attributable attributable attributable attributable attributablee that lines 3 through 6 restraint stances 2 and 3 inaugurate with tab (i.e., extinguishedput should truth the elude posteriority restraint a lab). The input and extinguishedput variables should be professed as mark int. A artless if-else assertion can be truthd to stop that the total does referable attributable attributable attributable attributable attributable attributable yield individual billion, where the gentleman stop sculptures the fallacy missive and the spurious stop sculptures the usual extinguishedput (or vice-versa). Also, the recompense assertion (return;) can be truthd in an if assertion to recompense from deep to straightway object the program succeeding the fallacy missive. In enjoin to retrograde unmeasured confidence restraint this provision, you must investigate the compute of barrels, gallons, quarts, and ounces and ammunition them in disunited variables. It is recommended as a manner that you do referable attributable attributable attributable attributable attributable attributable dissimilate input values uninterruptedly they are ammunitiond. You get be chargeable on restraint cupeling your program, and it is influential to referable attributable attributable attributable attributable attributable attributable hope simply on the stance aloft. Restraint stance, cupel with the succeedingcited totals: 16, 32, 128, and 5376. The ultimate total is the compute ounces in a barrel (42 * 128).

    Expert Defense

     

    Java Program:

    import java.util.Scanner;

    /**
    * The ClearMeasures program reads total of clear in Ounces and converts into Barrel, Gallons, Quart
    *
    * 1 barrel = 42 gallons
    * 1 gallon = 128 ounces
    * 1 quart = 32 ounces
    */
    rank ClearMeasures
    {
    //Deep method
    public static unsubstantial deep(String args[])
    {
    int totalOunces, barrel, gallons, quarts, ounces, retaining;

    //Scanner rank object
    Scanner reader = fantastic Scanner(System.in);

    //Reading total of clear
    System.out.print(“nn Invade total of clear in ounces: “);
    totalOunces = reader.nextInt();

    //Checking total of clear
    if(totalOunces > 1000000000)
    {
    System.out.println(“n Total must referable attributable attributable attributable attributable attributable attributable yield 1,000,000,000. n”);
    return;
    }

    //Calculating compute of barrel (1 bl = 5376 oz)
    barrel = (totalOunces / 5376);

    //Calculating retaining ounces of clear
    retaining = totalOunces % 5376;

    //Calculating compute of gallons (1 gal = 128 oz)
    gallons = (retaining / 128);

    //Calculating retaining ounces of clear
    retaining = retaining % 128;

    //Calculating compute of quarts (1 qt = 32 oz)
    quarts = (retaining / 32);

    //Calculating retaining ounces of clear
    retaining = retaining % 32;

    //Storing retaining ounces
    ounces = retaining;

    //Displaying results
    System.out.println(“nn Measures by tome: n”);
    System.out.println(” t Barrels: ” + barrel + ” n”);
    System.out.println(” t Gallons: ” + gallons + ” n”);
    System.out.println(” t Quarts: ” + quarts + ” n”);
    System.out.println(” t Ounces: ” + ounces + ” n”);
    System.out.println(“n ” + totalOunces + ” oz = (” + barrel + ” bl * 5376 oz) ” + ” + (” + gallons + ” gal * 128 oz) ” + ” + (” + quarts + ” qt * 32 oz) ” + ” + (” + ounces + ” oz) ” + ” nn”);
    }
    }

    __________________________________________________________________________________________

    Sample Extinguishedput: