Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Do these three problems on the practice website...... use edition 4 problems. BJP4 Self-Check 3.6: parameterMysteryNumbers. (5 points) BJP4 Self-Check 3.24: promptMultiplyBy2. (5 points) BJP4


Do these three problems on the practice website...... use edition 4 problems.

BJP4 Self-Check 3.6: parameterMysteryNumbers. (5 points)

BJP4 Self-Check 3.24: promptMultiplyBy2. (5 points)

BJP4 Exercise 3.16: triangleArea. (10 points)


Question 1 - Please provide the answer

BJP4 Self-Check 3.6: parameterMysteryNumbers

Language/Type:Javamethod basicsparameter mysteryStringsvariables

Author:Marty Stepp (on 2016/09/08)

Given the following program:

publicclassMysteryNumbers {

publicstaticvoid main(String[] args) {

String one="two";

String two="three";

String three="1";

int number=20;


sentence(one, two,3);

sentence(two, three,14);

sentence(three, three, number+1);

sentence(three, two,1);

sentence("eight", three, number/2);

}


publicstaticvoid sentence(String three,String one,int number) {

System.out.println(one+" times "+ three+" = "+ (number*2));

}

}

Write the output of each of the following calls.

Top of Form

Sound F/X

sentence(one, two, 3);
sentence(two, three, 14);
sentence(three, three, number + 1);
sentence(three, two, 1);
sentence("eight", three, number / 2);


Bottom of Form

Question 2 - Please provide the answer

BJP4 Self-Check 3.24: promptMultiplyBy2

Language/Type:JavainputScanner

Author:Roy McElmurry (on 2016/09/08)

Write code to read an integer from the user, then print that number multiplied by 2. You may assume that the user types a valid integer. A sample run of the code would produce the following:

Type an integer:4

4 times 2 = 8

Top of Form

Type your solution here:

1


2


3


4


5Bottom of Form



Question 3 - Please provide the answer

BJP4 Exercise 3.16: triangleArea

Language/Type:JavaMathmethod basicsparametersreturn

Author:Marty Stepp (on 2016/09/08)

Write a method calledtriangleAreathat accepts the three side lengths of a triangle (all real numbers) as parameters and returns the area of a triangle with those side lengths. For example, the calltriangleArea(8, 5.2, 7.1)should return18.151176098258745. To compute the area, use Heron's formula, which states that the area of a triangle whose three sides have lengthsa,b, andc, is the following. The formula is based on the computed values, a length equal to half the perimeter of the triangle:

area = (s (s-a)(s-b)(s-c)) where s = (a + b + c) / 2

Top of Form

Type your solution here:

1


2


3


Step by Step Solution

There are 3 Steps involved in it

Step: 1

Question 1 BJP4 SelfCheck 36 parameterMysteryNumbers Output three times two 6 Because three is now 1 due to String passbyreference three times three 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

Elements Of Chemical Reaction Engineering

Authors: H. Fogler

6th Edition

013548622X, 978-0135486221

More Books

Students also viewed these Programming questions

Question

Does the person have her/his vita posted?

Answered: 1 week ago

Question

Bonus shares can be issued out of revenue reserves. True/False?

Answered: 1 week ago