Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java A. Assign to maxSum the max of (numA, numB) PLUS the max of (numY, numZ). Use just one statement. Hint: Call findMax() twice in

Java

A. Assign to maxSum the max of (numA, numB) PLUS the max of (numY, numZ). Use just one statement. Hint: Call findMax() twice in an expression.

import java.util.Scanner;

public class SumOfMax { public double findMax(double num1, double num2) { double maxVal;

// Note: if-else statements need not be understood to // complete this activity if (num1 > num2) { // if num1 is greater than num2, maxVal = num1; // then num1 is the maxVal. } else { // Otherwise, maxVal = num2; // num2 is the maxVal. } return maxVal; }

public static void main(String [] args) { double numA = 5.0; double numB = 10.0; double numY = 3.0; double numZ = 7.0; double maxSum = 0.0;

// Use object maxFinder to call the method SumOfMax maxFinder = new SumOfMax();

/* Your solution goes here */

System.out.print("maxSum is: " + maxSum); } }

B. Define a method pyramidVolume with double parameters baseLength, baseWidth, and pyramidHeight, that returns as a double the volume of a pyramid with a rectangular base. Relevant geometry equations: Volume = base area x height x 1/3 Base area = base length x base width. (Watch out for integer division).

import java.util.Scanner;

public class CalcPyramidVolume {

/* Your solution goes here */

public static void main (String [] args) { CalcPyramidVolume volumeCalculator = new CalcPyramidVolume(); System.out.println("Volume for 1.0, 1.0, 1.0 is: " + volumeCalculator.pyramidVolume(1.0, 1.0, 1.0)); } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke

4th Edition

0136086535, 9780136086536

More Books

Students also viewed these Databases questions

Question

Provide examples of Dimensional Tables.

Answered: 1 week ago