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
Mariulka [41]
4 years ago
3

Struct and Direct Field Indexing Write a function called ConvertToDecadesAndYears to convert totalYears to decades and years. Th

e decades and years should be returned using a struct that has two fields, decades for the number of decades, and years for the number of years.

Computers and Technology
1 answer:
den301095 [7]4 years ago
3 0

Answer:

Please refer to the attached image for the solution code.

Explanation:

To return a struct data type from a function, we need to define the struct data in advance (Line 1 - 4). As required by the question, the <em>struct </em>duration consists of two members, <em>decade</em> & <em>year</em>.

Next we can proceed to define the function <em>ConvertToDecadesAndYears() </em>that take one input parameter, <em>totalYear </em>(Line 6). Please note the function is also defined with a return data type,<em> struct duration.</em>

<em />

Next, we calculate the year, <em>y,</em>  by calculating modulus (remainder) of <em>totalYear </em>when divide it by 10 (Line 9) and calculate the decade, <em>d</em>,  by using floor function to round down the division result of<em> totalYear </em>by 10.

We can then assign the y & d to the member of the struct data, d1, (Line 12 & 13) and return it as output (Line 15).

You might be interested in
What expressions will initialize d with a random value such that all possible values for d are given by the inequality 1.5 ≤ d &
Kaylis [27]

Answer:

The solution code is written in Python

d = 1.5 + random.random() * 6

Explanation:

By presuming the Python random module is imported, we can use the <em>random</em> method to generate a random number.  <em>random.random()</em> will give us a value in the range [0, 1). The ensure the lower limit is 1.5 instead of 0, we can add 1.5 to random.random()

  •      1.5 + random.random()

This expression will give any value in range [1.5, 2.5)

To ensure the upper limit is set to 7.5, we tweak the previous expression to

  • 1.5 + random.random() * 6  

This expression will always multiply a random number from [0,1) with 6 and then only added with 1.5. This will always produce a random number that fulfill the inequality 1.5 ≤ d < 7.5

7 0
3 years ago
Give a common business example that mimics the differences between a shared
Serhud [2]

An  business example that mimics the differences between a shared network segment and a dedicated network segment is that of connection of work station transmission.

<h3>What is Shared segment network?</h3>

In this type of network,  local area network or an aspect of the local area network is said to have a lot of workstations and the multiple workstations are linked by using a hub

Note that all the workstation do not need to share the network capacity with other workstations but  an  business example that mimics the differences between a shared network segment and a dedicated network segment is that of connection of work station transmission.

Learn more about network segment from

brainly.com/question/7181203

#SPJ1

6 0
2 years ago
A proxy is
salantis [7]

Answer:

C. an authorization of a registered stockholder to another person to act in their place at the meeting

Explanation:

  • The proxy server acts as a gateway between you and the Internet.
  • it is a Intermediate Server separates users from browsing websites
  • Therefore, the proxy here refers to allowing someone to act on their behalf. In the case of the company, the proxy allows another person to act on behalf of the registered stockholder at company meetings.
4 0
3 years ago
Groupthink refers toA) the willingness of individual group members to withhold contrary or unpopular opinions, even when those o
Ivan

Answer:

The correct answer is A.

Explanation:

Groupthink is a theory that is applied to decision making psychology in groups, developed by Irving Janis. The theory roots itself to the problem of conformity especially in group settings. When a decision is made in a group, some members, even though they believe that the decision made is wrong or can be better, get caught up in the conformity problem and follow the accepted solution to allign with the group's decision.

I hope this answer helps.

5 0
3 years ago
Write the function prototype for a function called showSquare. The function should have a single parameter variable of the int d
xeze [42]

Answer:

void showSquare(int param){

}

Explanation:

In C++ programing language, this is how a function prototype is defined.

The function's return type (In this case Void)

The function's name (showSquare in this case)

The function's argument list (A single integer parameter in this case)

In the open and closing braces following we can define the function's before for example we may want the function to display the square of the integer parameter; then a complete program to accomplish this in C++ will go like this:

<em>#include <iostream></em>

<em>using namespace std;</em>

<em>void showSquare(int param);</em>

<em>int main()</em>

<em>{</em>

<em>    showSquare(5);</em>

<em>    return 0;</em>

<em>}</em>

<em>void showSquare(int param){</em>

<em>int square = param*param;</em>

<em>cout<<"The Square of the number is:"<<endl;</em>

<em>cout<<square;</em>

<em>}</em>

8 0
4 years ago
Other questions:
  • Bill needs to make a presentation in which he has to represent data in the form of a pyramid. Which feature or menu option of a
    14·1 answer
  • Write a program that reads a file containing text. Read each line and send it to the output file, preceded by line numbers. If t
    8·1 answer
  • On dynamic disks, the term partition is not used to define the space where a file system is installed. what term is used?
    6·1 answer
  • Write a program that lets the user play the game of Rock, Paper, Scissors against the computer. The program should work as follo
    13·1 answer
  • A developer has made a change to an Automation Anywhere TaskBot using the Enterprise Client interface. When running the bot from
    10·1 answer
  • Question 4 of 5
    5·2 answers
  • As related to the use of computers, ____ is defined as gaining unauthorized access or obtaining confidential information by taki
    10·1 answer
  • Fill in the blanks
    7·1 answer
  • What are two advantages of a pay-for-use online conferencing service compared to a free service? (Choose two)
    5·1 answer
  • A company is looking for an employee to help organize customer information for the sales team. Which computer field includes thi
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!