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
amm1812
3 years ago
5

When should you use a union type component in a structured variable?

Computers and Technology
1 answer:
Eduardwww [97]3 years ago
7 0

Answer:

The answers to 1st question and part 2A is given. However, the 2B is not given complete and thus cannot be answered.

Explanation:

UNION is a keyword used in C Language to have a commonly shared memory that can be used by multiple elements. It is a data-type that allows different data types to use the same shared memory location.

Importance: If you want to minimize the use of memory by sharing it between different datatype variables, then use UNION. For Ex. Let's suppose I want to use 2 variables a and b of type char and int respectively. Now, suppose int takes memory space of 2 bytes and char takes 1 byte then the total amount of memory needed = 2 + 1 = 3 Bytes. But, we want to first make use of a, and once done, we want to declare variable b. We can limit the memory use by declaring a memory space of 2 bytes (max of a and b). First, we can use this space to store the int variable and when done with it, we can use it to store the char variable.

PART 2A

typedef struct{

  int partNum;

  char partName[25];

} partin;

#define Partin partin

You might be interested in
Banking Account
satela [25.4K]

Answer:

Here is the Python script solution.

Explanation:

#!/usr/bin/python

"""Types of bank accounts"""

# Assignment:

# Bank Account Manager - Create a class called Account which will be an abstract

# class for three other classes called CheckingAccount, SavingsAccount and

# BusinessAccount. Manage credits and debits from these accounts through an ATM

# style program.

from __future__ import print_function

def pct_to_dec(num):

"""Returns decimal version of percent"""

dec = float(num) / 100

return dec

class Account(object):

"""Creates an Account"""

def __init__(self, balance, int_rate, act_type, min_balance, **kwargs):

self.balance = balance

self.int_rate = int_rate

self.act_type = act_type

self.min_balance = min_balance

super(Account, self).__init__(**kwargs)

def __str__(self):

"""Returns formatted account type and balance"""

# Charge $25 fee if balance drops below minimum

if self.balance < self.min_balance:

self.balance -= 25

# Add interest

self.balance += round(self.balance * pct_to_dec(self.int_rate), 2)

return '{0}: ${1}'.format(self.act_type, self.balance)

class CheckingAccount(Account):

"""Creates a CheckingAccount Account"""

def __init__(self, **kwargs):

super(CheckingAccount, self).__init__(**kwargs)

class SavingsAccount(Account):

"""Creates a SavingsAccount Account"""

def __init__(self, **kwargs):

super(SavingsAccount, self).__init__(**kwargs)

class BusinessAccount(Account):

"""Creates a BusinessAccount Account"""

def __init__(self, **kwargs):

super(BusinessAccount, self).__init__(**kwargs)

# pylint: disable=C0103

ca1 = CheckingAccount(balance=500, int_rate=0.25, act_type='Checking Account',

min_balance=0)

sa1 = SavingsAccount(balance=50, int_rate=0.50, act_type='Savings Account',

min_balance=0)

ba1 = BusinessAccount(balance=4000, int_rate=0.75, act_type='Business Account',

min_balance=5000)

# Month #1 statement, initial deposits plus interest

print(ca1)

print(sa1)

print(ba1)

print('-------------')

# Month #2 statement plus interest

# Make deposit into checking

setattr(ca1, 'balance', (ca1.balance + 1000))

# Withdraw from checking

setattr(ca1, 'balance', (ca1.balance - 500))

# Make a deposit into savings

setattr(sa1, 'balance', (sa1.balance + 100))

print(ca1)

print(sa1)

print(ba1)

print('-------------')

# Month #3 statement plus interest

# Make deposit into checking

setattr(ca1, 'balance', (ca1.balance + 2500))

# Withdraw from checking

setattr(ca1, 'balance', (ca1.balance - 700))

# Make a deposit into savings

setattr(sa1, 'balance', (sa1.balance + 100))

# Make a deposit into business

setattr(ba1, 'balance', (ba1.balance + 1000))

print(ca1)

print(sa1)

print(ba1)

4 0
3 years ago
Which feature of vitualization helps increase the IT productivity of a business?
laila [671]
A the answer is yes
7 0
3 years ago
The capital letter Wis expressed as U+0057 in which system?
Paul [167]

The capital letter W is expressed as U+0057 in Unicode system

  • The Unicode system is known as a type of coding system which contains worldwide character encoding standard that gives a code to every character and symbol in every language spoken in the world today.

  • It is known as the encoding standard that is used in all languages, It makes sure that an individual can retrieve or combine data with the use of different languages altogether.

Conclusively, we can say that the The capital letter W is expressed as U+0057 in Unicode system

Learn more from:

brainly.com/question/24736173

6 0
2 years ago
Read 2 more answers
Which of the following ribbon tools would be most efficient for applying multiple
pshichka [43]

Answer:

Option A, Font Dialog Box

Explanation:

In order to make changes in the text formatting, the font setting in the dialog box can be used on the Ribbon's Home tab.

From the font settings in Word 2016, one can change the following change font color, size, style etc.

Hence, option A is correct

8 0
2 years ago
You receive an email from someone who claims to be a representative from your credit card company. the email asks you to clink o
larisa86 [58]
You should call the company that your credit card is in and ask if you were sent an email. tell the time it was sent. the date. everything.
8 0
3 years ago
Other questions:
  • When a typist changes from a conventional typewriter to a word processor, his typing schema will have to _____ to incorporate th
    12·1 answer
  • When an IRET instruction isexecuted, what action takes place?
    13·1 answer
  • The data in a data warehouse have which of the following characteristics?
    13·1 answer
  • Which tab provides commands for the most commonly used elements in Word software?
    15·1 answer
  • "_____ devices improve memory by encoding items in a special way."
    13·1 answer
  • Initialize the tuple team_names with the strings 'Rockets', 'Raptors', 'Warriors', and 'Celtics' (The top-4 2018 NBA teams at th
    9·1 answer
  • Your boss is very skeptical about the idea of storing his files up in the cloud rather than on a local storage drive. He asks yo
    7·1 answer
  • Tara is creating a presentation for her science project about volcanoes. She added different animations to every slide for empha
    12·1 answer
  • Is there any difference beetween the old version of spyro released on the origional and the newer ones??? or is it only change i
    8·1 answer
  • This computer is used by touching your finger.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!