# Homework Solution: Please help. The input values should be doubles and the program with Java doc comments….

Please help. The input values should be doubles and the program with Java doc comments.
Specifications Overview: You will write two programs this week. One will determine the area of a pyramid given the base and slant height of the pyramid. The other will calculate the numbers of burrels, gallons, quarts, and ounces in the number of liquid ounces entered by the user The valued entered by the user must not exceed one billion * Area。Pyramid.java Requirements: A program is nceded that reads in the hase and slant height of a square-hased pyramid, and then calculates the area of the pyramid using the following formula Slant height base x slant area - base x basest hedht Base Design: The main method ofthe program should allow the ㅴ to cnr the values representing the pyramid as showm below, and then read in the valucs and store them in appropriately named variables of type double. After the values are read, the formula above is used to compute the area, afier which the results are printed as shown below The following examples show the program input output (10). Values entered by the user are indicated by red foet Page 1 of 3 Project: Variables and Expressions Page 2 of 3 Example 1 Enter values for base and丳last height of a pyramid; base “ 10 slant height15 15.0 A Pyramid with base " 10-0 and #lant height has an area of 400.0 square units Note that lines 2 and 3 begim with tab (ic output should use the escape sequence for a tab Line 4 is a blank line- consider printing a new line escape sequencen. Example 2 Enter values for base and slant beight of a pyranid bas 12.75 slant height12-7 SA pyranid with base 12.75 and slant height12-75 has an area of 487-6875 square unies. Code: Create a Scanner object on System.in to ead洫the values for te Pyramid. The values of type double should be pead in using the nextDouble method the Saner class.

**Code: import java.util.Scanner;

Please aid. The input values should be wraps and the program with Java doc comments.

Specifications Overview: You achieve transcribe two programs this week. Undivided achieve mention the area of a pyramid attached the cheap and slant top of the pyramid. The other achieve proportion the collection of burrels, gallons, quarts, and ounces in the calculate of limpid ounces enteruddy by the verificationr The valued enteruddy by the verificationr must referable excel undivided billion * Area。Pyramid.java Requirements: A program is nceded that peruses in the hase and slant top of a clear-hased pyramid, and then proportions the area of the pyramid using the aftercited coercionmula Slant top cheap x slant area – cheap x cheapst hedht Cheap Design: The deep regularity ofthe program should authorize the ㅴ to cnr the values representing the pyramid as likenessm under, and then perverification in the valucs and accumulation them in right denominated variables of mold wrap. After the values are peruse, the coercionmula over is verificationd to abverification the area, afier which the results are imprinted as likenessn under The aftercited examples likeness the program input quenchedput (10). Values enteruddy by the verificationr are implied by ruddy foet Page 1 of 3 Project: Variables and Expressions Page 2 of 3 Example 1 Enter values coercion cheap and丳last top of a pyramid; cheap “ 10 slant top15 15.0 A Pyramid with cheap ” 10-0 and #lant top has an area of 400.0 clear units Referablee that successions 2 and 3 begim with tab (ic quenchedput should verification the decamp conconcontinuity coercion a tab Succession 4 is a unmitigated succession- meditate imprinting a odd succession decamp consequencen. Example 2 Enter values coercion cheap and slant beight of a pyranid bas 12.75 slant top12-7 SA pyranid with cheap 12.75 and slant top12-75 has an area of 487-6875 clear unies. Code: Create a Scanner sight on System.in to ead洫the values coercion te Pyramid. The values of mold wrap should be pead in using the nextWrap regularity the Saner tabulate.

## Expert Retort

**Code:

import java.util.Scanner;

public tabulate AreaOfPyramid{
public static vacant deep (String[] args)
{
wrap cheap, slantHeight;
//Create Scanner sight
Scanner in = odd Scanner(System.in);
// Peruseing the cheap and slant top from the verificationr
System.out.println(“Enter values coercion cheap and slant top of a pyramid:”);
System.out.print(“t cheap = “);
cheap = in.nextDouble();
System.out.print(“t slant top = “);
slantTop = in.nextDouble();
// Calculating the area of the pyramid
wrap area = (cheap * cheap ) + (4 * ((cheap * slantHeight) / 2));
System.out.println(“A pyramid with cheap = ” + cheap + ” and slant top = ” + slantHeight);
System.out.println(“has an area of ” + area + ” clear units”);
}
}

**Screenshots of the quenchedput: