1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
ludmilkaskok [199]
3 years ago
13

Given a class called Measure that has the methods and data as specified, choose the correct code to satisfy the requirements of

the class.
public class Measure implements Comparable

{

//Instance variables yards, feet, inches;

//Constructors (default and overloaded)

//Accessors for yards, feet, and inches

//Mutators for yards, feet, and inches


//totalInches returns an int of the total inches for the current object

//toString returns a string in the form: 6 yards, 2 feet, and 5 inches

//Adding 2 measure objects (current object and one passed in as a parameter)

//addMeasure returns a measure object that is the sum of two measure objects,

// the current object and one that is passed in as a parameter

}

Which of the following would be the correct implementation for the method totalInches that returns an int of the total inches for the current object in the measured class? (36 inches = 1 yard)

A. return 36 * feet + 12 * yards + inches;
B. System.out.println(36 * yards + 12 * feet + inches);
C. int total = 36 * yards + 12 * feet + inches;
return total;
D. none of these
Computers and Technology
1 answer:
Nina [5.8K]3 years ago
7 0

Answer:

D

Explanation:

You might be interested in
A datagram network allows routers to drop packets whenever they need to. The probability of a router discarding a packetis p. Co
tresset_1 [31]

Answer:

a.) k² - 3k + 3

b.) 1/(1 - k)²

c.) k^{2}  - 3k + 3 * \frac{1}{(1 - k)^{2} }\\\\= \frac{k^{2} - 3k + 3 }{(1-k)^{2} }

Explanation:

a.) A packet can make 1,2 or 3 hops

probability of 1 hop = k  ...(1)

probability of 2 hops = k(1-k)  ...(2)

probability of 3 hops = (1-k)²...(3)

Average number of probabilities = (1 x prob. of 1 hop) + (2 x prob. of 2 hops) + (3 x prob. of 3 hops)

                                                       = (1 × k) + (2 × k × (1 - k)) + (3 × (1-k)²)

                                                       = k + 2k - 2k² + 3(1 + k² - 2k)

∴mean number of hops                = k² - 3k + 3

b.) from (a) above, the mean number of hops when transmitting a packet is k² - 3k + 3

if k = 0 then number of hops is 3

if k = 1 then number of hops is (1 - 3 + 3) = 1

multiple transmissions can be needed if K is between 0 and 1

The probability of successful transmissions through the entire path is (1 - k)²

for one transmission, the probility of success is (1 - k)²

for two transmissions, the probility of success is 2(1 - k)²(1 - (1-k)²)

for three transmissions, the probility of success is 3(1 - k)²(1 - (1-k)²)² and so on

∴ for transmitting a single packet, it makes:

     ∞                             n-1

T = ∑ n(1 - k)²(1 - (1 - k)²)

    n-1

   = 1/(1 - k)²

c.) Mean number of required packet = ( mean number of hops when transmitting a packet × mean number of transmissions by a packet)

from (a) above, mean number of hops when transmitting a packet =  k² - 3k + 3

from (b) above, mean number of transmissions by a packet = 1/(1 - k)²

substituting: mean number of required packet =  k^{2}  - 3k + 3 * \frac{1}{(1 - k)^{2} }\\\\= \frac{k^{2} - 3k + 3 }{(1-k)^{2} }

6 0
3 years ago
Write a program that prints the question " Do youwant to continue? " and reads a user input. if the userinput is " Y ", " OK", o
Nataly_w [17]

Answer:

#include <bits/stdc++.h>

using namespace std;

int main() {

   string in;//string in for taking input...

   cout<<"Do you want to continue ?"<<endl;

   getline(cin,in);//taking input from the user...

   if(in=="y"||in=="Y"||in=="yes"||in=="OK"||in=="Why not?")//conditions..

   cout<<"OK"<<endl;

   else if(in=="No")

   cout<<"terminating"<<endl;

   else

   cout<<"Bad input"<<endl;

return 0;

}

Explanation:

I have taken a string in.

Then taking input from user.

Checking the conditions using if else if ladder.

7 0
3 years ago
What security principle does a firewall implement with traffic when it does not have a rule that explicitly defines an action fo
NemiM [27]

Answer:

Implicit deny

Explanation:

A firewall is a network security protocol that monitors and controls inbound and outbound traffic based on set aside security rules.

When a firewall encounters a traffic it does not have a rule that explicitly defines an action for that communication, it implicit deny.

7 0
3 years ago
A simple algorithm for handling requests works like this:________ a) all requests users make are stored. b) The elevator priorit
bezimeni [28]

Answer:

b) The elevator prioritizes the requests that are on the way where it’s going, but also based on a first come first served principle.

Explanation:

Elevator routing often looks complex, as the elevator has to decide whether to go to the person who has waited the longest or the one who is closest? There are also issues of how long should the rider spend.

A simple algorithm can be designed where the elevator prioritizes the requests that are on the way where it’s going, but also based on a first come first served principle. Once it exhausts the request in its current direction, it then switches directions if there are requests in that direction. This way the elevator is able to tackle the complex issue based on the simple algorithm.

8 0
3 years ago
Read 2 more answers
Describe the three essential characteristics of an object fromthe perspective of object oriented paradigm.
erastovalidia [21]

Answer:

Explained

Explanation:

The three characteristics of an object

Encapsulation: It is the process of capturing data and securing it for safety from the outside interfaces. Binding data and operations of data into a single unit.

Inheritance: This is the process by which a class can be derived from the base class, with all features of base class and some of its own. This increases data reusability.

Abstraction: The ability to represent data at very basic level without showing the details of it is called abstraction.

3 0
3 years ago
Other questions:
  • These are questions from my Computer/Customer Support Class
    6·1 answer
  • Technological uncertainty:
    15·1 answer
  • Which of the following would be considered a primary source of information?
    6·1 answer
  • You're programming an infinite loop. What must you include in your code to prevent crashes?
    15·2 answers
  • A customer wants to purchase a new home computer. The machine will mainly be used for internal browsing and streaming video, exc
    7·1 answer
  • Given the code that reads a list of integers, complete the number_guess() function, which should choose a random number between
    6·1 answer
  • Give the algorithm and flowchart for following C code:
    6·1 answer
  • To add or remove space before or after a paragraph, users should select.
    9·2 answers
  • In a linked chain implementation of a queue, the performance of the enqueue operation
    10·1 answer
  • What do developers do to support software products?
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!